Fix return type of File::restore()
authorLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Tue, 11 Jun 2019 12:35:23 +0000 (14:35 +0200)
committerLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Tue, 11 Jun 2019 12:41:13 +0000 (14:41 +0200)
The only real implementation, LocalFile::restore(), has not returned an
int|bool since commit ca76169bbe, almost twelve years ago. (MediaWiki
code search [1] finds no other implementations.)

This discrepancy became more visible when we moved from wfLocalFile() to
FileRepo::findFile(), because wfLocalFile() (incorrectly, as it just
calls FileRepo::findFile()) is declared to return a LocalFile, rather
than any File as FileRepo::findFile() does, so the incorrect return type
on File::returnType() was not seen by wfLocalFile() users.

[1]: https://codesearch.wmflabs.org/search/?q=function%20restore\(&files=\.php%24

Change-Id: Idaf73074eaddc5be1782ae484d75a0f0c129b980

includes/filerepo/file/File.php

index 55c5053..124afef 100644 (file)
@@ -1953,8 +1953,7 @@ abstract class File implements IDBAccessObject {
         * @param array $versions Set of record ids of deleted items to restore,
         *   or empty to restore all revisions.
         * @param bool $unsuppress Remove restrictions on content upon restoration?
-        * @return int|bool The number of file revisions restored if successful,
-        *   or false on failure
+        * @return Status
         * STUB
         * Overridden by LocalFile
         */