Merge "Do not pass $archiveName two times to OldLocalFile"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 7 Jan 2019 18:51:29 +0000 (18:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 7 Jan 2019 18:51:29 +0000 (18:51 +0000)
includes/filerepo/file/OldLocalFile.php
includes/import/ImportableUploadRevisionImporter.php

index ad95bb4..23ff304 100644 (file)
@@ -406,16 +406,15 @@ class OldLocalFile extends LocalFile {
         * Upload a file directly into archive. Generally for Special:Import.
         *
         * @param string $srcPath File system path of the source file
-        * @param string $archiveName Full archive name of the file, in the form
-        *   $timestamp!$filename, where $filename must match $this->getName()
         * @param string $timestamp
         * @param string $comment
         * @param User $user
         * @return Status
         */
-       function uploadOld( $srcPath, $archiveName, $timestamp, $comment, $user ) {
+       public function uploadOld( $srcPath, $timestamp, $comment, $user ) {
                $this->lock();
 
+               $archiveName = $this->getArchiveName();
                $dstRel = $this->getArchiveRel( $archiveName );
                $status = $this->publishTo( $srcPath, $dstRel );
 
index 4fbddb5..4b378c1 100644 (file)
@@ -104,9 +104,13 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
                        ?: User::newFromName( $importableRevision->getUser(), false );
 
                # Do the actual upload
-               if ( $archiveName ) {
-                       $status = $file->uploadOld( $source, $archiveName,
-                               $importableRevision->getTimestamp(), $importableRevision->getComment(), $user );
+               if ( $file instanceof OldLocalFile ) {
+                       $status = $file->uploadOld(
+                               $source,
+                               $importableRevision->getTimestamp(),
+                               $importableRevision->getComment(),
+                               $user
+                       );
                } else {
                        $flags = 0;
                        $status = $file->upload(