http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94966

Revision: 94966
Author:   raindrift
Date:     2011-08-18 23:36:24 +0000 (Thu, 18 Aug 2011)
Log Message:
-----------
Two bugs:
1. When the user isn't passed to UploadFromStash::__construct(), it would break 
when it shouldn't.
2. When stashing files, sometimes an instance of UnregisteredLocalFile would be 
returned instead of UploadStashFile

Modified Paths:
--------------
    trunk/phase3/includes/upload/UploadFromStash.php

Modified: trunk/phase3/includes/upload/UploadFromStash.php
===================================================================
--- trunk/phase3/includes/upload/UploadFromStash.php    2011-08-18 23:29:31 UTC 
(rev 94965)
+++ trunk/phase3/includes/upload/UploadFromStash.php    2011-08-18 23:36:24 UTC 
(rev 94966)
@@ -29,7 +29,12 @@
                if( $stash ) {
                        $this->stash = $stash;
                } else {
-                       wfDebug( __METHOD__ . " creating new UploadStash 
instance for " . $user->getId() . "\n" );
+                       if( $user ) {
+                               wfDebug( __METHOD__ . " creating new 
UploadStash instance for " . $user->getId() . "\n" );
+                       } else {
+                               wfDebug( __METHOD__ . " creating new 
UploadStash instance with no user\n" );
+                       }
+
                        $this->stash = new UploadStash( $this->repo, 
$this->user );
                }
 
@@ -100,13 +105,13 @@
        }
 
        /**
-        * There is no need to stash the image twice
+        * Stash the file.
         */
        public function stashFile() {
-               if ( $this->mLocalFile ) {
-                       return $this->mLocalFile;
-               }
-               return parent::stashFile();
+               // replace mLocalFile with an instance of UploadStashFile, 
which adds some methods
+               // that are useful for stashed files.
+               $this->mLocalFile = parent::stashFile();
+               return $this->mLocalFile;
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to