Php 正在更新MediaWiki扩展名,文件_exists()

Php 正在更新MediaWiki扩展名,文件_exists(),php,mediawiki,mediawiki-extensions,Php,Mediawiki,Mediawiki Extensions,我正在将我们的系统更新为新的MediaWiki(从1.18.3升级到1.25.1) 我们有一个将.gnumeric文件呈现为html的扩展名,这样我们就可以显示它了 以下代码已为新版本部分重写 class GnumericImage extends MediaTransformOutput { function GnumericImage( $file, $url, $path = false, $page = false ) { $this->file =

我正在将我们的系统更新为新的MediaWiki(从1.18.3升级到1.25.1)

我们有一个将.gnumeric文件呈现为html的扩展名,这样我们就可以显示它了

以下代码已为新版本部分重写

class GnumericImage extends MediaTransformOutput {
    function GnumericImage( $file, $url, $path = false, $page = false ) {
            $this->file = $file;
            $this->url = $url;
            # These should be integers when they get here.
            # If not, there's a bug somewhere.  But let's at
            # least produce valid HTML code regardless.
            $this->path = $path;
            $this->page = $page;
    }

    //... <snip> ...

    // MEMBER OF GnumericImage
    function toHtml( $options = array() ) {
        $src = $this->file->getPath();
        $dst = $this->getStoragePath(); // was $this->getPath();

        if($this->file->exists()) {
            exec("LC_ALL=nl_NL.UTF-8 /usr/bin/ssconvert \"$src\" \"$dst\" > /dev/null");

            echo($dst);

            // This line errors
            // Converting might fail so check if there is a file
            if(! file_exists($dst)) return("ssconvert failed");

            $data = file_get_contents($dst);
            // ... MORE CODE TO DISPLAY RESULT ...
        }
    }

$dst
包含:
mwstore://local-backend/local-thumb/c/ca/file_name/-file_name.html

$src
$dst
中的路径是mediawiki路径。将其路径更改为文件系统路径修复了该问题

$src = $this->file->getLocalRefPath();
$dst = $this->getLocalCopyPath();
$src = $this->file->getLocalRefPath();
$dst = $this->getLocalCopyPath();