[workaround] Gallery / PHP Fatal error: Call to a member function isSpecialPage() on a non-object in Gallery.php on line 70
From semantic-mediawiki.org
The SemanticResultFormat 1.9.2 "Gallery" is not fully operative with MW 1.23+ anymore. ("TagCloud" as well!)
The problem was discussed at https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/35 and solved uncompletely at https://github.com/SemanticMediaWiki/SemanticResultFormats/commit/d48a7b1df17066d43567d7c738d7aa1dc489056f . To complete this workaround, please have a look at following changes in file extensions/SemanticResultFormats/formats/gallery/Gallery.php to bypass the problem:
@@ -49,6 +49,16 @@
return $this->getResultText( $results, $this->outputMode );
}
+ private function isSpecialPage() {
+ $title = $this->getContext()->getTitle();
+ return $title instanceof \Title && $title->isSpecialPage();
+ }
+
+ private function getNsText($file) {
+ $languagepage = $this->getContext()->getTitle();
+ return $languagepage instanceof \Title && $languagepage->getNsText( $file );
+ }
+
/**
* @see SMWResultPrinter::getResultText
*
@@ -67,7 +77,7 @@
// No need for a special page to use the parser but for the "normal" page
// view we have to ensure caption text is parsed correctly through the parser
- if ( !$this->getContext()->getTitle()->isSpecialPage() ) {
+ if ( !$this->isSpecialPage() ) {
$ig->setParser( $GLOBALS['wgParser'] );
}
@@ -161,7 +171,7 @@
'class' => 'srf-gallery' . $class,
'align' => 'justify',
'data-redirect-type' => $redirectType,
- 'data-ns-text' => $this->getContext()->getTitle()->getPageLanguage()->getNsText( NS_FILE )
+ 'data-ns-text' => $this->getNsText( NS_FILE )
);
$html = Html::rawElement( 'div', $attribs, $processing . $ig->toHTML() );
@@ -306,7 +316,7 @@
$imgCaption = '';
}
} else {
- if ( $imgTitle instanceof Title && $imgTitle->getNamespace() == NS_FILE && !$this->getContext()->getTitle()->isSpecialPage() ) {
+ if ( $imgTitle instanceof Title && $imgTitle->getNamespace() == NS_FILE && !$this->isSpecialPage() ) {
$imgCaption = $ig->mParser->recursiveTagParse( $imgCaption );
}
}
Good luck,