X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=maintenance%2FcleanupImages.php;h=ab2d808606260da8a5e8539db8e8a4e364ba09cb;hb=59f5c5fdd78cfc46d7db73075f23abccaad3ac1f;hp=915a2c0801a6483f6abe19afdb2cabcda4c88646;hpb=05b8af8b91dac965c67571668187d1dc2511ae03;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index 915a2c0801..ab2d808606 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -2,10 +2,6 @@ /** * Clean up broken, unparseable upload filenames. * - * Usage: php cleanupImages.php [--fix] - * Options: - * --fix Actually clean up titles; otherwise just checks for them - * * Copyright © 2005-2006 Brion Vibber * https://www.mediawiki.org/ * @@ -106,7 +102,7 @@ class ImageCleanup extends TableCleanup { $this->output( "DRY RUN: would delete bogus row '$name'\n" ); } else { $this->output( "deleting bogus row '$name'\n" ); - $db = wfGetDB( DB_MASTER ); + $db = $this->getDB( DB_MASTER ); $db->delete( 'image', array( 'img_name' => $name ), __METHOD__ ); @@ -143,7 +139,7 @@ class ImageCleanup extends TableCleanup { return; } - $db = wfGetDB( DB_MASTER ); + $db = $this->getDB( DB_MASTER ); /* * To prevent key collisions in the update() statements below, @@ -171,7 +167,7 @@ class ImageCleanup extends TableCleanup { } else { $this->output( "renaming $path to $finalPath\n" ); // @todo FIXME: Should this use File::move()? - $db->begin( __METHOD__ ); + $this->beginTransaction( $db, __METHOD__ ); $db->update( 'image', array( 'img_name' => $final ), array( 'img_name' => $orig ), @@ -188,16 +184,16 @@ class ImageCleanup extends TableCleanup { if ( !file_exists( $dir ) ) { if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) { $this->output( "RENAME FAILED, COULD NOT CREATE $dir" ); - $db->rollback( __METHOD__ ); + $this->rollbackTransaction( $db, __METHOD__ ); return; } } if ( rename( $path, $finalPath ) ) { - $db->commit( __METHOD__ ); + $this->commitTransaction( $db, __METHOD__ ); } else { $this->error( "RENAME FAILED" ); - $db->rollback( __METHOD__ ); + $this->rollbackTransaction( $db, __METHOD__ ); } } }