jenkins-bot has submitted this change and it was merged.
Change subject: Use english messages for background use of Status::getWikiText
......................................................................
Use english messages for background use of Status::getWikiText
Status::getWikiText is used for internal logging, api error messages and
maintenance scripts. All this places are usually in english, so pass an
english language to getWikiText.
Change-Id: I3010fca8eb5740a3a851c55a8b12e171714c78f7
---
M includes/HttpFunctions.php
M includes/api/ApiLogin.php
M includes/api/ApiQuerySearch.php
M includes/api/ApiUpload.php
M includes/filerepo/ForeignAPIRepo.php
M includes/filerepo/file/LocalFile.php
M includes/jobqueue/jobs/AssembleUploadChunksJob.php
M includes/jobqueue/jobs/PublishStashedFileJob.php
M includes/session/SessionManager.php
M includes/tidy/Html5Depurate.php
M maintenance/cleanupCaps.php
M maintenance/edit.php
M maintenance/importImages.php
M maintenance/moveBatch.php
M tests/phpunit/maintenance/DumpTestCase.php
M thumb.php
16 files changed, 30 insertions(+), 21 deletions(-)
Approvals:
Anomie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 3f42038..b12f49f 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -80,7 +80,7 @@
} else {
$errors = $status->getErrorsByType( 'error' );
$logger = LoggerFactory::getInstance( 'http' );
- $logger->warning( $status->getWikiText( null, null,
'en' ),
+ $logger->warning( $status->getWikiText( false, false,
'en' ),
[ 'error' => $errors, 'caller' => $caller,
'content' => $req->getContent() ] );
return false;
}
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 02aae06..3891415 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -103,7 +103,7 @@
$loginType = 'BotPassword';
} else {
LoggerFactory::getInstance( 'authmanager'
)->info(
- 'BotPassword login failed: ' .
$status->getWikiText()
+ 'BotPassword login failed: ' .
$status->getWikiText( false, false, 'en' )
);
}
}
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index 2eb5d14..3955cc5 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -116,7 +116,7 @@
if ( is_null( $matches ) ) {
$this->dieUsage( "{$what} search is disabled",
"search-{$what}-disabled" );
} elseif ( $matches instanceof Status && !$matches->isGood() ) {
- $this->dieUsage( $matches->getWikiText(),
'search-error' );
+ $this->dieUsage( $matches->getWikiText( false, false,
'en' ), 'search-error' );
}
if ( $resultPageSet === null ) {
diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php
index 326f8ba..cdec561 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -257,7 +257,7 @@
'offset' => $this->mUpload->getOffset(),
];
- $this->dieUsage( $status->getWikiText(),
'stashfailed', 0, $extradata );
+ $this->dieUsage( $status->getWikiText( false,
false, 'en' ), 'stashfailed', 0, $extradata );
}
}
@@ -288,7 +288,7 @@
$filekey,
[ 'result' => 'Failure',
'stage' => 'assembling', 'status' => $status ]
);
- $this->dieUsage(
$status->getWikiText(), 'stashfailed' );
+ $this->dieUsage( $status->getWikiText(
false, false, 'en' ), 'stashfailed' );
}
// The fully concatenated file has a new
filekey. So remove
@@ -391,7 +391,7 @@
if ( !$progress ) {
$this->dieUsage( 'No result in status data',
'missingresult' );
} elseif ( !$progress['status']->isGood() ) {
- $this->dieUsage(
$progress['status']->getWikiText(), 'stashfailed' );
+ $this->dieUsage(
$progress['status']->getWikiText( false, false, 'en' ), 'stashfailed' );
}
if ( isset( $progress['status']->value['verification']
) ) {
$this->checkVerification(
$progress['status']->value['verification'] );
diff --git a/includes/filerepo/ForeignAPIRepo.php
b/includes/filerepo/ForeignAPIRepo.php
index cc9099c..b48191f 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -527,7 +527,10 @@
return $req->getContent();
} else {
$logger = LoggerFactory::getInstance( 'http' );
- $logger->warning( $status->getWikiText(), [ 'caller' =>
'ForeignAPIRepo::httpGet' ] );
+ $logger->warning(
+ $status->getWikiText( false, false, 'en' ),
+ [ 'caller' => 'ForeignAPIRepo::httpGet' ]
+ );
return false;
}
}
diff --git a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index 9677f5d..7156134 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -2881,7 +2881,8 @@
$this->cleanupTarget( $triplets );
$destFile->unlock();
$this->file->unlockAndRollback(); // unlocks
the destination
- wfDebugLog( 'imagemove', "Error in moving
files: " . $statusMove->getWikiText() );
+ wfDebugLog( 'imagemove', "Error in moving
files: "
+ . $statusMove->getWikiText( false,
false, 'en' ) );
$statusMove->ok = false;
return $statusMove;
diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
index bc2f7c4..16e35f1 100644
--- a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
+++ b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
@@ -69,7 +69,7 @@
$this->params['filekey'],
[ 'result' => 'Failure', 'stage' =>
'assembling', 'status' => $status ]
);
- $this->setLastError( $status->getWikiText() );
+ $this->setLastError( $status->getWikiText(
false, false, 'en' ) );
return false;
}
diff --git a/includes/jobqueue/jobs/PublishStashedFileJob.php
b/includes/jobqueue/jobs/PublishStashedFileJob.php
index a6d2f70..d2825a8 100644
--- a/includes/jobqueue/jobs/PublishStashedFileJob.php
+++ b/includes/jobqueue/jobs/PublishStashedFileJob.php
@@ -92,7 +92,7 @@
$this->params['filekey'],
[ 'result' => 'Failure', 'stage' =>
'publish', 'status' => $status ]
);
- $this->setLastError( $status->getWikiText() );
+ $this->setLastError( $status->getWikiText(
false, false, 'en' ) );
return false;
}
diff --git a/includes/session/SessionManager.php
b/includes/session/SessionManager.php
index fc73335..dd36522 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -498,10 +498,12 @@
'username' => $userName,
] );
} else {
- $logger->error( __METHOD__ . ': failed
with message ' . $status->getWikiText(),
+ $logger->error(
+ __METHOD__ . ': failed with
message ' . $status->getWikiText( false, false, 'en' ),
[
'username' => $userName,
- ] );
+ ]
+ );
}
$user->setId( $id );
$user->loadFromId( User::READ_LATEST );
diff --git a/includes/tidy/Html5Depurate.php b/includes/tidy/Html5Depurate.php
index a34933c..c6acd66 100644
--- a/includes/tidy/Html5Depurate.php
+++ b/includes/tidy/Html5Depurate.php
@@ -29,9 +29,10 @@
] );
$status = $req->execute();
if ( !$status->isOK() ) {
- throw new Exception( "Error contacting depurate
service: " . $status->getWikiText() );
+ throw new Exception( "Error contacting depurate
service: "
+ . $status->getWikiText( false, false, 'en' ) );
} elseif ( $req->getStatus() !== 200 ) {
- throw new Exception( "Depurate returned error: " .
$status->getWikiText() );
+ throw new Exception( "Depurate returned error: " .
$status->getWikiText( false, false, 'en' ) );
}
$result = $req->getContent();
$startBody = strpos( $result, "<body>" );
diff --git a/maintenance/cleanupCaps.php b/maintenance/cleanupCaps.php
index 641250d..6931259 100644
--- a/maintenance/cleanupCaps.php
+++ b/maintenance/cleanupCaps.php
@@ -92,7 +92,7 @@
} else {
$mp = new MovePage( $current, $target );
$status = $mp->move( $this->user, 'Converting page
titles to lowercase', true );
- $ok = $status->isOK() ? 'OK' : $status->getWikiText();
+ $ok = $status->isOK() ? 'OK' : $status->getWikiText(
false, false, 'en' );
$this->output( "\"$display\" -> \"$targetDisplay\":
$ok\n" );
}
if ( $ok === true ) {
diff --git a/maintenance/edit.php b/maintenance/edit.php
index 4ef7379..4219ed0 100644
--- a/maintenance/edit.php
+++ b/maintenance/edit.php
@@ -97,7 +97,7 @@
$exit = 1;
}
if ( !$status->isGood() ) {
- $this->output( $status->getWikiText() . "\n" );
+ $this->output( $status->getWikiText( false, false, 'en'
) . "\n" );
}
exit( $exit );
}
diff --git a/maintenance/importImages.php b/maintenance/importImages.php
index 512c38c..c653a5f 100644
--- a/maintenance/importImages.php
+++ b/maintenance/importImages.php
@@ -257,7 +257,7 @@
$archive = $image->publish( $file, $flags,
$publishOptions );
if ( !$archive->isGood() ) {
echo "failed. (" .
- $archive->getWikiText() .
+ $archive->getWikiText( false, false,
'en' ) .
")\n";
$failed++;
continue;
diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php
index 3a1a72c..3c29689 100644
--- a/maintenance/moveBatch.php
+++ b/maintenance/moveBatch.php
@@ -110,7 +110,7 @@
$mp = new MovePage( $source, $dest );
$status = $mp->move( $wgUser, $reason, !$noredirects );
if ( !$status->isOK() ) {
- $this->output( "\nFAILED: " .
$status->getWikiText() );
+ $this->output( "\nFAILED: " .
$status->getWikiText( false, false, 'en' ) );
}
$this->commitTransaction( $dbw, __METHOD__ );
$this->output( "\n" );
diff --git a/tests/phpunit/maintenance/DumpTestCase.php
b/tests/phpunit/maintenance/DumpTestCase.php
index 7336618..ac83d4e 100644
--- a/tests/phpunit/maintenance/DumpTestCase.php
+++ b/tests/phpunit/maintenance/DumpTestCase.php
@@ -53,7 +53,8 @@
}
}
- throw new MWException( "Could not determine revision id (" .
$status->getWikiText() . ")" );
+ throw new MWException( "Could not determine revision id ("
+ . $status->getWikiText( false, false, 'en' ) . ")" );
}
/**
diff --git a/thumb.php b/thumb.php
index 10c2419..fca25c5 100644
--- a/thumb.php
+++ b/thumb.php
@@ -320,7 +320,7 @@
RequestContext::getMain()->getStats()->timing(
'media.thumbnail.stream', $streamtime );
} else {
wfThumbError( 500, 'Could not stream the file', null, [
'file' => $thumbName,
- 'path' => $thumbPath, 'error' =>
$status->getWikiText() ] );
+ 'path' => $thumbPath, 'error' =>
$status->getWikiText( false, false, 'en' ) ] );
}
return;
}
@@ -366,7 +366,8 @@
$status = $thumb->streamFileWithStatus( $headers );
if ( !$status->isOK() ) {
wfThumbError( 500, 'Could not stream the file', null, [
- 'file' => $thumbName, 'path' => $thumbPath,
'error' => $status->getWikiText() ] );
+ 'file' => $thumbName, 'path' => $thumbPath,
+ 'error' => $status->getWikiText( false, false,
'en' ) ] );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/282521
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3010fca8eb5740a3a851c55a8b12e171714c78f7
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits