From: Reedy Date: Sat, 2 Feb 2013 18:15:47 +0000 (+0000) Subject: Use output/error maintenance functions X-Git-Tag: 1.31.0-rc.0~20423^2 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=81a6294f9ab4fb2d855818e3467065aa57c974ba;p=lhc%2Fweb%2Fwiklou.git Use output/error maintenance functions Change-Id: I9f9ebee9e577ab3cc7a042e5280161d2b2bad57a --- diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php index f067dc6a35..e21dd176ff 100644 --- a/maintenance/purgeParserCache.php +++ b/maintenance/purgeParserCache.php @@ -52,21 +52,19 @@ class PurgeParserCache extends Maintenance { global $wgParserCacheExpireTime; $date = wfTimestamp( TS_MW, time() + $wgParserCacheExpireTime - intval( $inputAge ) ); } else { - echo "Must specify either --expiredate or --age\n"; - exit( 1 ); + $this->error( "Must specify either --expiredate or --age", 1 ); } $english = Language::factory( 'en' ); - echo "Deleting objects expiring before " . $english->timeanddate( $date ) . "\n"; + $this->output( "Deleting objects expiring before " . $english->timeanddate( $date ) . "\n" ); $pc = wfGetParserCacheStorage(); $success = $pc->deleteObjectsExpiringBefore( $date, array( $this, 'showProgress' ) ); if ( !$success ) { - echo "\nCannot purge this kind of parser cache.\n"; - exit( 1 ); + $this->error( "\nCannot purge this kind of parser cache.", 1 ); } $this->showProgress( 100 ); - echo "\nDone\n"; + $this->output( "\nDone\n" ); } function showProgress( $percent ) { @@ -77,8 +75,8 @@ class PurgeParserCache extends Maintenance { $this->lastProgress = $percentString; $stars = floor( $percent / 2 ); - echo '[' . str_repeat( '*', $stars ), str_repeat( '.', 50 - $stars ) . '] ' . - "$percentString%\r"; + $this->output( '[' . str_repeat( '*', $stars ) . str_repeat( '.', 50 - $stars ) . '] ' . + "$percentString%\r" ); } }