diff options
author | Tim Starling <tstarling@users.mediawiki.org> | 2004-07-05 02:57:44 +0000 |
---|---|---|
committer | Tim Starling <tstarling@users.mediawiki.org> | 2004-07-05 02:57:44 +0000 |
commit | aa6ed109f390b43c09c326d0e282e79f5fcf39f3 (patch) | |
tree | ddd0ccc16565aabba5a1cd90ffdf396ec62c29f0 | |
parent | 15b9121957f5c612502a36fa1b17ffdf1ab4e44e (diff) | |
download | mediawikicore-aa6ed109f390b43c09c326d0e282e79f5fcf39f3.tar.gz mediawikicore-aa6ed109f390b43c09c326d0e282e79f5fcf39f3.zip |
Select for update when getting links to swap. Hopefully this will fix one cause of key collision and hence link table corruption seen recently
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/4233
-rw-r--r-- | includes/Title.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/Title.php b/includes/Title.php index 87d7e96674c5..d54c0a9276bc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -770,10 +770,10 @@ class Title { # Get an array of Title objects linking to this title # Also stores the IDs in the link cache - function getLinksTo() { + function getLinksTo( $options = '' ) { global $wgLinkCache; $id = $this->getArticleID(); - $sql = "SELECT cur_namespace,cur_title,cur_id FROM cur,links WHERE l_from=cur_id AND l_to={$id}"; + $sql = "SELECT cur_namespace,cur_title,cur_id FROM cur,links WHERE l_from=cur_id AND l_to={$id} $options"; $res = wfQuery( $sql, DB_READ, "Title::getLinksTo" ); $retVal = array(); if ( wfNumRows( $res ) ) { @@ -790,11 +790,11 @@ class Title { # Get an array of Title objects linking to this non-existent title # Also stores the IDs in the link cache - function getBrokenLinksTo() { + function getBrokenLinksTo( $options = '' ) { global $wgLinkCache; $encTitle = wfStrencode( $this->getPrefixedDBkey() ); $sql = "SELECT cur_namespace,cur_title,cur_id FROM brokenlinks,cur " . - "WHERE bl_from=cur_id AND bl_to='$encTitle'"; + "WHERE bl_from=cur_id AND bl_to='$encTitle' $options"; $res = wfQuery( $sql, DB_READ, "Title::getBrokenLinksTo" ); $retVal = array(); if ( wfNumRows( $res ) ) { @@ -955,8 +955,8 @@ class Title { # Swap links # Load titles and IDs - $linksToOld = $this->getLinksTo(); - $linksToNew = $nt->getLinksTo(); + $linksToOld = $this->getLinksTo( 'FOR UPDATE' ); + $linksToNew = $nt->getLinksTo( 'FOR UPDATE' ); # Delete them all $sql = "DELETE FROM links WHERE l_to=$oldid OR l_to=$newid"; |