Fix UploadStash::removeFile() error
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 26 Feb 2013 23:15:17 +0000 (15:15 -0800)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 26 Feb 2013 23:27:30 +0000 (15:27 -0800)
If nothing has called getFile() for a key before that key is passed to
removeFileNoAuth(), UploadStash will throw a fatal error when it tries to
remove the file from the filesystem because the UploadStashFile was
never created.

Change-Id: Idf0d2c53ce759b59836f34ff5aaad393b8c371c6

includes/upload/UploadStash.php

index 65626cf..70debee 100644 (file)
@@ -358,6 +358,9 @@ class UploadStash {
        public function removeFileNoAuth( $key ) {
                wfDebug( __METHOD__ . " clearing row $key\n" );
 
+               // Ensure we have the UploadStashFile loaded for this key
+               $this->getFile( $key );
+
                $dbw = $this->repo->getMasterDb();
 
                $dbw->delete(