Compromise: don't reference log_id on MySQL.
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 7 May 2007 13:41:49 +0000 (13:41 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 7 May 2007 13:41:49 +0000 (13:41 +0000)
includes/LogPage.php

index cb57fd4..b8ef781 100644 (file)
@@ -55,21 +55,27 @@ class LogPage {
 
                $dbw = wfGetDB( DB_MASTER );
                $uid = $wgUser->getID();
+               $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
 
                $this->timestamp = $now = wfTimestampNow();
-               $dbw->insert( 'logging',
-                       array(
-                               'log_type' => $this->type,
-                               'log_action' => $this->action,
-                               'log_timestamp' => $dbw->timestamp( $now ),
-                               'log_user' => $uid,
-                               'log_namespace' => $this->target->getNamespace(),
-                               'log_title' => $this->target->getDBkey(),
-                               'log_comment' => $this->comment,
-                               'log_params' => $this->params
-                       ), $fname
+               $data = array(
+                       'log_type' => $this->type,
+                       'log_action' => $this->action,
+                       'log_timestamp' => $dbw->timestamp( $now ),
+                       'log_user' => $uid,
+                       'log_namespace' => $this->target->getNamespace(),
+                       'log_title' => $this->target->getDBkey(),
+                       'log_comment' => $this->comment,
+                       'log_params' => $this->params
                );
 
+               # log_id doesn't exist on Wikimedia servers yet, and it's a tricky 
+               # schema update to do. Hack it for now to ignore the field on MySQL.
+               if ( !is_null( $log_id ) ) {
+                       $data['log_id'] = $log_id;
+               }
+               $dbw->insert( 'logging', $data, $fname );
+
                # And update recentchanges
                if ( $this->updateRecentChanges ) {
                        $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );