From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- maintenance/rebuildImages.php | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'maintenance/rebuildImages.php') diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index 17111831..fe3b35c9 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -27,7 +27,7 @@ * * @file * @author Brion Vibber - * @ingroup maintenance + * @ingroup Maintenance */ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); @@ -148,8 +148,7 @@ class ImageBuilder extends Maintenance { } function buildOldImage() { - $this->buildTable( 'oldimage', 'oi_archive_name', - array( $this, 'oldimageCallback' ) ); + $this->buildTable( 'oldimage', 'oi_archive_name', array( $this, 'oldimageCallback' ) ); } function oldimageCallback( $row, $copy ) { @@ -164,42 +163,33 @@ class ImageBuilder extends Maintenance { } function crawlMissing() { - $repo = RepoGroup::singleton()->getLocalRepo(); - $repo->enumFilesInFS( array( $this, 'checkMissingImage' ) ); + $this->getRepo()->enumFiles( array( $this, 'checkMissingImage' ) ); } function checkMissingImage( $fullpath ) { $filename = wfBaseName( $fullpath ); - if ( is_dir( $fullpath ) ) { - return; - } - if ( is_link( $fullpath ) ) { - $this->output( "skipping symlink at $fullpath\n" ); - return; - } $row = $this->dbw->selectRow( 'image', array( 'img_name' ), array( 'img_name' => $filename ), __METHOD__ ); - if ( $row ) { - // already known, move on - return; - } else { + if ( !$row ) { // file not registered $this->addMissingImage( $filename, $fullpath ); } } function addMissingImage( $filename, $fullpath ) { - $timestamp = $this->dbw->timestamp( filemtime( $fullpath ) ); - global $wgContLang; + + $timestamp = $this->dbw->timestamp( $this->getRepo()->getFileTimestamp( $fullpath ) ); + $altname = $wgContLang->checkTitleEncoding( $filename ); if ( $altname != $filename ) { if ( $this->dryrun ) { $filename = $altname; $this->output( "Estimating transcoding... $altname\n" ); } else { + # @FIXME: create renameFile() $filename = $this->renameFile( $filename ); } } -- cgit v1.2.2