r38943 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38942‎ | r38943 | r38944 >
Date:20:30, 8 August 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Fill id cache for canonical ids also when creating new pages with parameter $canonical==false: if this is not
done, then it may happen that the newly written page is not yet found in long PHP runs even though it was
written to DB. This may be due to deferred DB commits. In this case, an existing ID is not found and duplicates
are created. The circumstances for this bug are rare: around 20 cases for 10000 pages on semanticweb.org.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -1518,9 +1518,10 @@
15191519 $db->insert('smw_ids', array('smw_id' => 0, 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw, 'smw_sortkey' => $sortkey), 'SMW::makeSMWPageID');
15201520 $id = $db->insertId();
15211521 $this->m_ids["$iw $namespace $title -"] = $id; // fill that cache, even if canonical was given
1522 - if ($canonical) { // this ID is also authorative for the canonical version
1523 - $this->m_ids["$iw $namespace $title C"] = $id;
1524 - }
 1522+ // This ID is also authorative for the canonical version.
 1523+ // This is always the case: if $canonical===false and $id===0, then there is no redi-entry in
 1524+ // smw_ids either, hence the object just did not exist at all.
 1525+ $this->m_ids["$iw $namespace $title C"] = $id;
15251526 } elseif ( ($sortkey != '') && ($sortkey != $oldsort) ) {
15261527 $db =& wfGetDB( DB_MASTER );
15271528 $db->update('smw_ids', array('smw_sortkey' => $sortkey), array('smw_id' => $id), 'SMW::makeSMWPageID');

Status & tagging log