r55591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55590‎ | r55591 | r55592 >
Date:14:06, 26 August 2009
Author:demon
Status:ok
Tags:
Comment:
Make resolveConflictOn() accept a prefix different from the page name (needed for archive, bug 10171). Add comment about crappy interwiki prefix checking.
Modified paths:
  • /trunk/phase3/maintenance/namespaceDupes.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/namespaceDupes.php
@@ -132,6 +132,7 @@
133133
134134 /**
135135 * Get the interwiki list
 136+ * @todo Needs to respect interwiki cache!
136137 * @return array
137138 */
138139 private function getInterwikiList() {
@@ -280,9 +281,9 @@
281282 }
282283 $this->output( "... *** using suffixed form [[" . $title->getPrefixedText() . "]] ***\n" );
283284 }
284 - $tables = array( 'page' );
 285+ $tables = array( 'page' => 'page' );
285286 foreach( $tables as $table ) {
286 - $this->resolveConflictOn( $row, $table );
 287+ $this->resolveConflictOn( $row, $table, $prefix );
287288 }
288289 return true;
289290 }
@@ -291,18 +292,19 @@
292293 * Resolve a given conflict
293294 * @param $row Row from the old broken entry
294295 * @param $table String Table to update
 296+ * @param $prefix String Prefix for column name, like page or ar
295297 */
296 - private function resolveConflictOn( $row, $table ) {
 298+ private function resolveConflictOn( $row, $table, $prefix ) {
297299 $this->output( "... resolving on $table... " );
298300 $newTitle = Title::makeTitleSafe( $row->namespace, $row->title );
299301 $this->db->update( $table,
300302 array(
301 - "{$table}_namespace" => $newTitle->getNamespace(),
302 - "{$table}_title" => $newTitle->getDBkey(),
 303+ "{$prefix}_namespace" => $newTitle->getNamespace(),
 304+ "{$prefix}_title" => $newTitle->getDBkey(),
303305 ),
304306 array(
305 - "{$table}_namespace" => 0,
306 - "{$table}_title" => $row->oldtitle,
 307+ "{$prefix}_namespace" => 0,
 308+ "{$prefix}_title" => $row->oldtitle,
307309 ),
308310 __METHOD__ );
309311 $this->output( "ok.\n" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r56867Fix total breakage of namespaceDupes.php due to r55591: undefined variable $p...tstarling05:38, 24 September 2009

Status & tagging log