From 0fcafc7b1c8edda617dd6305f3d5f8a024405e12 Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Tue, 16 Dec 2008 02:33:38 +0000 Subject: [PATCH] Followup to r44641: Only skip file pages that actually have a corresponding file. --- maintenance/cleanupTitles.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index 7a5dadadeb..3f29d31cf9 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -41,11 +41,6 @@ class TitleCleanup extends TableCleanup { } function processPage( $row ) { - if( $row->page_namespace == NS_FILE ) { - // use cleanupImages.php for file pages - return $this->progress( 0 ); - } - $current = Title::makeTitle( $row->page_namespace, $row->page_title ); $display = $current->getPrefixedText(); @@ -53,19 +48,30 @@ class TitleCleanup extends TableCleanup { $title = Title::newFromText( $verified ); - if( is_null( $title ) ) { + if( !is_null( $title ) && $title->equals( $current ) ) { + return $this->progress( 0 ); // all is fine + } + + if( $row->page_namespace == NS_FILE && $this->fileExists( $row->page_title ) ) { + $this->log( "file $row->page_title needs cleanup, please run cleanupImages.php." ); + return $this->progress( 0 ); + } elseif( is_null( $title ) ) { $this->log( "page $row->page_id ($display) is illegal." ); $this->moveIllegalPage( $row ); return $this->progress( 1 ); - } - - if( !$title->equals( $current ) ) { + } else { $this->log( "page $row->page_id ($display) doesn't match self." ); $this->moveInconsistentPage( $row, $title ); return $this->progress( 1 ); } + } - $this->progress( 0 ); + function fileExists( $name ) { + // XXX: Doesn't actually check for file existence, just presence of image record. + // This is reasonable, since cleanupImages.php only iterates over the image table. + $dbr = wfGetDB( DB_SLAVE ); + $row = $dbr->selectRow( 'image', array( 'img_name' ), array( 'img_name' => $name ), __METHOD__ ); + return $row !== false; } function moveIllegalPage( $row ) { -- 2.20.1