summaryrefslogtreecommitdiff
path: root/maintenance/cleanupTitles.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /maintenance/cleanupTitles.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'maintenance/cleanupTitles.php')
-rw-r--r--maintenance/cleanupTitles.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php
index a6991829..4d76ac7a 100644
--- a/maintenance/cleanupTitles.php
+++ b/maintenance/cleanupTitles.php
@@ -48,19 +48,30 @@ class TitleCleanup extends TableCleanup {
$title = Title::newFromText( $verified );
- if( is_null( $title ) ) {
+ if( !is_null( $title ) && $title->equals( $current ) && $title->canExist() ) {
+ 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 ) {