Merge "Parser: Add guessSectionNameFromStrippedText() and refactor"
[lhc/web/wiklou.git] / includes / filerepo / file / UnregisteredLocalFile.php
index 5ee25cd..fde68bb 100644 (file)
@@ -111,6 +111,11 @@ class UnregisteredLocalFile extends File {
         * @return bool
         */
        private function cachePageDimensions( $page = 1 ) {
+               $page = (int)$page;
+               if ( $page < 1 ) {
+                       $page = 1;
+               }
+
                if ( !isset( $this->dims[$page] ) ) {
                        if ( !$this->getHandler() ) {
                                return false;
@@ -146,7 +151,7 @@ class UnregisteredLocalFile extends File {
         */
        function getMimeType() {
                if ( !isset( $this->mime ) ) {
-                       $magic = MimeMagic::singleton();
+                       $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
                        $this->mime = $magic->guessMimeType( $this->getLocalRefPath() );
                }
 
@@ -166,8 +171,8 @@ class UnregisteredLocalFile extends File {
        }
 
        /**
-       * @return int
-       */
+        * @return int
+        */
        function getBitDepth() {
                $gis = $this->getImageSize( $this->getLocalRefPath() );