Unsuppress more phan issues (part 5)
[lhc/web/wiklou.git] / includes / media / DjVuHandler.php
index 4413525..3b904e8 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  * @ingroup Media
  */
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Shell\Shell;
 
 /**
  * Handler for DjVu images
@@ -130,7 +132,7 @@ class DjVuHandler extends ImageHandler {
         * @param array $params
         * @return array
         */
-       function getScriptParams( $params ) {
+       protected function getScriptParams( $params ) {
                return [
                        'width' => $params['width'],
                        'page' => $params['page'],
@@ -203,7 +205,7 @@ class DjVuHandler extends ImageHandler {
 
                # Use a subshell (brackets) to aggregate stderr from both pipeline commands
                # before redirecting it to the overall stdout. This works in both Linux and Windows XP.
-               $cmd = '(' . wfEscapeShellArg(
+               $cmd = '(' . Shell::escape(
                        $wgDjvuRenderer,
                        "-format=ppm",
                        "-page={$page}",
@@ -212,7 +214,7 @@ class DjVuHandler extends ImageHandler {
                if ( $wgDjvuPostProcessor ) {
                        $cmd .= " | {$wgDjvuPostProcessor}";
                }
-               $cmd .= ' > ' . wfEscapeShellArg( $dstPath ) . ') 2>&1';
+               $cmd .= ' > ' . Shell::escape( $dstPath ) . ') 2>&1';
                wfDebug( __METHOD__ . ": $cmd\n" );
                $retval = '';
                $err = wfShellExec( $cmd, $retval );
@@ -402,7 +404,7 @@ class DjVuHandler extends ImageHandler {
        }
 
        protected function getDimensionInfo( File $file ) {
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                return $cache->getWithSetCallback(
                        $cache->makeKey( 'file-djvu', 'dimensions', $file->getSha1() ),
                        $cache::TTL_INDEFINITE,