'upload' => [
'upload' => [ 'upload' ],
'overwrite' => [ 'overwrite' ],
+ 'revert' => [ 'revert' ],
],
];
0,
false,
false,
- $this->getUser()
+ $this->getUser(),
+ [],
+ true,
+ true
);
}
* (This doesn't check $user's permissions.)
* @param bool $createNullRevision Set to false to avoid creation of a null revision on file
* upload, see T193621
+ * @param bool $revert If this file upload is a revert
* @return Status On success, the value member contains the
* archive name, or an empty string if it was a new file.
*/
function upload( $src, $comment, $pageText, $flags = 0, $props = false,
$timestamp = false, $user = null, $tags = [],
- $createNullRevision = true
+ $createNullRevision = true, $revert = false
) {
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
return $this->readOnlyFatalStatus();
$timestamp,
$user,
$tags,
- $createNullRevision
+ $createNullRevision,
+ $revert
);
if ( !$uploadStatus->isOK() ) {
if ( $uploadStatus->hasMessage( 'filenotfound' ) ) {
* @param string[] $tags
* @param bool $createNullRevision Set to false to avoid creation of a null revision on file
* upload, see T193621
+ * @param bool $revert If this file upload is a revert
* @return Status
*/
function recordUpload2(
$oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null, $tags = [],
- $createNullRevision = true
+ $createNullRevision = true, $revert = false
) {
global $wgActorTableSchemaMigrationStage;
$wikiPage = new WikiFilePage( $descTitle );
$wikiPage->setFile( $this );
+ // Determine log action. If reupload is done by reverting, use a special log_action.
+ if ( $revert === true ) {
+ $logAction = 'revert';
+ } elseif ( $reupload === true ) {
+ $logAction = 'overwrite';
+ } else {
+ $logAction = 'upload';
+ }
// Add the log entry...
- $logEntry = new ManualLogEntry( 'upload', $reupload ? 'overwrite' : 'upload' );
+ $logEntry = new ManualLogEntry( 'upload', $logAction );
$logEntry->setTimestamp( $this->timestamp );
$logEntry->setPerformer( $user );
$logEntry->setComment( $comment );
->rawParams( $target )->inContentLanguage()->escaped();
break;
case 'overwrite':
+ case 'revert':
$text = wfMessage( 'overwroteimage' )
->rawParams( $target )->inContentLanguage()->escaped();
break;
"logentry-rights-autopromote": "$1 was automatically {{GENDER:$2|promoted}} from $4 to $5",
"logentry-upload-upload": "$1 {{GENDER:$2|uploaded}} $3",
"logentry-upload-overwrite": "$1 {{GENDER:$2|uploaded}} a new version of $3",
- "logentry-upload-revert": "$1 {{GENDER:$2|uploaded}} $3",
+ "logentry-upload-revert": "$1 {{GENDER:$2|reverted}} $3 to an old version",
"log-name-managetags": "Tag management log",
"log-description-managetags": "This page lists management tasks related to [[Special:Tags|tags]]. The log contains only actions carried out manually by an administrator; tags may be created or deleted by the wiki software without an entry being recorded in this log.",
"logentry-managetags-create": "$1 {{GENDER:$2|created}} the tag \"$4\"",
"log-action-filter-suppress-reblock": "User suppression by reblock",
"log-action-filter-upload-upload": "New upload",
"log-action-filter-upload-overwrite": "Reupload",
+ "log-action-filter-upload-revert": "Revert",
"authmanager-authn-not-in-progress": "Authentication is not in progress or session data has been lost. Please start again from the beginning.",
"authmanager-authn-no-primary": "The supplied credentials could not be authenticated.",
"authmanager-authn-no-local-user": "The supplied credentials are not associated with any user on this wiki.",
"log-action-filter-suppress-reblock": "{{doc-log-action-filter-action|suppress|reblock}}",
"log-action-filter-upload-upload": "{{doc-log-action-filter-action|upload|upload}}",
"log-action-filter-upload-overwrite": "{{doc-log-action-filter-action|upload|overwrite}}",
+ "log-action-filter-upload-revert": "{{doc-log-action-filter-action|upload|revert}}",
"authmanager-authn-not-in-progress": "Error message when AuthManager session data is lost during authentication, or the user hits the \"continue\" endpoint without an active authentication attempt.",
"authmanager-authn-no-primary": "Error message when no AuthenticationProvider handles the AuthenticationRequests for login. This might mean the user needs to fill out all the form fields.",
"authmanager-authn-no-local-user": "Error message when authentication somehow succeeds without a username being known. This probably should never happen.",
],
],
[
- 'text' => 'User uploaded File:File.png',
+ 'text' => 'User reverted File:File.png to an old version',
'api' => [
'img_sha1' => 'hash',
'img_timestamp' => '2015-01-01T00:00:00Z',
'params' => [],
],
[
- 'text' => 'User uploaded File:File.png',
+ 'text' => 'User reverted File:File.png to an old version',
'api' => [],
],
],