From: Reedy Date: Fri, 24 Mar 2017 11:52:00 +0000 (+0000) Subject: Revert "Remove old remapping hacks from Database::indexName()" X-Git-Tag: 1.31.0-rc.0~3662^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=307851618430b8f2573a18fc88d925b671fd36cb Revert "Remove old remapping hacks from Database::indexName()" This reverts commit bec6151e5fe30e780d82527c4c53e54379149a4e. Bug: T154872 Change-Id: I1c67aa464a1f151562ef92fce03f825113847814 --- diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 4f663b373c..7e80221128 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1981,7 +1981,18 @@ abstract class Database implements IDatabase, LoggerAwareInterface { * @return string */ protected function indexName( $index ) { - return $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; + } } public function addQuotes( $s ) { diff --git a/includes/libs/rdbms/database/DatabaseSqlite.php b/includes/libs/rdbms/database/DatabaseSqlite.php index f201dad006..2281f23ec8 100644 --- a/includes/libs/rdbms/database/DatabaseSqlite.php +++ b/includes/libs/rdbms/database/DatabaseSqlite.php @@ -426,6 +426,16 @@ class DatabaseSqlite extends DatabaseBase { 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 *