Merge "SkinTemplate: extract formatLanguageName() from outputPage()"
[lhc/web/wiklou.git] / maintenance / cleanupImages.php
index 581ff2d..4e7b937 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 /**
- * Script to clean up broken, unparseable upload filenames.
+ * Clean up broken, unparseable upload filenames.
  *
  * Usage: php cleanupImages.php [--fix]
  * Options:
  *   --fix  Actually clean up titles; otherwise just checks for them
  *
- * Copyright (C) 2005-2006 Brion Vibber <brion@pobox.com>
+ * Copyright © 2005-2006 Brion Vibber <brion@pobox.com>
  * http://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
+require_once( __DIR__ . '/cleanupTable.inc' );
 
+/**
+ * Maintenance script to clean up broken, unparseable upload filenames.
+ *
+ * @ingroup Maintenance
+ */
 class ImageCleanup extends TableCleanup {
        protected $defaultParams = array(
                'table' => 'image',
@@ -173,7 +178,7 @@ class ImageCleanup extends TableCleanup {
                        if ( !file_exists( $dir ) ) {
                                if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
                                        $this->output( "RENAME FAILED, COULD NOT CREATE $dir" );
-                                       $db->rollback();
+                                       $db->rollback( __METHOD__ );
                                        return;
                                }
                        }
@@ -192,9 +197,8 @@ class ImageCleanup extends TableCleanup {
        }
 
        private function buildSafeTitle( $name ) {
-               global $wgLegalTitleChars;
                $x = preg_replace_callback(
-                       "/([^$wgLegalTitleChars]|~)/",
+                       '/([^' . Title::legalChars() . ']|~)/',
                        array( $this, 'hexChar' ),
                        $name );