Merge "Begin exposing SiteConfiguration via site contexts"
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index 2260241..a6c3421 100644 (file)
@@ -105,7 +105,7 @@ abstract class UploadBase {
                }
 
                # Check php's file_uploads setting
-               return wfIsHipHop() || wfIniGetBool( 'file_uploads' );
+               return wfIsHHVM() || wfIniGetBool( 'file_uploads' );
        }
 
        /**
@@ -250,7 +250,7 @@ abstract class UploadBase {
 
        /**
         * @param string $srcPath the source path
-        * @return string the real path if it was a virtual URL
+        * @return string|bool the real path if it was a virtual URL Returns false on failure
         */
        function getRealPath( $srcPath ) {
                wfProfileIn( __METHOD__ );
@@ -259,12 +259,15 @@ abstract class UploadBase {
                        // @todo just make uploads work with storage paths
                        // UploadFromStash loads files via virtual URLs
                        $tmpFile = $repo->getLocalCopy( $srcPath );
-                       $tmpFile->bind( $this ); // keep alive with $this
-                       wfProfileOut( __METHOD__ );
-                       return $tmpFile->getPath();
+                       if ( $tmpFile ) {
+                               $tmpFile->bind( $this ); // keep alive with $this
+                       }
+                       $path = $tmpFile ? $tmpFile->getPath() : false;
+               } else {
+                       $path = $srcPath;
                }
                wfProfileOut( __METHOD__ );
-               return $srcPath;
+               return $path;
        }
 
        /**
@@ -319,8 +322,8 @@ abstract class UploadBase {
 
                $error = '';
                if ( !wfRunHooks( 'UploadVerification',
-                       array( $this->mDestName, $this->mTempPath, &$error ) ) )
-               {
+                       array( $this->mDestName, $this->mTempPath, &$error ) )
+               {
                        wfProfileOut( __METHOD__ );
                        return array( 'status' => self::HOOK_ABORTED, 'error' => $error );
                }
@@ -394,7 +397,6 @@ abstract class UploadBase {
                return true;
        }
 
-
        /**
         * Verifies that it's ok to include the uploaded file
         *
@@ -421,7 +423,6 @@ abstract class UploadBase {
                        }
                }
 
-
                $handler = MediaHandler::getHandler( $mime );
                if ( $handler ) {
                        $handlerStatus = $handler->verifyUpload( $this->mTempPath );
@@ -1097,7 +1098,6 @@ abstract class UploadBase {
                return false;
        }
 
-
        /**
         * Check a whitelist of xml encodings that are known not to be interpreted differently
         * by the server's xml parser (expat) and some common browsers.