Page MenuHomePhabricator

Call to undefined method ArchivedFile::getArchiveName() when attempting to restore file revision
Closed, ResolvedPublic

Description

Original bug title:
Call to undefined method ArchivedFile::getArchiveName() when attempting to restore file revision

Query:
POST https://commons.wikimedia.org/w/api.php
action revisiondelete
format jsonfm
ids 2373038
reason test
show content|comment|user
target File:' onmouseover='alert("There is a security vulnerable. Please contact the next admin if you see this in a message box.")' target='.png
token <redacted>
type filearchive

Result:
500 Internal Server Error

Wikimedia Foundation
Error

PHP fatal error in /usr/local/apache/common-local/php-1.24wmf12/includes/revisiondelete/RevisionDelete.php line 748:
Call to undefined method ArchivedFile::getArchiveName()


Version: unspecified
Severity: major

Details

Reference
bz68034

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:32 AM
bzimport set Reference to bz68034.
bzimport added a subscriber: Unknown Object (MLST).

It's possible that I do something wrong but it should still not return a server error. Also it's quite unintuitive that action=delete deletes all revisions but action=undelete with timestamps provided only restores text revisions.

This is currently blocking writing a semi-automated revision splitting script to clean up the mess UploadWizard (Bug 40304, Bug 54750) created.

Change 146482 had a related patch set uploaded by Anomie:
RevDelArchivedFileItem needs to override getApiData

https://gerrit.wikimedia.org/r/146482

(In reply to Rainer Rillke @commons.wikimedia from comment #1)

Also it's quite unintuitive that action=delete deletes all
revisions but action=undelete with timestamps provided only restores text
revisions.

That makes sense to me, since it parallels action=delete and Special:Undelete in the web UI.

The real problem is bug 40817: there's no way to undelete files at all.

Change 146482 merged by jenkins-bot:
RevDelArchivedFileItem needs to override getApiData

https://gerrit.wikimedia.org/r/146482

This should be deployed to WMF wikis with 1.24wmf14, see https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.