X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FcleanupImages.php;h=e0da027f7618e3dbe9da8be0b316c291cdc8dbea;hp=ab2d808606260da8a5e8539db8e8a4e364ba09cb;hb=22806b0a4509e97b56fb52b387e17e3c80fb7eb2;hpb=23299ca8790bcf1aebcf54e0932b94338e630474 diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index ab2d808606..e0da027f76 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -33,16 +33,16 @@ require_once __DIR__ . '/cleanupTable.inc'; * @ingroup Maintenance */ class ImageCleanup extends TableCleanup { - protected $defaultParams = array( + protected $defaultParams = [ 'table' => 'image', - 'conds' => array(), + 'conds' => [], 'index' => 'img_name', 'callback' => 'processRow', - ); + ]; public function __construct() { parent::__construct(); - $this->mDescription = "Script to clean up broken, unparseable upload filenames"; + $this->addDescription( 'Script to clean up broken, unparseable upload filenames' ); } protected function processRow( $row ) { @@ -104,7 +104,7 @@ class ImageCleanup extends TableCleanup { $this->output( "deleting bogus row '$name'\n" ); $db = $this->getDB( DB_MASTER ); $db->delete( 'image', - array( 'img_name' => $name ), + [ 'img_name' => $name ], __METHOD__ ); } } @@ -118,14 +118,14 @@ class ImageCleanup extends TableCleanup { } private function imageExists( $name, $db ) { - return $db->selectField( 'image', '1', array( 'img_name' => $name ), __METHOD__ ); + return $db->selectField( 'image', '1', [ 'img_name' => $name ], __METHOD__ ); } private function pageExists( $name, $db ) { return $db->selectField( 'page', '1', - array( 'page_namespace' => NS_FILE, 'page_title' => $name ), + [ 'page_namespace' => NS_FILE, 'page_title' => $name ], __METHOD__ ); } @@ -146,7 +146,7 @@ class ImageCleanup extends TableCleanup { * if the target title exists in the image table, or if both the * original and target titles exist in the page table, append * increasing version numbers until the target title exists in - * neither. (See also bug 16916.) + * neither. (See also T18916.) */ $version = 0; $final = $new; @@ -169,16 +169,16 @@ class ImageCleanup extends TableCleanup { // @todo FIXME: Should this use File::move()? $this->beginTransaction( $db, __METHOD__ ); $db->update( 'image', - array( 'img_name' => $final ), - array( 'img_name' => $orig ), + [ 'img_name' => $final ], + [ 'img_name' => $orig ], __METHOD__ ); $db->update( 'oldimage', - array( 'oi_name' => $final ), - array( 'oi_name' => $orig ), + [ 'oi_name' => $final ], + [ 'oi_name' => $orig ], __METHOD__ ); $db->update( 'page', - array( 'page_title' => $final ), - array( 'page_title' => $orig, 'page_namespace' => NS_FILE ), + [ 'page_title' => $final ], + [ 'page_title' => $orig, 'page_namespace' => NS_FILE ], __METHOD__ ); $dir = dirname( $finalPath ); if ( !file_exists( $dir ) ) { @@ -206,7 +206,7 @@ class ImageCleanup extends TableCleanup { private function buildSafeTitle( $name ) { $x = preg_replace_callback( '/([^' . Title::legalChars() . ']|~)/', - array( $this, 'hexChar' ), + [ $this, 'hexChar' ], $name ); $test = Title::makeTitleSafe( NS_FILE, $x );