(bug 34960) drop unused fields rc_moved_to_ns/rc_moved_to_title
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 29 Sep 2012 10:25:31 +0000 (12:25 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 29 Sep 2012 15:19:40 +0000 (17:19 +0200)
Change-Id: I68e8c0bb23f185c0f996a8905f6d437db3080aa1

RELEASE-NOTES-1.21
includes/RecentChange.php
includes/api/ApiQueryRecentChanges.php
includes/installer/MysqlUpdater.php
includes/installer/SqliteUpdater.php
maintenance/archives/patch-rc_moved.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-rc_moved.sql [new file with mode: 0644]
maintenance/tables.sql
maintenance/updateSearchIndex.php

index 53e3fd5..63be7ba 100644 (file)
@@ -19,6 +19,7 @@ production.
 * (bug 40353) SpecialDoubleRedirect should support interwiki redirects.
 * (bug 40352) fixDoubleRedirects.php should support interwiki redirects.
 * (bug 9237) SpecialBrokenRedirect should not list interwiki redirects.
+* (bug 34960) Drop unused fields rc_moved_to_ns and rc_moved_to_title from recentchanges table.
 
 === API changes in 1.21 ===
 * (bug 35693) ApiQueryImageInfo now suppresses errors when unserializing metadata.
index 332d039..debec69 100644 (file)
@@ -162,17 +162,6 @@ class RecentChange {
                return $this->mTitle;
        }
 
-       /**
-        * @return bool|Title
-        */
-       public function getMovedToTitle() {
-               if( $this->mMovedToTitle === false ) {
-                       $this->mMovedToTitle = Title::makeTitle( $this->mAttribs['rc_moved_to_ns'],
-                               $this->mAttribs['rc_moved_to_title'] );
-               }
-               return $this->mMovedToTitle;
-       }
-
        /**
         * Get the User object of the person who performed this change.
         *
@@ -421,8 +410,6 @@ class RecentChange {
                        'rc_this_oldid' => $newId,
                        'rc_last_oldid' => $oldId,
                        'rc_bot'        => $bot ? 1 : 0,
-                       'rc_moved_to_ns' => 0,
-                       'rc_moved_to_title' => '',
                        'rc_ip'         => self::checkIPAddress( $ip ),
                        'rc_patrolled'  => intval($patrol),
                        'rc_new'        => 0,  # obsolete
@@ -481,8 +468,6 @@ class RecentChange {
                        'rc_this_oldid'     => $newId,
                        'rc_last_oldid'     => 0,
                        'rc_bot'            => $bot ? 1 : 0,
-                       'rc_moved_to_ns'    => 0,
-                       'rc_moved_to_title' => '',
                        'rc_ip'             => self::checkIPAddress( $ip ),
                        'rc_patrolled'      => intval($patrol),
                        'rc_new'            => 1, # obsolete
@@ -570,8 +555,6 @@ class RecentChange {
                        'rc_this_oldid' => 0,
                        'rc_last_oldid' => 0,
                        'rc_bot'        => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot', true ) : 0,
-                       'rc_moved_to_ns' => 0,
-                       'rc_moved_to_title' => '',
                        'rc_ip'         => self::checkIPAddress( $ip ),
                        'rc_patrolled'  => 1,
                        'rc_new'        => 0, # obsolete
@@ -624,8 +607,6 @@ class RecentChange {
                        'rc_this_oldid' => $row->rev_id,
                        'rc_last_oldid' => isset($row->rc_last_oldid) ? $row->rc_last_oldid : 0,
                        'rc_bot'        => 0,
-                       'rc_moved_to_ns'        => 0,
-                       'rc_moved_to_title'     => '',
                        'rc_ip' => '',
                        'rc_id' => $row->rc_id,
                        'rc_patrolled' => $row->rc_patrolled,
index 7ae4f37..84c2332 100644 (file)
@@ -214,8 +214,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        'rc_title',
                        'rc_cur_id',
                        'rc_type',
-                       'rc_moved_to_ns',
-                       'rc_moved_to_title',
                        'rc_deleted'
                ) );
 
@@ -321,12 +319,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
         * @access public
         */
        public function extractRowInfo( $row ) {
-               /* If page was moved somewhere, get the title of the move target. */
-               $movedToTitle = false;
-               if ( isset( $row->rc_moved_to_title ) && $row->rc_moved_to_title !== '' ) {
-                       $movedToTitle = Title::makeTitle( $row->rc_moved_to_ns, $row->rc_moved_to_title );
-               }
-
                /* Determine the title of the page that has been changed. */
                $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
 
@@ -359,9 +351,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                /* Create a new entry in the result for the title. */
                if ( $this->fld_title ) {
                        ApiQueryBase::addTitleInfo( $vals, $title );
-                       if ( $movedToTitle ) {
-                               ApiQueryBase::addTitleInfo( $vals, $movedToTitle, 'new_' );
-                       }
                }
 
                /* Add ids, such as rcid, pageid, revid, and oldid to the change's info. */
index 037af7b..98e1386 100644 (file)
@@ -217,6 +217,7 @@ class MysqlUpdater extends DatabaseUpdater {
 
                        // 1.21
                        array( 'dropField', 'site_stats',   'ss_admins',        'patch-drop-ss_admins.sql' ),
+                       array( 'dropField', 'recentchanges', 'rc_moved_to_title',            'patch-rc_moved.sql' ),
                );
        }
 
index 8813b85..95a61c1 100644 (file)
@@ -96,6 +96,7 @@ class SqliteUpdater extends DatabaseUpdater {
 
                        // 1.21
                        array( 'dropField', 'site_stats',   'ss_admins',        'patch-drop-ss_admins.sql' ),
+                       array( 'dropField', 'recentchanges', 'rc_moved_to_title', 'patch-rc_moved.sql' ),
                );
        }
 
diff --git a/maintenance/archives/patch-rc_moved.sql b/maintenance/archives/patch-rc_moved.sql
new file mode 100644 (file)
index 0000000..2fa1de6
--- /dev/null
@@ -0,0 +1,4 @@
+-- rc_moved_to_ns and rc_moved_to_title is no longer used, delete the fields
+
+ALTER TABLE /*$wgDBprefix*/recentchanges DROP COLUMN rc_moved_to_ns,
+                                         DROP COLUMN rc_moved_to_title;
diff --git a/maintenance/sqlite/archives/patch-rc_moved.sql b/maintenance/sqlite/archives/patch-rc_moved.sql
new file mode 100644 (file)
index 0000000..70248d5
--- /dev/null
@@ -0,0 +1,46 @@
+-- rc_moved_to_ns and rc_moved_to_title is no longer used, delete the fields
+
+CREATE TABLE /*_*/recentchanges_tmp (
+  rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  rc_timestamp varbinary(14) NOT NULL default '',
+  rc_cur_time varbinary(14) NOT NULL default '',
+  rc_user int unsigned NOT NULL default 0,
+  rc_user_text varchar(255) binary NOT NULL,
+  rc_namespace int NOT NULL default 0,
+  rc_title varchar(255) binary NOT NULL default '',
+  rc_comment varchar(255) binary NOT NULL default '',
+  rc_minor tinyint unsigned NOT NULL default 0,
+  rc_bot tinyint unsigned NOT NULL default 0,
+  rc_new tinyint unsigned NOT NULL default 0,
+  rc_cur_id int unsigned NOT NULL default 0,
+  rc_this_oldid int unsigned NOT NULL default 0,
+  rc_last_oldid int unsigned NOT NULL default 0,
+  rc_type tinyint unsigned NOT NULL default 0,
+  rc_patrolled tinyint unsigned NOT NULL default 0,
+  rc_ip varbinary(40) NOT NULL default '',
+  rc_old_len int,
+  rc_new_len int,
+  rc_deleted tinyint unsigned NOT NULL default 0,
+  rc_logid int unsigned NOT NULL default 0,
+  rc_log_type varbinary(255) NULL default NULL,
+  rc_log_action varbinary(255) NULL default NULL,
+  rc_params blob NULL
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/recentchanges_tmp
+       SELECT rc_id, rc_timestamp, rc_cur_time, rc_user, rc_user_text, rc_namespace, rc_title, rc_comment,
+               rc_minor, rc_bot, rc_new, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_patrolled, rc_ip,
+               rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, rc_params
+               FROM /*_*/recentchanges;
+
+DROP TABLE /*_*/recentchanges;
+
+ALTER TABLE /*_*/recentchanges_tmp RENAME TO /*_*/recentchanges;
+
+CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
+CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
+CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
+CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
+CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
+CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
+CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
index 1ddc89d..f66ef06 100644 (file)
@@ -1042,10 +1042,6 @@ CREATE TABLE /*_*/recentchanges (
   -- The type of change entry (RC_EDIT,RC_NEW,RC_LOG)
   rc_type tinyint unsigned NOT NULL default 0,
 
-  -- These may no longer be used, with the new move log.
-  rc_moved_to_ns tinyint unsigned NOT NULL default 0,
-  rc_moved_to_title varchar(255) binary NOT NULL default '',
-
   -- If the Recent Changes Patrol option is enabled,
   -- users may mark edits as having been reviewed to
   -- remove a warning flag on the RC list.
index 2a71e7e..ac78484 100644 (file)
@@ -96,9 +96,9 @@ class UpdateSearchIndex extends Maintenance {
                $end = $dbw->timestamp( $end );
 
                $page = $dbw->tableName( 'page' );
-               $sql = "SELECT rc_cur_id,rc_type,rc_moved_to_ns,rc_moved_to_title FROM $recentchanges
+               $sql = "SELECT rc_cur_id FROM $recentchanges
                  JOIN $page ON rc_cur_id=page_id AND rc_this_oldid=page_latest
-                 WHERE rc_timestamp BETWEEN '$start' AND '$end'
+                 WHERE rc_type != " . RC_LOG . " AND rc_timestamp BETWEEN '$start' AND '$end'
                  ";
                $res = $dbw->query( $sql, __METHOD__ );
 
@@ -108,17 +108,7 @@ class UpdateSearchIndex extends Maintenance {
        }
 
        public function searchIndexUpdateCallback( $dbw, $row ) {
-               if ( $row->rc_type == RC_MOVE || $row->rc_type == RC_MOVE_OVER_REDIRECT ) {
-                       # Rename searchindex entry
-                       $titleObj = Title::makeTitle( $row->rc_moved_to_ns, $row->rc_moved_to_title );
-                       $title = $titleObj->getPrefixedDBkey();
-                       $this->output( "$title..." );
-                       $u = new SearchUpdate( $row->rc_cur_id, $title, false );
-                       $u->doUpdate();
-                       $this->output( "\n" );
-               } elseif ( $row->rc_type !== RC_LOG ) {
-                       $this->updateSearchIndexForPage( $dbw, $row->rc_cur_id );
-               }
+               $this->updateSearchIndexForPage( $dbw, $row->rc_cur_id );
        }
 }