From: Chad Horohoe Date: Wed, 26 Aug 2009 14:06:36 +0000 (+0000) Subject: Make resolveConflictOn() accept a prefix different from the page name (needed for... X-Git-Tag: 1.31.0-rc.0~40055 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=a4ff5fcee153b83977b2d4a17bd0ecba703a4def;p=lhc%2Fweb%2Fwiklou.git Make resolveConflictOn() accept a prefix different from the page name (needed for archive, bug 10171). Add comment about crappy interwiki prefix checking. --- diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index d373b263dc..6b8cdeba1c 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -132,6 +132,7 @@ class NamespaceConflictChecker extends Maintenance { /** * Get the interwiki list + * @todo Needs to respect interwiki cache! * @return array */ private function getInterwikiList() { @@ -280,9 +281,9 @@ class NamespaceConflictChecker extends Maintenance { } $this->output( "... *** using suffixed form [[" . $title->getPrefixedText() . "]] ***\n" ); } - $tables = array( 'page' ); + $tables = array( 'page' => 'page' ); foreach( $tables as $table ) { - $this->resolveConflictOn( $row, $table ); + $this->resolveConflictOn( $row, $table, $prefix ); } return true; } @@ -291,18 +292,19 @@ class NamespaceConflictChecker extends Maintenance { * Resolve a given conflict * @param $row Row from the old broken entry * @param $table String Table to update + * @param $prefix String Prefix for column name, like page or ar */ - private function resolveConflictOn( $row, $table ) { + private function resolveConflictOn( $row, $table, $prefix ) { $this->output( "... resolving on $table... " ); $newTitle = Title::makeTitleSafe( $row->namespace, $row->title ); $this->db->update( $table, array( - "{$table}_namespace" => $newTitle->getNamespace(), - "{$table}_title" => $newTitle->getDBkey(), + "{$prefix}_namespace" => $newTitle->getNamespace(), + "{$prefix}_title" => $newTitle->getDBkey(), ), array( - "{$table}_namespace" => 0, - "{$table}_title" => $row->oldtitle, + "{$prefix}_namespace" => 0, + "{$prefix}_title" => $row->oldtitle, ), __METHOD__ ); $this->output( "ok.\n" );