r63794 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63793‎ | r63794 | r63795 >
Date:01:28, 16 March 2010
Author:dantman
Status:deferred
Tags:
Comment:
Fix bug where refreshData generates bad jobs.
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
@@ -25,6 +25,7 @@
2626 $wgHooks['ParserClearState'][] = 'SIOHandler::clearState';
2727 $wgHooks['smwDeleteSemanticData'][] = 'SIOHandler::updateData';
2828 $wgHooks['smwUpdatePropertySubjects'][] = 'SIOHandler::handleUpdatingOfInternalObjects';
 29+$wgHooks['smwRefreshDataJobs'][] = 'SIOHandler::handleRefreshingOfInternalObjects';
2930
3031 $siogIP = $IP . '/extensions/SemanticInternalObjects';
3132 $wgExtensionMessagesFiles['SemanticInternalObjects'] = $siogIP . '/SemanticInternalObjects.i18n.php';
Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php
@@ -221,4 +221,21 @@
222222 }
223223 return true;
224224 }
 225+
 226+ /**
 227+ * Takes a set of SMW "update jobs" generated by refresh data and removes
 228+ * any job with a fragment (in other words a job trying to update a SIO object)
 229+ * We aren't guaranteed that all the jobs related to a single page using SIO
 230+ * will be in a single one of these batches so we remove everything updating
 231+ * a SIO object instead of filtering them down to unique titles.
 232+ */
 233+ static function handleRefreshingOfInternalObjects(&$jobs) {
 234+ $all_jobs = $jobs;
 235+ $jobs = array();
 236+ foreach ( $all_jobs as $job ) {
 237+ if ( strpos( $job->title->getText(), '#' ) === false )
 238+ $jobs[] = $job;
 239+ }
 240+ return true;
 241+ }
225242 }

Status & tagging log