Reedy has submitted this change and it was merged.

Change subject: Revert "Add new recentchanges field rc_source to replace 
rc_type"
......................................................................


Revert "Add new recentchanges field rc_source to replace rc_type"

Apparently the rc_source column has been added on only 158 out of 879 wikis 
total.

Needs to be merged and deployed before/at the start of todays deploy

This reverts commit 6bbd4bca6c1341395988fdfdcf4788ce187edfa9.

Change-Id: Ibcf77ed7f04c14a477d7cfd0e244929c552c3394
(cherry picked from commit 189b7364b5e48d86ec0b078c8aad7124e4d09b29)
---
M RELEASE-NOTES-1.22
M includes/changes/RecentChange.php
M includes/installer/MysqlUpdater.php
M includes/installer/PostgresUpdater.php
M includes/installer/SqliteUpdater.php
D maintenance/archives/patch-rc_source.sql
D maintenance/populateRecentChangesSource.php
M maintenance/postgres/tables.sql
M maintenance/rebuildrecentchanges.php
M maintenance/tables.sql
10 files changed, 0 insertions(+), 157 deletions(-)

Approvals:
  Reedy: Verified; Looks good to me, approved



diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 769f661..6ce2801 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -421,15 +421,6 @@
 * (bug 46751) Made Buryat (Russia) (буряад) (bxr) fallback to Russian.
 
 === Other changes in 1.22 ===
-* The rc_type field in the recentchanges table has been superseded by a new
-  rc_source field.  The rc_source field is a string representation of the
-  change type where rc_type was a numeric constant.  This field is not yet
-  queried but will be in a future point release of 1.22.  
-** Utilize update.php to create and populate this new field.  On larger wiki's
-   which do not wish to update recentchanges table in one large update please
-   review the sql and comments in maintenance/archives/patch-rc_source.sql.
-** The rc_type field of recentchanges will be deprecated in a future point
-   release.
 * BREAKING CHANGE: Implementation of MediaWiki's JS and JSON value encoding
   has changed:
 ** MediaWiki no longer supports PHP installations in which the native JSON
diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index 282890f..980bd0a 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -30,7 +30,6 @@
  *  rc_namespace    namespace #
  *  rc_title        non-prefixed db key
  *  rc_type         is new entry, used to determine whether updating is 
necessary
- *  rc_source       string representation of change source
  *  rc_minor        is minor
  *  rc_cur_id       page_id of associated page entry
  *  rc_user         user id who made the entry
@@ -65,14 +64,6 @@
  * @todo document functions and variables
  */
 class RecentChange {
-
-       // Constants for the rc_source field.  Extensions may also have
-       // their own source constants.
-       const SRC_EDIT = 'mw.edit';
-       const SRC_NEW = 'mw.new';
-       const SRC_LOG = 'mw.log';
-       const SRC_EXTERNAL = 'mw.external'; // obsolete
-
        var $mAttribs = array(), $mExtra = array();
 
        /**
@@ -168,7 +159,6 @@
                        'rc_this_oldid',
                        'rc_last_oldid',
                        'rc_type',
-                       'rc_source',
                        'rc_patrolled',
                        'rc_ip',
                        'rc_old_len',
@@ -499,7 +489,6 @@
                        'rc_namespace'  => $title->getNamespace(),
                        'rc_title'      => $title->getDBkey(),
                        'rc_type'       => RC_EDIT,
-                       'rc_source'     => self::SRC_EDIT,
                        'rc_minor'      => $minor ? 1 : 0,
                        'rc_cur_id'     => $title->getArticleID(),
                        'rc_user'       => $user->getId(),
@@ -559,7 +548,6 @@
                        'rc_namespace'      => $title->getNamespace(),
                        'rc_title'          => $title->getDBkey(),
                        'rc_type'           => RC_NEW,
-                       'rc_source'         => self::SRC_NEW,
                        'rc_minor'          => $minor ? 1 : 0,
                        'rc_cur_id'         => $title->getArticleID(),
                        'rc_user'           => $user->getId(),
@@ -669,7 +657,6 @@
                        'rc_namespace'  => $target->getNamespace(),
                        'rc_title'      => $target->getDBkey(),
                        'rc_type'       => RC_LOG,
-                       'rc_source'     => self::SRC_LOG,
                        'rc_minor'      => 0,
                        'rc_cur_id'     => $target->getArticleID(),
                        'rc_user'       => $user->getId(),
@@ -729,7 +716,6 @@
                        'rc_comment' => $row->rev_comment,
                        'rc_minor' => $row->rev_minor_edit ? 1 : 0,
                        'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
-                       'rc_source' => $row->page_is_new ? self::SRC_NEW : 
self::SRC_EDIT,
                        'rc_cur_id' => $row->page_id,
                        'rc_this_oldid' => $row->rev_id,
                        'rc_last_oldid' => isset( $row->rc_last_oldid ) ? 
$row->rc_last_oldid : 0,
diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index 0594073..6ff7af0 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -239,7 +239,6 @@
                                'patch-iwlinks-from-title-index.sql' ),
                        array( 'addField', 'archive', 'ar_id', 
'patch-archive-ar_id.sql' ),
                        array( 'addField', 'externallinks', 'el_id', 
'patch-externallinks-el_id.sql' ),
-                       array( 'addField', 'recentchanges', 'rc_source', 
'patch-rc_source.sql' ),
                );
        }
 
diff --git a/includes/installer/PostgresUpdater.php 
b/includes/installer/PostgresUpdater.php
index 32e7510..dfe7865 100644
--- a/includes/installer/PostgresUpdater.php
+++ b/includes/installer/PostgresUpdater.php
@@ -395,9 +395,6 @@
                        array( 'addInterwikiType' ),
                        # end
                        array( 'tsearchFixes' ),
-
-                       // 1.22
-                       array( 'addPgField', 'recentchanges', 'rc_source',      
      "TEXT NOT NULL DEFAULT ''" ),
                );
        }
 
diff --git a/includes/installer/SqliteUpdater.php 
b/includes/installer/SqliteUpdater.php
index 020993a..78ca51106 100644
--- a/includes/installer/SqliteUpdater.php
+++ b/includes/installer/SqliteUpdater.php
@@ -114,9 +114,6 @@
                        array( 'addIndex', 'iwlinks', 'iwl_prefix_from_title', 
'patch-iwlinks-from-title-index.sql' ),
                        array( 'addField', 'archive', 'ar_id', 
'patch-archive-ar_id.sql' ),
                        array( 'addField', 'externallinks', 'el_id', 
'patch-externallinks-el_id.sql' ),
-
-                       // 1.22
-                       array( 'addField', 'recentchanges', 'rc_source', 
'patch-rc_source.sql' ),
                );
        }
 
diff --git a/maintenance/archives/patch-rc_source.sql 
b/maintenance/archives/patch-rc_source.sql
deleted file mode 100644
index 7dedd74..0000000
--- a/maintenance/archives/patch-rc_source.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- first step of migrating recentchanges rc_type to rc_source
-ALTER TABLE /*$wgDBprefix*/recentchanges
-  ADD rc_source varbinary(16) NOT NULL default '';
-
--- Populate rc_source field with the data from rc_type
--- Large wiki's might prefer the PopulateRecentChangeSource maintenance
--- script to batch updates into groups rather than all at once.
-UPDATE /*$wgDBprefix*/recentchanges
-  SET rc_source = CASE
-    WHEN rc_type = 0 THEN 'mw.edit'
-    WHEN rc_type = 1 THEN 'mw.new'
-    WHEN rc_type = 3 THEN 'mw.log'
-    WHEN rc_type = 5 THEN 'mw.external'
-    ELSE ''
-  END
-WHERE rc_source = '';
diff --git a/maintenance/populateRecentChangesSource.php 
b/maintenance/populateRecentChangesSource.php
deleted file mode 100644
index 0e8e501..0000000
--- a/maintenance/populateRecentChangesSource.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Upgrade script to populate the rc_source field
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance
- */
-
-require_once dirname( __FILE__ ) . '/Maintenance.php';
-
-/**
- * Maintenance script to populate the rc_source field.
- *
- * @ingroup Maintenance
- * @since 1.22
- */
-class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
-       public function __construct() {
-               parent::__construct();
-               $this->mDescription = "Populates rc_source field of the 
recentchanges table with the data in rc_type.";
-               $this->setBatchSize( 100 );
-       }
-
-       protected function doDBUpdates() {
-               $dbw = $this->getDB( DB_MASTER );
-               if ( !$dbw->fieldExists( 'recentchanges', 'rc_source' ) ) {
-                       $this->error( 'rc_source field in recentchanges table 
does not exist.' );
-               }
-
-               $start = $dbw->selectField( 'recentchanges', 'MIN(rc_id)', 
false, __METHOD__ );
-               if ( !$start ) {
-                       $this->output( "Nothing to do.\n" );
-                       return true;
-               }
-               $end = $dbw->selectField( 'recentchanges', 'MAX(rc_id)', false, 
__METHOD__ );
-               $end += $this->mBatchSize - 1;
-               $blockStart = $start;
-               $blockEnd = $start + $this->mBatchSize - 1;
-
-               $updatedValues = $this->buildUpdateCondition( $dbw );
-
-               while ( $blockEnd <= $end ) {
-                       $cond = "rc_id BETWEEN $blockStart AND $blockEnd";
-
-                       $dbw->update(
-                               'recentchanges',
-                               array( $updatedValues ),
-                               array(
-                                       "rc_source = ''",
-                                       "rc_id BETWEEN $blockStart AND 
$blockEnd"
-                               ),
-                               __METHOD__
-                       );
-
-                       $this->output( "." );
-                       wfWaitForSlaves();
-
-                       $blockStart += $this->mBatchSize;
-                       $blockEnd += $this->mBatchSize;
-               }
-
-               $this->output( "\nDone.\n" );
-       }
-
-       protected function getUpdateKey() {
-               return __CLASS__;
-       }
-
-       protected function buildUpdateCondition( DatabaseBase $dbw ) {
-               $rcNew = $dbw->addQuotes( RC_NEW );
-               $rcSrcNew = $dbw->addQuotes( RecentChange::SRC_NEW );
-               $rcEdit = $dbw->addQuotes( RC_EDIT );
-               $rcSrcEdit = $dbw->addQuotes( RecentChange::SRC_EDIT );
-               $rcLog = $dbw->addQuotes( RC_LOG );
-               $rcSrcLog = $dbw->addQuotes( RecentChange::SRC_LOG );
-               $rcExternal = $dbw->addQuotes( RC_EXTERNAL );
-               $rcSrcExternal = $dbw->addQuotes( RecentChange::SRC_EXTERNAL );
-
-               return "rc_source = CASE
-                                       WHEN rc_type = $rcNew THEN $rcSrcNew
-                                       WHEN rc_type = $rcEdit THEN $rcSrcEdit
-                                       WHEN rc_type = $rcLog THEN $rcSrcLog
-                                       WHEN rc_type = $rcExternal THEN 
$rcSrcExternal
-                                       ELSE ''
-                               END";
-       }
-}
-
-$maintClass = "PopulateRecentChangesSource";
-require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql
index d0d1e92..bc2428e 100644
--- a/maintenance/postgres/tables.sql
+++ b/maintenance/postgres/tables.sql
@@ -411,7 +411,6 @@
   rc_this_oldid      INTEGER      NOT NULL,
   rc_last_oldid      INTEGER      NOT NULL,
   rc_type            SMALLINT     NOT NULL  DEFAULT 0,
-  rc_source          TEXT         NOT NULL,
   rc_patrolled       SMALLINT     NOT NULL  DEFAULT 0,
   rc_ip              CIDR,
   rc_old_len         INTEGER,
diff --git a/maintenance/rebuildrecentchanges.php 
b/maintenance/rebuildrecentchanges.php
index 315176c..1834825 100644
--- a/maintenance/rebuildrecentchanges.php
+++ b/maintenance/rebuildrecentchanges.php
@@ -83,7 +83,6 @@
                                'rc_this_oldid' => 'rev_id',
                                'rc_last_oldid' => 0, // is this ok?
                                'rc_type'       => $dbw->conditional( 
'page_is_new != 0', RC_NEW, RC_EDIT ),
-                               'rc_source'     => $dbw->conditional( 
'page_is_new != 0', $dbw->addQuotes( RecentChange::SRC_NEW ), $dbw->addQuotes( 
RecentChange::SRC_EDIT ) ),
                                'rc_deleted'    => 'rev_deleted'
                        ), array(
                                'rev_timestamp > ' . $dbw->addQuotes( 
$dbw->timestamp( $cutoff ) ),
diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index f5d8790..05d846d 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -1062,10 +1062,6 @@
   -- The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)
   rc_type tinyint unsigned NOT NULL default 0,
 
-  -- The source of the change entry (replaces rc_type)
-  -- default of '' is temporary, needed for initial migration
-  rc_source varchar(16) 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.

-- 
To view, visit https://gerrit.wikimedia.org/r/93117
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcf77ed7f04c14a477d7cfd0e244929c552c3394
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.23wmf2
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to