merging latest master
[lhc/web/wiklou.git] / includes / upload / UploadStash.php
index 329ee22..aa65ffe 100644 (file)
@@ -239,10 +239,14 @@ class UploadStash {
                                }
                        }
                        // at this point, $error should contain the single "most important" error, plus any parameters.
-                       throw new UploadStashFileException( "Error storing file in '$path': " . wfMessage( $error )->text() );
+                       $errorMsg = array_shift( $error );
+                       throw new UploadStashFileException( "Error storing file in '$path': " . wfMessage( $errorMsg, $error )->text() );
                }
                $stashPath = $storeStatus->value;
 
+               // we have renamed the file so we have to cleanup once done
+               unlink($path);
+
                // fetch the current user ID
                if ( !$this->isLoggedIn ) {
                        throw new UploadStashNotLoggedInException( __METHOD__ . ' No user is logged in, files must belong to users' );