X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FimportImages.php;h=ae70441f1b509ec57a004ed1edd05a0edac5f48d;hb=887fb377d9df8768d98ed4d7e215f9ce0e538499;hp=ba77354934d92ca713f00e87af3bf8b67648bb52;hpb=178f05dd876aed49d7bfb28bee7fa611d666d367;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importImages.php b/maintenance/importImages.php index ba77354934..ae70441f1b 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -177,7 +177,7 @@ if ( $count > 0 ) { if ( isset( $options['skip-dupes'] ) ) { $repo = $image->getRepo(); # XXX: we end up calculating this again when actually uploading. that sucks. - $sha1 = File::sha1Base36( $file ); + $sha1 = FSFile::getSha1Base36FromPath( $file ); $dupes = $repo->findBySha1( $sha1 ); @@ -290,25 +290,24 @@ if ( $count > 0 ) { } if ( $doProtect ) { - # Protect the file - echo "\nWaiting for slaves...\n"; - // Wait for slaves. - sleep( 2.0 ); # Why this sleep? - wfWaitForSlaves(); - - echo "\nSetting image restrictions ... "; - - $cascade = false; - $restrictions = array(); - foreach ( $title->getRestrictionTypes() as $type ) { - $restrictions[$type] = $protectLevel; - } + # Protect the file + echo "\nWaiting for slaves...\n"; + // Wait for slaves. + sleep( 2.0 ); # Why this sleep? + wfWaitForSlaves(); + + echo "\nSetting image restrictions ... "; + + $cascade = false; + $restrictions = array(); + foreach ( $title->getRestrictionTypes() as $type ) { + $restrictions[$type] = $protectLevel; + } - $page = WikiPage::factory( $title ); - $status = $page->doUpdateRestrictions( $restrictions, array(), $cascade, '', $user ); - echo ( $status->isOK() ? 'done' : 'failed' ) . "\n"; + $page = WikiPage::factory( $title ); + $status = $page->doUpdateRestrictions( $restrictions, array(), $cascade, '', $user ); + echo ( $status->isOK() ? 'done' : 'failed' ) . "\n"; } - } else { echo "failed. (at recordUpload stage)\n"; $svar = 'failed'; @@ -328,14 +327,21 @@ if ( $count > 0 ) { # Print out some statistics echo "\n"; - foreach ( array( 'count' => 'Found', 'limit' => 'Limit', 'ignored' => 'Ignored', - 'added' => 'Added', 'skipped' => 'Skipped', 'overwritten' => 'Overwritten', - 'failed' => 'Failed' ) as $var => $desc ) { + foreach ( + array( + 'count' => 'Found', + 'limit' => 'Limit', + 'ignored' => 'Ignored', + 'added' => 'Added', + 'skipped' => 'Skipped', + 'overwritten' => 'Overwritten', + 'failed' => 'Failed' + ) as $var => $desc + ) { if ( $$var > 0 ) { echo "{$desc}: {$$var}\n"; } } - } else { echo "No suitable files could be found for import.\n"; }