Merge "Remove implode erroneously left"

This commit is contained in:
jenkins-bot 2017-05-21 10:07:17 +00:00 committed by Gerrit Code Review
commit 699ce5b901

View file

@ -85,8 +85,6 @@ class GenerateFancyCaptchas extends Maintenance {
$this->error( "Could not create temp directory.\n", 1 );
}
$e = null; // exception
try {
$captchaScript = 'captcha.py';
if ( $this->hasOption( 'oldcaptcha' ) ) {
@ -173,6 +171,7 @@ class GenerateFancyCaptchas extends Maintenance {
$storeTime += microtime( true );
$storeSuceeded = true;
if ( $ret->isOK() ) {
$this->output( " Done.\n" );
$this->output(
@ -182,22 +181,35 @@ class GenerateFancyCaptchas extends Maintenance {
$storeTime
)
);
if ( !$ret->isGood() ) {
$this->output(
"Non fatal errors:\n" .
Status::wrap( $ret )->getWikiText( null, null, 'en' ) .
"\n"
);
}
if ( $ret->failCount ) {
$this->output( sprintf( "\nFailed to copy %d captchas\n", $ret->failCount ) );
$storeSuceeded = false;
$this->error( sprintf( "\nFailed to copy %d captchas\n", $ret->failCount ) );
}
if ( $ret->successCount + $ret->failCount !== $captchasGenerated ) {
$this->output(
$storeSuceeded = false;
$this->error(
sprintf( "Internal error: captchasGenerated: %d, successCount: %d, failCount: %d\n",
$captchasGenerated, $ret->successCount, $ret->failCount
)
);
}
} else {
$storeSuceeded = false;
$this->output( "Errored.\n" );
$this->output( implode( "\n", Status::wrap( $ret )->getWikiText( null, null, 'en' ) ) );
$this->error(
Status::wrap( $ret )->getWikiText( null, null, 'en' ) .
"\n"
);
}
if ( $deleteOldCaptchas ) {
if ( $storeSuceeded && $deleteOldCaptchas ) {
$numOriginalFiles = count( $filesToDelete );
$this->output( "Deleting {$numOriginalFiles} old captchas...\n" );
$deleteTime = -microtime( true );
@ -205,7 +217,6 @@ class GenerateFancyCaptchas extends Maintenance {
$deleteTime += microtime( true );
if ( $ret->isOK() ) {
$this->output( "Done.\n" );
$this->output(
sprintf(
@ -214,17 +225,22 @@ class GenerateFancyCaptchas extends Maintenance {
$deleteTime
)
);
if ( !$ret->isGood() ) {
$this->output(
"Non fatal errors:\n" .
Status::wrap( $ret )->getWikiText( null, null, 'en' ) .
"\n"
);
}
} else {
$this->output( "Errored.\n" );
$this->output( implode( "\n", Status::wrap( $ret )->getWikiText( null, null, 'en' ) ) );
$this->error(
Status::wrap( $ret )->getWikiText( null, null, 'en' ) .
"\n"
);
}
}
} catch ( Exception $e ) {
wfRecursiveRemoveDir( $tmpDir );
throw $e;
}
$this->output( "Removing temporary files..." );
wfRecursiveRemoveDir( $tmpDir );
$this->output( " Done.\n" );