diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /maintenance/cleanupImages.php | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'maintenance/cleanupImages.php')
-rw-r--r-- | maintenance/cleanupImages.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index 81d1c85b..4e7b937d 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -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 @@ -29,8 +29,13 @@ * @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', @@ -156,7 +161,7 @@ class ImageCleanup extends TableCleanup { } else { $this->output( "renaming $path to $finalPath\n" ); // @todo FIXME: Should this use File::move()? - $db->begin(); + $db->begin( __METHOD__ ); $db->update( 'image', array( 'img_name' => $final ), array( 'img_name' => $orig ), @@ -173,15 +178,15 @@ 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; } } if ( rename( $path, $finalPath ) ) { - $db->commit(); + $db->commit( __METHOD__ ); } else { $this->error( "RENAME FAILED" ); - $db->rollback(); + $db->rollback( __METHOD__ ); } } } @@ -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 ); |