Pergunta

Just upgraded Mediawiki 1.19.6 to the most current, 1.22.2. Used update.php, which worked just fine. The front page loads, as do SOME of the articles if you enter their exact URL. However, following any of the links produces:

Catchable fatal error: Argument 1 passed to ContentHandler::getContentText() must implement interface Content, boolean given, called in <wiki path>/includes/Article.php on line 389 and defined in <wiki path>/includes/content/ContentHandler.php on line 95.

I've looked up the call to getContentText() in Article.php, and it's in a function called fetchContent(), with a comment about it being crufty and a note that the ContentHandler method within is deprecated.

I can't figure out how to fix what's gone wrong, and web searches are only turning up bug reports that are marked fixed... any ideas? Thanks very much.

Foi útil?

Solução 2

We had the same problem. Our ICT guy handled it by adapting the Article.php file placed in the includes directory of your mediawiki. Only 1 function was adapted (line 377 function function fetchContent()). I do not know the exact working principle but the MediaWiki returned to normal.

Also I believe you need to run the mediawiki update routine by visiting: 'HostAdress'/MediaWiki/mw-config/

Original function in Article.php:

function fetchContent() { #BC cruft!
    ContentHandler::deprecated( __METHOD__, '1.21' );

    if ( $this->mContentLoaded && $this->mContent ) {
        return $this->mContent;
    }

    wfProfileIn( __METHOD__ );

    $content = $this->fetchContentObject();

    // @todo Get rid of mContent everywhere!
    $this->mContent = ContentHandler::getContentText( $content );
    ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );

    wfProfileOut( __METHOD__ );

    return $this->mContent;
}

New function in Article.php:

function fetchContent() { #BC cruft!
    ContentHandler::deprecated( __METHOD__, '1.21' );

    if ( $this->mContentLoaded && $this->mContent ) {
        return $this->mContent;
    }

    wfProfileIn( __METHOD__ );

    $content = $this->fetchContentObject();

    if ( !$content ) {
    wfProfileOut( __METHOD__ );
    return false;
    }

    // @todo Get rid of mContent everywhere!
    $this->mContent = ContentHandler::getContentText( $content );
    ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );

    wfProfileOut( __METHOD__ );

    return $this->mContent;
}

Outras dicas

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top