Page MenuHomePhabricator

SMW blocked when Extension:Pdf Export is loaded.
Closed, ResolvedPublic

Description

This is probably an informative message only,
since it is possibly not Semantic MediaWikis
fault, see
http://www.mediawiki.org/wiki/Extension_talk:Pdf_Export#Bug:_Pdf_Export_blocks_SemanticMediaWiki

When the Pdf Export Extension was included
in Localsettings.php before SMW, we observed:

  • Special:Version looked as expected.
  • Special:Specialpages did not show any of SMWs special pages
  • URL-calling the page Special:SMWAdmin, or entering it via the seach box, yielded a "nonexisting special page" error

Removing the line:

require_once($IP.'/extensions/PdfExport/PdfExport.php');

from Localsettings.php made SMW work.

Putting it *after* the inclusion of SMW at least
passed a quick test of SMW.

The Pdf Export extensions code can be found at
http://www.mediawiki.org/wiki/Extension:Pdf_Export


Version: unspecified
Severity: blocker
OS: Linux
URL: http://krefeldwiki.de/

Details

Reference
bz11238

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:53 PM
bzimport set Reference to bz11238.
bzimport added a subscriber: Unknown Object (MLST).

This is a semi-bug in the PDF extension: it adds a special page object during init, thereby triggering MediaWiki's complete init procedure for all special pages. SMW, in contrast, merely registers its special pages for later on-demand loading. Now when using PDFExport, the "later" loading has already happened, without SMW's pages being considered.

A fix, which will also significantly speed up wikis that use PDFExport, is as follows:

  • move the class definition for SpecialPdf out of the function wfSpecialPdf()
  • remove the line SpecialPage::addPage (new SpecialPdf()); from wfSpecialPdf()
  • add the following code to wfSpecialPdf():

    global $wgSpecialPages; $wgSpecialPages['PdfPrint'] = array('SpecialPdf');

Thinking about it, the values for $wgSpecialPages should be set up right away during loading, not in the extension hook. I will move SMW's registrations, so that even the current PdfPrint version should not break them. The above change is still useful to improve performance (the impact of addPage can be quite large), but again it should be better to move

$wgSpecialPages['PdfPrint'] = array('SpecialPdf');

right at to top, outside of the function.