Merge "Move atj in RELEASE-NOTES-1.29 to language section"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 3 Apr 2017 08:19:43 +0000 (08:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 3 Apr 2017 08:19:43 +0000 (08:19 +0000)
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/specials/SpecialRecentchanges.php

index fbfd899..49ddd14 100644 (file)
@@ -1951,24 +1951,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        }
 
        /**
-        * Get the name of an index in a given table.
+        * Allows for index remapping in queries where this is not consistent across DBMS
         *
         * @param string $index
         * @return string
         */
        protected function indexName( $index ) {
-               // Backwards-compatibility hack
-               $renamed = [
-                       'ar_usertext_timestamp' => 'usertext_timestamp',
-                       'un_user_id' => 'user_id',
-                       'un_user_ip' => 'user_ip',
-               ];
-
-               if ( isset( $renamed[$index] ) ) {
-                       return $renamed[$index];
-               } else {
-                       return $index;
-               }
+               return $index;
        }
 
        public function addQuotes( $s ) {
index e900027..6725090 100644 (file)
@@ -1335,4 +1335,38 @@ abstract class DatabaseMysqlBase extends Database {
        public function isView( $name, $prefix = null ) {
                return in_array( $name, $this->listViews( $prefix ) );
        }
+
+       /**
+        * Allows for index remapping in queries where this is not consistent across DBMS
+        *
+        * @param string $index
+        * @return string
+        */
+       protected function indexName( $index ) {
+               /**
+                * When SQLite indexes were introduced in r45764, it was noted that
+                * SQLite requires index names to be unique within the whole database,
+                * not just within a schema. As discussed in CR r45819, to avoid the
+                * need for a schema change on existing installations, the indexes
+                * were implicitly mapped from the new names to the old names.
+                *
+                * This mapping can be removed if DB patches are introduced to alter
+                * the relevant tables in existing installations. Note that because
+                * this index mapping applies to table creation, even new installations
+                * of MySQL have the old names (except for installations created during
+                * a period where this mapping was inappropriately removed, see
+                * T154872).
+                */
+               $renamed = [
+                       'ar_usertext_timestamp' => 'usertext_timestamp',
+                       'un_user_id' => 'user_id',
+                       'un_user_ip' => 'user_ip',
+               ];
+
+               if ( isset( $renamed[$index] ) ) {
+                       return $renamed[$index];
+               } else {
+                       return $index;
+               }
+       }
 }
index 2a5deb6..090ce8e 100644 (file)
@@ -430,16 +430,6 @@ class DatabaseSqlite extends Database {
                return str_replace( '"', '', parent::tableName( $name, $format ) );
        }
 
-       /**
-        * Index names have DB scope
-        *
-        * @param string $index
-        * @return string
-        */
-       protected function indexName( $index ) {
-               return $index;
-       }
-
        /**
         * This must be called after nextSequenceVal
         *
index 1f88d61..ae0887d 100644 (file)
@@ -78,9 +78,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
 
                        $out->addHTML(
                                ResourceLoader::makeInlineScript(
-                                       Xml::encodeJsCall( 'mw.messages.set', [
-                                               $messages
-                                       ] )
+                                       ResourceLoader::makeMessageSetScript( $messages )
                                )
                        );