r63766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63765‎ | r63766 | r63767 >
Date:10:49, 15 March 2010
Author:dantman
Status:deferred
Tags:
Comment:
Make proper use of the parser's clearState to make sure that when parsing a page twice for some reason SIO doesn't think there are twice as many SIO calls as there really are.
Note that this does not fix the additional issue where when running a refresh job through runJobs will parse the page an extra time for each SIO call in the page.
Modified paths:
  • /trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php (modified) (history)
  • /trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php
@@ -22,6 +22,7 @@
2323
2424 $wgHooks['ParserFirstCallInit'][] = 'siofRegisterParserFunctions';
2525 $wgHooks['LanguageGetMagic'][] = 'siofLanguageGetMagic';
 26+$wgHooks['ParserClearState'][] = 'SIOHandler::clearState';
2627 $wgHooks['smwDeleteSemanticData'][] = 'SIOHandler::updateData';
2728 $wgHooks['smwUpdatePropertySubjects'][] = 'SIOHandler::handleUpdatingOfInternalObjects';
2829
Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php
@@ -111,6 +111,13 @@
112112 static $internal_object_index = 1;
113113 static $internal_objects = array();
114114
 115+ public static function clearState( &$parser ) {
 116+ self::$cur_page_name = '';
 117+ self::$cur_page_namespace = 0;
 118+ self::$internal_object_index = 1;
 119+ return true;
 120+ }
 121+
115122 public static function doSetInternal( &$parser ) {
116123 $main_page_name = $parser->getTitle()->getDBKey();
117124 $main_page_namespace = $parser->getTitle()->getNamespace();

Status & tagging log