Jump to content

Topic on Extension talk:PDFEmbed/Flow

MW 1.35 Call to undefined method Parser::disableCache()

6
Seppl2013 (talkcontribs)

PDFEmbed/PDFEmbed.hooks.php: Call to undefined method Parser::disableCache()

Seppl2013 (talkcontribs)
Kghbln (talkcontribs)

Thanks for working on this and providing a way out.

Spas.Z.Spasov (talkcontribs)

Hi, @Seppl2013, thank you for the solution. In order to do some combability with the old synaxis, <pdf>File:Name-of-the-file.pdf</pdf>, I've made an additional fix in my local copy of PDFEmbed.hooks.php in this way:

127 $filename = $re[1];
128 
129 if (count($re) == 3) {
130 	$page = $re[2];
131 }
132 // the next lines are new
133 $ns_media_wiki_lang = MediaWiki\MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNsText( NS_MEDIA );
134 $ns_file_wiki_lang = MediaWiki\MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNsText( NS_FILE );
135 $ns_media_lang_en = MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' )->getFormattedNsText( NS_MEDIA );
136 $ns_file_lang_en = MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' )->getFormattedNsText( NS_FILE );
137 $filename = preg_replace("/^($ns_media_wiki_lang|$ns_file_wiki_lang|$ns_media_lang_en|$ns_file_lang_en):/", '', $filename);
Andreas Wachowski (talkcontribs)

FYI, I received a "File does not exist error" using Seppl2013's clone and it worked again after introducing Spas.Z.Spasov's changes. Thanks to you both!

Seppl2013 (talkcontribs)