Merge "QA: porting login test from /qa/browsertests"
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index 3f2e2cb..28dac46 100644 (file)
@@ -155,10 +155,11 @@ abstract class DatabaseUpdater {
        }
 
        /**
-        * @throws MWException
         * @param DatabaseBase $db
         * @param bool $shared
-        * @param null $maintenance
+        * @param Maintenance $maintenance
+        *
+        * @throws MWException
         * @return DatabaseUpdater
         */
        public static function newForDB( &$db, $shared = false, $maintenance = null ) {
@@ -231,9 +232,9 @@ abstract class DatabaseUpdater {
        /**
         * @since 1.19
         *
-        * @param $tableName string
-        * @param $indexName string
-        * @param $sqlPath string
+        * @param string $tableName
+        * @param string $indexName
+        * @param string $sqlPath
         */
        public function addExtensionIndex( $tableName, $indexName, $sqlPath ) {
                $this->extensionUpdates[] = array( 'addIndex', $tableName, $indexName, $sqlPath, true );
@@ -243,9 +244,9 @@ abstract class DatabaseUpdater {
         *
         * @since 1.19
         *
-        * @param $tableName string
-        * @param $columnName string
-        * @param $sqlPath string
+        * @param string $tableName
+        * @param string $columnName
+        * @param string $sqlPath
         */
        public function addExtensionField( $tableName, $columnName, $sqlPath ) {
                $this->extensionUpdates[] = array( 'addField', $tableName, $columnName, $sqlPath, true );
@@ -255,9 +256,9 @@ abstract class DatabaseUpdater {
         *
         * @since 1.20
         *
-        * @param $tableName string
-        * @param $columnName string
-        * @param $sqlPath string
+        * @param string $tableName
+        * @param string $columnName
+        * @param string $sqlPath
         */
        public function dropExtensionField( $tableName, $columnName, $sqlPath ) {
                $this->extensionUpdates[] = array( 'dropField', $tableName, $columnName, $sqlPath, true );
@@ -280,8 +281,8 @@ abstract class DatabaseUpdater {
         *
         * @since 1.20
         *
-        * @param $tableName string
-        * @param $sqlPath string
+        * @param string $tableName
+        * @param string $sqlPath
         */
        public function dropExtensionTable( $tableName, $sqlPath ) {
                $this->extensionUpdates[] = array( 'dropTable', $tableName, $sqlPath, true );
@@ -295,7 +296,7 @@ abstract class DatabaseUpdater {
         * @param string $tableName The table name
         * @param string $oldIndexName The old index name
         * @param string $newIndexName The new index name
-        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the old
+        * @param bool $skipBothIndexExistWarning Whether to warn if both the old
         * and the new indexes exist. [facultative; by default, false]
         * @param string $sqlPath The path to the SQL change path
         */
@@ -328,7 +329,7 @@ abstract class DatabaseUpdater {
         *
         * @since 1.20
         *
-        * @param $tableName string
+        * @param string $tableName
         * @return bool
         */
        public function tableExists( $tableName ) {
@@ -351,7 +352,7 @@ abstract class DatabaseUpdater {
        /**
         * Get the list of extension-defined updates
         *
-        * @return Array
+        * @return array
         */
        protected function getExtensionUpdates() {
                return $this->extensionUpdates;
@@ -370,6 +371,7 @@ abstract class DatabaseUpdater {
         * @since 1.21
         *
         * Writes the schema updates desired to a file for the DB Admin to run.
+        * @param array $schemaUpdate
         */
        private function writeSchemaUpdateFile( $schemaUpdate = array() ) {
                $updates = $this->updatesSkipped;
@@ -422,9 +424,8 @@ abstract class DatabaseUpdater {
        /**
         * Helper function for doUpdates()
         *
-        * @param array $updates of updates to run
-        * @param bool $passSelf Whether to pass this object we calling external
-        *                  functions
+        * @param array $updates Array of updates to run
+        * @param bool $passSelf Whether to pass this object we calling external functions
         */
        private function runUpdates( array $updates, $passSelf ) {
                $updatesDone = array();
@@ -475,7 +476,8 @@ abstract class DatabaseUpdater {
        public function updateRowExists( $key ) {
                $row = $this->db->selectRow(
                        'updatelog',
-                       '1',
+                       # Bug 65813
+                       '1 AS X',
                        array( 'ul_key' => $key ),
                        __METHOD__
                );
@@ -506,7 +508,7 @@ abstract class DatabaseUpdater {
         * class does). Pre-1.17 wikis won't have this column, and really old wikis
         * might not even have updatelog at all
         *
-        * @return boolean
+        * @return bool
         */
        protected function canUseNewUpdatelog() {
                return $this->db->tableExists( 'updatelog', __METHOD__ ) &&
@@ -530,7 +532,12 @@ abstract class DatabaseUpdater {
                        return true;
                }
 
-               return !in_array( $name, $wgSharedTables );
+               if ( in_array( $name, $wgSharedTables ) ) {
+                       $this->output( "...skipping update to shared table $name.\n" );
+                       return false;
+               } else {
+                       return true;
+               }
        }
 
        /**
@@ -621,7 +628,7 @@ abstract class DatabaseUpdater {
         * Applies a SQL patch
         *
         * @param string $path Path to the patch file
-        * @param $isFullPath Boolean Whether to treat $path as a relative or not
+        * @param bool $isFullPath Whether to treat $path as a relative or not
         * @param string $msg Description of the patch
         * @return bool False if patch is skipped.
         */
@@ -774,7 +781,7 @@ abstract class DatabaseUpdater {
         * @param string $table Name of the table to modify
         * @param string $oldIndex Old name of the index
         * @param string $newIndex New name of the index
-        * @param $skipBothIndexExistWarning Boolean: Whether to warn if both the
+        * @param bool $skipBothIndexExistWarning Whether to warn if both the
         * old and the new indexes exist.
         * @param string $patch Path to the patch file
         * @param bool $fullpath Whether to treat $patch path as a relative or not