summaryrefslogtreecommitdiff
path: root/maintenance/cleanupImages.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/cleanupImages.php')
-rw-r--r--maintenance/cleanupImages.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php
index c8e90958..81d1c85b 100644
--- a/maintenance/cleanupImages.php
+++ b/maintenance/cleanupImages.php
@@ -73,8 +73,9 @@ class ImageCleanup extends TableCleanup {
if ( is_null( $title ) ) {
$this->output( "page $source ($cleaned) is illegal.\n" );
$safe = $this->buildSafeTitle( $cleaned );
- if ( $safe === false )
+ if ( $safe === false ) {
return $this->progress( 0 );
+ }
$this->pokeFile( $source, $safe );
return $this->progress( 1 );
}
@@ -86,9 +87,12 @@ class ImageCleanup extends TableCleanup {
return $this->progress( 1 );
}
- $this->progress( 0 );
+ return $this->progress( 0 );
}
+ /**
+ * @param $name string
+ */
private function killRow( $name ) {
if ( $this->dryrun ) {
$this->output( "DRY RUN: would delete bogus row '$name'\n" );
@@ -120,7 +124,8 @@ class ImageCleanup extends TableCleanup {
$path = $this->filePath( $orig );
if ( !file_exists( $path ) ) {
$this->output( "missing file: $path\n" );
- return $this->killRow( $orig );
+ $this->killRow( $orig );
+ return;
}
$db = wfGetDB( DB_MASTER );
@@ -135,7 +140,7 @@ class ImageCleanup extends TableCleanup {
$version = 0;
$final = $new;
$conflict = ( $this->imageExists( $final, $db ) ||
- ( $this->pageExists( $orig, $db ) && $this->pageExists( $final, $db ) ) );
+ ( $this->pageExists( $orig, $db ) && $this->pageExists( $final, $db ) ) );
while ( $conflict ) {
$this->output( "Rename conflicts with '$final'...\n" );
@@ -166,8 +171,8 @@ class ImageCleanup extends TableCleanup {
__METHOD__ );
$dir = dirname( $finalPath );
if ( !file_exists( $dir ) ) {
- if ( !wfMkdirParents( $dir ) ) {
- $this->log( "RENAME FAILED, COULD NOT CREATE $dir" );
+ if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
+ $this->output( "RENAME FAILED, COULD NOT CREATE $dir" );
$db->rollback();
return;
}