Replace MimeMagic::singleton() calls
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index 660c5b7..c335e2b 100644 (file)
@@ -155,7 +155,7 @@ abstract class UploadBase {
        /**
         * Create a form of UploadBase depending on wpSourceType and initializes it
         *
-        * @param WebRequest $request
+        * @param WebRequest &$request
         * @param string|null $type
         * @return null|UploadBase
         */
@@ -241,13 +241,13 @@ abstract class UploadBase {
        /**
         * Initialize from a WebRequest. Override this in a subclass.
         *
-        * @param WebRequest $request
+        * @param WebRequest &$request
         */
        abstract public function initializeFromRequest( &$request );
 
        /**
         * @param string $tempPath File system path to temporary file containing the upload
-        * @param integer $fileSize
+        * @param int $fileSize
         */
        protected function setTempFile( $tempPath, $fileSize = null ) {
                $this->mTempPath = $tempPath;
@@ -420,7 +420,7 @@ abstract class UploadBase {
                        $chunk = fread( $fp, 256 );
                        fclose( $fp );
 
-                       $magic = MimeMagic::singleton();
+                       $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
                        $extMime = $magic->guessTypesForExtension( $this->mFinalExtension );
                        $ieTypes = $magic->getIEMimeTypes( $this->mTempPath, $chunk, $extMime );
                        foreach ( $ieTypes as $ieType ) {
@@ -446,7 +446,7 @@ abstract class UploadBase {
                        return $status;
                }
 
-               $mwProps = new MWFileProps( MimeMagic::singleton() );
+               $mwProps = new MWFileProps( MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer() );
                $this->mFileProps = $mwProps->getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
                $mime = $this->mFileProps['mime'];
 
@@ -505,7 +505,7 @@ abstract class UploadBase {
                # getTitle() sets some internal parameters like $this->mFinalExtension
                $this->getTitle();
 
-               $mwProps = new MWFileProps( MimeMagic::singleton() );
+               $mwProps = new MWFileProps( MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer() );
                $this->mFileProps = $mwProps->getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
 
                # check MIME type, if desired
@@ -950,7 +950,7 @@ abstract class UploadBase {
                        $this->mFinalExtension = '';
 
                        # No extension, try guessing one
-                       $magic = MimeMagic::singleton();
+                       $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
                        $mime = $magic->guessMimeType( $this->mTempPath );
                        if ( $mime !== 'unknown/unknown' ) {
                                # Get a space separated list of extensions
@@ -1207,7 +1207,7 @@ abstract class UploadBase {
         * @return bool
         */
        public static function verifyExtension( $mime, $extension ) {
-               $magic = MimeMagic::singleton();
+               $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
 
                if ( !$mime || $mime == 'unknown' || $mime == 'unknown/unknown' ) {
                        if ( !$magic->isRecognizableExtension( $extension ) ) {
@@ -1496,6 +1496,7 @@ abstract class UploadBase {
         * @param string $type PUBLIC or SYSTEM
         * @param string $publicId The well-known public identifier for the dtd
         * @param string $systemId The url for the external dtd
+        * @return bool|array
         */
        public static function checkSvgExternalDTD( $type, $publicId, $systemId ) {
                // This doesn't include the XHTML+MathML+SVG doctype since we don't
@@ -1521,6 +1522,7 @@ abstract class UploadBase {
         * @todo Replace this with a whitelist filter!
         * @param string $element
         * @param array $attribs
+        * @param array $data
         * @return bool
         */
        public function checkSvgScriptCallback( $element, $attribs, $data = null ) {