X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupImages.php;h=305a41dddcb585c0a88a361e3d94c6ebd3c6076a;hb=2bb276f07d2f291413fd41e0c62872ef39caed6e;hp=fbdc7c209551b76c7097bb94ccca8e78c6d12d23;hpb=2b6f3f0adc475da7eab1ef04dfe917e5536e6e10;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index fbdc7c2095..305a41dddc 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -25,6 +25,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/cleanupTable.inc'; /** @@ -32,7 +34,7 @@ require_once __DIR__ . '/cleanupTable.inc'; * * @ingroup Maintenance */ -class ImageCleanup extends TableCleanup { +class CleanupImages extends TableCleanup { protected $defaultParams = [ 'table' => 'image', 'conds' => [], @@ -46,8 +48,6 @@ class ImageCleanup extends TableCleanup { } protected function processRow( $row ) { - global $wgContLang; - $source = $row->img_name; if ( $source == '' ) { // Ye olde empty rows. Just kill them. @@ -64,11 +64,13 @@ class ImageCleanup extends TableCleanup { // We also have some HTML entities there $cleaned = Sanitizer::decodeCharReferences( $cleaned ); + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); + // Some are old latin-1 - $cleaned = $wgContLang->checkTitleEncoding( $cleaned ); + $cleaned = $contLang->checkTitleEncoding( $cleaned ); // Many of remainder look like non-normalized unicode - $cleaned = $wgContLang->normalize( $cleaned ); + $cleaned = $contLang->normalize( $cleaned ); $title = Title::makeTitleSafe( NS_FILE, $cleaned ); @@ -220,5 +222,5 @@ class ImageCleanup extends TableCleanup { } } -$maintClass = ImageCleanup::class; +$maintClass = CleanupImages::class; require_once RUN_MAINTENANCE_IF_MAIN;