Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | $wgHooks['ParserClearState'][] = 'SIOHandler::clearState'; |
27 | 27 | $wgHooks['smwDeleteSemanticData'][] = 'SIOHandler::updateData'; |
28 | 28 | $wgHooks['smwUpdatePropertySubjects'][] = 'SIOHandler::handleUpdatingOfInternalObjects'; |
| 29 | +$wgHooks['smwRefreshDataJobs'][] = 'SIOHandler::handleRefreshingOfInternalObjects'; |
29 | 30 | |
30 | 31 | $siogIP = $IP . '/extensions/SemanticInternalObjects'; |
31 | 32 | $wgExtensionMessagesFiles['SemanticInternalObjects'] = $siogIP . '/SemanticInternalObjects.i18n.php'; |
Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php |
— | — | @@ -221,4 +221,21 @@ |
222 | 222 | } |
223 | 223 | return true; |
224 | 224 | } |
| 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 | + } |
225 | 242 | } |