r82298 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r82297‎ | r82298 | r82299 >
Date:21:30, 16 February 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Added fix for page invalidation after storing semantic data
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_RAPStore2.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStoreLight.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_TestStore.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStoreLight.php
——@@ -264,7 +264,7 @@
265265 wfProfileOut( 'SMWSQLStoreLight::deleteSubject (SMW)' );
266266 }
267267
268 - public function updateData( SMWSemanticData $data ) {
 268+ public function doDataUpdate( SMWSemanticData $data ) {
269269 wfProfileIn( "SMWSQLStoreLight::updateData (SMW)" );
270270 wfRunHooks( 'SMWSQLStoreLight::updateDataBefore', array( $this, $data ) );
271271 $subject = $data->getSubject();
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php
——@@ -212,9 +212,38 @@
213213 * as a SMWSemanticData object, which contains all semantic data for one particular
214214 * subject.
215215 */
216 - public abstract function updateData( SMWSemanticData $data );
 216+ public abstract function doDataUpdate( SMWSemanticData $data );
217217
218218 /**
 219+ * Update the semantic data stored for some individual. The data is given
 220+ * as a SMWSemanticData object, which contains all semantic data for one particular
 221+ * subject.
 222+ */
 223+ public function updateData( SMWSemanticData $data ) {
 224+ wfRunHooks( 'SMWStore::updateDataBefore', array( $this, $data ) );
 225+
 226+ $this->doDataUpdate( $data );
 227+
 228+ // Invalidate the page, so data stored on it gets displayed immeditaely in queries.
 229+ global $smwgAutoRefreshSubject;
 230+ if ( $smwgAutoRefreshSubject && !wfReadOnly() ) {
 231+ $title = $data->getSubject()->getTitle();
 232+ $dbw = wfGetDB( DB_MASTER );
 233+
 234+ $dbw->update(
 235+ 'page',
 236+ array( 'page_touched' => $dbw->timestamp() + 9001 ),
 237+ $title->pageCond(),
 238+ __METHOD__
 239+ );
 240+
 241+ HTMLFileCache::clearFileCache( $title );
 242+ }
 243+
 244+ wfRunHooks( 'SMWStore::updateDataAfter', array( $this, $data ) );
 245+ }
 246+
 247+ /**
219248 * Clear all semantic data specified for some page.
220249 */
221250 public function clearData( Title $subject ) {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_TestStore.php
——@@ -125,7 +125,7 @@
126126 function deleteSubject( Title $subject ) {
127127 }
128128
129 - function updateData( SMWSemanticData $data ) {
 129+ function doDataUpdate( SMWSemanticData $data ) {
130130 }
131131
132132 function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 ) {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
——@@ -756,11 +756,11 @@
757757 }
758758
759759 /**
760 - * @see SMWStore::updateData
 760+ * @see SMWStore::doDataUpdate
761761 *
762762 * @param SMWSemanticData $data
763763 */
764 - public function updateData( SMWSemanticData $data ) {
 764+ public function doDataUpdate( SMWSemanticData $data ) {
765765 wfProfileIn( "SMWSQLStore2::updateData (SMW)" );
766766 wfRunHooks( 'SMWSQLStore2::updateDataBefore', array( $this, $data ) );
767767
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_RAPStore2.php
——@@ -58,7 +58,7 @@
5959 return parent::deleteSubject( $subject );
6060 }
6161
62 - function updateData( SMWSemanticData $data ) {
 62+ function doDataUpdate( SMWSemanticData $data ) {
6363 // Create a local memmodel
6464 $model = ModelFactory::getDefaultModel();
6565
Index: trunk/extensions/SemanticMediaWiki/SMW_Settings.php
——@@ -457,3 +457,10 @@
458458 ##
459459 $smwgAutocompleteInSpecialAsk = true;
460460 ##
 461+
 462+###
 463+# Sets whether or not the 'printouts' textarea should have autocompletion
 464+# on property names.
 465+##
 466+$smwgAutoRefreshSubject = true;
 467+##

Follow-up revisions

RevisionCommit summaryAuthorDate
r82431follow up to r82298jeroendedauw00:42, 19 February 2011

Comments

#Comment by Reach Out to the Truth (talk | contribs)   05:38, 17 February 2011

The explanation for $smwgAutoRefreshSubject is the same as $smwgAutocompleteInSpecialAsk.

#Comment by Jeroen De Dauw (talk | contribs)   00:43, 19 February 2011

Fixed in follow up :)

Status & tagging log