r60867 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60866‎ | r60867 | r60868 >
Date:18:34, 9 January 2010
Author:siebrand
Status:deferred
Tags:
Comment:
(bug 21568) Add Adding "before" and "after" hook for updateData and deleteSubject. Patch contributed by Roi Avinoam.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/README (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
@@ -23,6 +23,7 @@
2424 for the selected format's parameters, and to use Ajax where possible
2525 * To that end, each format's query printer now includes a getParameters()
2626 function that supplies the name and attributes of each the format's parameters
 27+* "before" and "after" hooks for updateData and deleteSubject were added.
2728
2829 == SMW 1.4.3 ==
2930
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -585,6 +585,7 @@
586586
587587 public function deleteSubject(Title $subject) {
588588 wfProfileIn('SMWSQLStore2::deleteSubject (SMW)');
 589+ wfRunHooks( 'SMWSQLStore2::deleteSubjectBefore', array( $this, $subject ) );
589590 $this->deleteSemanticData(SMWWikiPageValue::makePageFromTitle($subject));
590591 $this->updateRedirects($subject->getDBkey(), $subject->getNamespace()); // also delete redirects, may trigger update jobs!
591592 if ($subject->getNamespace() == SMW_NS_CONCEPT) { // make sure to clear caches
@@ -597,11 +598,13 @@
598599 ///TODO: who is responsible for these updates? Some update jobs are currently created in SMW_Hooks, some internally in the store
599600 ///TODO: Possibly delete ID here (at least for non-properties/categories, if not used in any place in rels2)
600601 ///FIXME: clean internal caches here
 602+ wfRunHooks( 'SMWSQLStore2::deleteSubjectAfter', array( $this, $subject ) );
601603 wfProfileOut('SMWSQLStore2::deleteSubject (SMW)');
602604 }
603605
604606 public function updateData(SMWSemanticData $data) {
605607 wfProfileIn("SMWSQLStore2::updateData (SMW)");
 608+ wfRunHooks( 'SMWSQLStore2::updateDataBefore', array( $this, $data ) );
606609 $subject = $data->getSubject();
607610 $this->deleteSemanticData($subject);
608611 $redirects = $data->getPropertyValues(SMWPropertyValue::makeProperty('_REDI'));
@@ -662,6 +665,7 @@
663666 // Finally update caches (may be important if jobs are directly following this call)
664667 $this->m_semdata[$sid] = clone $data;
665668 $this->m_sdstate[$sid] = array_keys(SMWSQLStore2::getPropertyTables()); // everything that one can know
 669+ wfRunHooks( 'SMWSQLStore2::updateDataAfter', array( $this, $data ) );
666670 wfProfileOut("SMWSQLStore2::updateData (SMW)");
667671 }
668672
Index: trunk/extensions/SemanticMediaWiki/README
@@ -47,7 +47,7 @@
4848 * Code has been contributed by (in no particular order) Kai Hüner, Fernando Correia,
4949 Yaron Koren, Nick Grandy, Jörg Heizmann, Daniel Herzig, Nikolas Iwan, Tobias Matzner,
5050 Thomas Bleher, Felix Kratzer, Frank Dengler, Nathan R. Yergler, Daniel Friesen,
51 - Fabian Howahl, Jie Bao, Marcel Gsteiger
 51+ Fabian Howahl, Jie Bao, Marcel Gsteiger, Roi Avinoam
5252
5353 * The new logo and related artwork for Semantic MediaWiki (see semanticweb.org)
5454 has been designed and realised by Rozana Vrandecic.

Status & tagging log