r66874 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66873‎ | r66874 | r66875 >
Date:15:22, 25 May 2010
Author:maxsem
Status:deferred (Comments)
Tags:
Comment:
ProofreadPage: don't crash when $wgParser is null, such as during unit tests
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -63,11 +63,15 @@
6464 function pr_main() {
6565 global $wgParser;
6666 global $pr_page_namespace, $pr_index_namespace;
67 - $wgParser->setHook( "pagelist", "pr_renderPageList" );
68 - $wgParser->setHook( "pages", "pr_renderPages" );
69 - $wgParser->setHook( "pagequality", "pr_pageQuality" );
70 - $pr_page_namespace = null;
71 - $pr_index_namespace = null;
 67+
 68+ // @fixme Use ParserFirstCallInit hook, $wgParser is evil
 69+ if ( !is_null( $wgParser ) ) {
 70+ $wgParser->setHook( "pagelist", "pr_renderPageList" );
 71+ $wgParser->setHook( "pages", "pr_renderPages" );
 72+ $wgParser->setHook( "pagequality", "pr_pageQuality" );
 73+ $pr_page_namespace = null;
 74+ $pr_index_namespace = null;
 75+ }
7276 }
7377
7478

Comments

#Comment by Reedy (talk | contribs)   23:49, 6 January 2011

Brion made this nice in r74182

Status & tagging log