Merge "objectcache: Fix MultiWriteBagOStuff docs ('asyncHandler', not 'asyncCallback')"
[lhc/web/wiklou.git] / includes / filebackend / FSFile.php
index 47bacb5..6311f76 100644 (file)
@@ -75,9 +75,9 @@ class FSFile {
         * @return string|bool TS_MW timestamp or false on failure
         */
        public function getTimestamp() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $timestamp = filemtime( $this->path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $timestamp !== false ) {
                        $timestamp = wfTimestamp( TS_MW, $timestamp );
                }
@@ -104,7 +104,6 @@ class FSFile {
         * @return array
         */
        public function getProps( $ext = true ) {
-               wfProfileIn( __METHOD__ );
                wfDebug( __METHOD__ . ": Getting file info for $this->path\n" );
 
                $info = self::placeholderProps();
@@ -118,9 +117,9 @@ class FSFile {
                                $ext = self::extensionFromPath( $this->path );
                        }
 
-                       # mime type according to file contents
+                       # MIME type according to file contents
                        $info['file-mime'] = $this->getMimeType();
-                       # logical mime type
+                       # logical MIME type
                        $info['mime'] = $magic->improveTypeFromExtension( $info['file-mime'], $ext );
 
                        list( $info['major_mime'], $info['minor_mime'] ) = File::splitMime( $info['mime'] );
@@ -132,7 +131,7 @@ class FSFile {
                        # Height, width and metadata
                        $handler = MediaHandler::getHandler( $info['mime'] );
                        if ( $handler ) {
-                               $tempImage = (object)array(); // XXX (hack for File object)
+                               $tempImage = (object)[]; // XXX (hack for File object)
                                $info['metadata'] = $handler->getMetadata( $tempImage, $this->path );
                                $gis = $handler->getImageSize( $tempImage, $this->path, $info['metadata'] );
                                if ( is_array( $gis ) ) {
@@ -146,8 +145,6 @@ class FSFile {
                        wfDebug( __METHOD__ . ": $this->path NOT FOUND!\n" );
                }
 
-               wfProfileOut( __METHOD__ );
-
                return $info;
        }
 
@@ -157,7 +154,7 @@ class FSFile {
         * @return array
         */
        public static function placeholderProps() {
-               $info = array();
+               $info = [];
                $info['fileExists'] = false;
                $info['mime'] = null;
                $info['media_type'] = MEDIATYPE_UNKNOWN;
@@ -177,7 +174,7 @@ class FSFile {
         * @return array
         */
        protected function extractImageSizeInfo( array $gis ) {
-               $info = array();
+               $info = [];
                # NOTE: $gis[2] contains a code for the image type. This is no longer used.
                $info['width'] = $gis[0];
                $info['height'] = $gis[1];
@@ -201,24 +198,19 @@ class FSFile {
         * @return bool|string False on failure
         */
        public function getSha1Base36( $recache = false ) {
-               wfProfileIn( __METHOD__ );
 
                if ( $this->sha1Base36 !== null && !$recache ) {
-                       wfProfileOut( __METHOD__ );
-
                        return $this->sha1Base36;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $this->sha1Base36 = sha1_file( $this->path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $this->sha1Base36 !== false ) {
-                       $this->sha1Base36 = wfBaseConvert( $this->sha1Base36, 16, 36, 31 );
+                       $this->sha1Base36 = Wikimedia\base_convert( $this->sha1Base36, 16, 36, 31 );
                }
 
-               wfProfileOut( __METHOD__ );
-
                return $this->sha1Base36;
        }