PleaseStand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/78202


Change subject: Remove remaining calls to MWInit methods
......................................................................

Remove remaining calls to MWInit methods

... as well as the require_once statements in includes/WebStart.php
and maintenance/doMaintenance.php, now that the autoloader lists
MWInit (since r85807 / c68957c5e3ada65806294bc9bc5938aa18c6e50c).

Also removed code paths in maintenance/userDupes.inc that seem to be
dead (class_exists( 'Revision' ) should always be true) and useless
global/require_once statements in languages/Language.php.

Follows-up Ic3e769f1fbad4f7ad26dd819406796fee48c6b45.

Change-Id: I48fd6810fdb923b3065ae98024912eb18d394415
---
M includes/WebStart.php
M languages/Language.php
M maintenance/Maintenance.php
M maintenance/doMaintenance.php
M maintenance/userDupes.inc
5 files changed, 21 insertions(+), 73 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/78202/1

diff --git a/includes/WebStart.php b/includes/WebStart.php
index f840a5e..58c953a 100644
--- a/includes/WebStart.php
+++ b/includes/WebStart.php
@@ -91,9 +91,6 @@
        }
 }
 
-# Get MWInit class
-require_once "$IP/includes/Init.php";
-
 # Start the autoloader, so that extensions can derive classes from core files
 require_once "$IP/includes/AutoLoader.php";
 
diff --git a/languages/Language.php b/languages/Language.php
index 262d86f..6f39b3f 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -30,10 +30,6 @@
        exit( 1 );
 }
 
-# Read language names
-global $wgLanguageNames;
-require_once __DIR__ . '/Names.php';
-
 if ( function_exists( 'mb_strtoupper' ) ) {
        mb_internal_encoding( 'UTF-8' );
 }
@@ -228,7 +224,7 @@
                // Check if there is a language class for the code
                $class = self::classFromCode( $code );
                self::preloadLanguageClass( $class );
-               if ( MWInit::classExists( $class ) ) {
+               if ( class_exists( $class ) ) {
                        $lang = new $class;
                        return $lang;
                }
@@ -242,7 +238,7 @@
 
                        $class = self::classFromCode( $fallbackCode );
                        self::preloadLanguageClass( $class );
-                       if ( MWInit::classExists( $class ) ) {
+                       if ( class_exists( $class ) ) {
                                $lang = Language::newFromCode( $fallbackCode );
                                $lang->setCode( $code );
                                return $lang;
@@ -392,7 +388,8 @@
                }
 
                if ( $coreLanguageNames === null ) {
-                       include MWInit::compiledPath( 'languages/Names.php' );
+                       global $IP;
+                       include "$IP/languages/Names.php";
                }
 
                if ( isset( $coreLanguageNames[$tag] )
@@ -863,7 +860,8 @@
                static $coreLanguageNames;
 
                if ( $coreLanguageNames === null ) {
-                       include MWInit::compiledPath( 'languages/Names.php' );
+                       global $IP;
+                       include "$IP/languages/Names.php";
                }
 
                $names = array();
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index e29ffd9..0023c6d 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -453,11 +453,11 @@
         */
        public function runChild( $maintClass, $classFile = null ) {
                // Make sure the class is loaded first
-               if ( !MWInit::classExists( $maintClass ) ) {
+               if ( !class_exists( $maintClass ) ) {
                        if ( $classFile ) {
                                require_once $classFile;
                        }
-                       if ( !MWInit::classExists( $maintClass ) ) {
+                       if ( !class_exists( $maintClass ) ) {
                                $this->error( "Cannot spawn child: $maintClass" 
);
                        }
                }
@@ -1171,7 +1171,7 @@
         * @return bool
         */
        public static function posix_isatty( $fd ) {
-               if ( !MWInit::functionExists( 'posix_isatty' ) ) {
+               if ( !function_exists( 'posix_isatty' ) ) {
                        return !$fd;
                } else {
                        return posix_isatty( $fd );
diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php
index 69b4b9c..3bd508c 100644
--- a/maintenance/doMaintenance.php
+++ b/maintenance/doMaintenance.php
@@ -53,8 +53,6 @@
 // to $maintenance->mSelf. Keep that here for b/c
 $self = $maintenance->getName();
 
-# Get the MWInit class
-require_once "$IP/includes/Init.php";
 # Start the autoloader, so that extensions can derive classes from core files
 require_once "$IP/includes/AutoLoader.php";
 # Stub the profiler
@@ -68,7 +66,7 @@
 
 // Some other requires
 require_once "$IP/includes/Defines.php";
-require_once MWInit::compiledPath( 'includes/DefaultSettings.php' );
+require_once "$IP/includes/DefaultSettings.php";
 
 # Load composer's autoloader if present
 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
@@ -86,7 +84,7 @@
                # Maybe a hook?
                global $cluster;
                $cluster = 'pmtpa';
-               require MWInit::interpretedPath( '../wmf-config/wgConf.php' );
+               require "$IP/../wmf-config/wgConf.php";
        }
        // Require the configuration (probably LocalSettings.php)
        require $maintenance->loadSettings();
@@ -95,7 +93,7 @@
 if ( $maintenance->getDbType() === Maintenance::DB_ADMIN &&
        is_readable( "$IP/AdminSettings.php" ) )
 {
-       require MWInit::interpretedPath( 'AdminSettings.php' );
+       require "$IP/AdminSettings.php";
 }
 
 if ( $maintenance->getDbType() === Maintenance::DB_NONE ) {
@@ -105,7 +103,7 @@
 }
 $maintenance->finalSetup();
 // Some last includes
-require_once MWInit::compiledPath( 'includes/Setup.php' );
+require_once "$IP/includes/Setup.php";
 
 // Much much faster startup than creating a title object
 $wgTitle = null;
diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc
index 6fb29be..8bd80c9 100644
--- a/maintenance/userDupes.inc
+++ b/maintenance/userDupes.inc
@@ -1,6 +1,6 @@
 <?php
 /**
- * Helper class for update.php and upgrade1_5.php.
+ * Helper class for update.php.
  *
  * Copyright © 2005 Brion Vibber <[email protected]>
  * http://www.mediawiki.org/
@@ -158,11 +158,7 @@
         * @access private
         */
        function lock() {
-               if ( $this->newSchema() ) {
-                       $set = array( 'user', 'revision' );
-               } else {
-                       $set = array( 'user', 'cur', 'old' );
-               }
+               $set = array( 'user', 'revision' );
                $names = array_map( array( $this, 'lockTable' ), $set );
                $tables = implode( ',', $names );
 
@@ -171,14 +167,6 @@
 
        function lockTable( $table ) {
                return $this->db->tableName( $table ) . ' WRITE';
-       }
-
-       /**
-        * @return bool
-        * @access private
-        */
-       function newSchema() {
-               return MWInit::classExists( 'Revision' );
        }
 
        /**
@@ -266,27 +254,10 @@
         * @access private
         */
        function editCount( $userid ) {
-               if ( $this->newSchema() ) {
-                       return $this->editCountOn( 'revision', 'rev_user', 
$userid );
-               } else {
-                       return $this->editCountOn( 'cur', 'cur_user', $userid ) 
+
-                               $this->editCountOn( 'old', 'old_user', $userid 
);
-               }
-       }
-
-       /**
-        * Count the number of hits on a given table for this account.
-        * @param $table string
-        * @param $field string
-        * @param $userid int
-        * @return int
-        * @access private
-        */
-       function editCountOn( $table, $field, $userid ) {
                return intval( $this->db->selectField(
-                       $table,
+                       'revision',
                        'COUNT(*)',
-                       array( $field => $userid ),
+                       array( 'rev_user' => $userid ),
                        __METHOD__ ) );
        }
 
@@ -296,26 +267,10 @@
         * @access private
         */
        function reassignEdits( $from, $to ) {
-               $set = $this->newSchema()
-                       ? array( 'revision' => 'rev_user' )
-                       : array( 'cur' => 'cur_user', 'old' => 'old_user' );
-               foreach ( $set as $table => $field ) {
-                       $this->reassignEditsOn( $table, $field, $from, $to );
-               }
-       }
-
-       /**
-        * @param $table string
-        * @param $field string
-        * @param $from int
-        * @param $to int
-        * @access private
-        */
-       function reassignEditsOn( $table, $field, $from, $to ) {
-               $this->out( "reassigning on $table... " );
-               $this->db->update( $table,
-                       array( $field => $to ),
-                       array( $field => $from ),
+               $this->out( 'reassigning... ' );
+               $this->db->update( 'revision',
+                       array( 'rev_user' => $to ),
+                       array( 'rev_user' => $from ),
                        __METHOD__ );
                $this->out( "ok. " );
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48fd6810fdb923b3065ae98024912eb18d394415
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to