* the link tables and redirect to the new page.
*/
function showArticle( $text, $subtitle , $sectionanchor = '', $me2, $now, $summary, $oldid ) {
- global $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
+ global $wgUseDumbLinkUpdate, $wgAntiLockFlags, $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
$wgLinkCache = new LinkCache();
+
+ if ( !$wgUseDumbLinkUpdate ) {
+ # Preload links to reduce lock time
+ if ( $wgAntiLockFlags & ALF_PRELOAD_LINKS ) {
+ $wgLinkCache->preFill( $this->mTitle );
+ $wgLinkCache->clear();
+ }
+ }
+ # Parse the text and replace links with placeholders
+ # Do this outside the locks on the links table
+ # The existence test queries need to be FOR UPDATE
+ #$oldUpdate = $wgParser->forUpdate( true );
+ $wgOut = new OutputPage();
+ $wgOut->addWikiTextWithTitle( $text, $this->mTitle );
+
# Select for update
$wgLinkCache->forUpdate( true );
# go wrong.
$wgOut->addWikiTextWithTitle( $text, $this->mTitle );
- # Look up the links in the DB and add them to the link cache
- $wgOut->transformBuffer( RLH_FOR_UPDATE );
+ if ( !$wgUseDumbLinkUpdate ) {
+ # Move the current links back to the second register
+ $wgLinkCache->swapRegisters();
+
+ # Get old version of link table to allow incremental link updates
+ # Lock this data now since it is needed for an update
+ $wgLinkCache->forUpdate( true );
+ $wgLinkCache->preFill( $this->mTitle );
+ # Swap this old version back into its rightful place
+ $wgLinkCache->swapRegisters();
+ }
+
if( $this->isRedirect( $text ) )
$r = 'redirect=no';
else
*/
$wgUseDumbLinkUpdate = false;
+/**
+ * Anti-lock flags - bitfield
+ * ALF_PRELOAD_LINKS
+ * Preload links during link update for save
+ * ALF_PRELOAD_EXISTENCE
+ * Preload cur_id during replaceLinkHolders
+ */
+$wgAntiLockFlags = 0;
+
/**
* Path to the GNU diff3 utility. If the file doesn't exist, edit conflicts will
* fall back to the old behaviour (no merging).
define( 'AV_VIRUS_FOUND', 1 ); #virus found!
define( 'AV_SCAN_ABORTED', -1 ); #scan aborted, the file is probably imune
define( 'AV_SCAN_FAILED', false ); #scan failed (scanner not found or error in scanner)
+/**#@-*/
+/**#@+
+ * Anti-lock flags
+ * See DefaultSettings.php for a description
+ */
+define( 'ALF_PRELOAD_LINKS', 1 );
+define( 'ALF_PRELOAD_EXISTENCE', 2 );
+define( 'ALF_NO_LINK_LOCK', 4 );
/**#@-*/
?>
}
function addLinkObj( &$nt ) {
- global $wgMemc, $wgLinkCacheMemcached;
+ global $wgMemc, $wgLinkCacheMemcached, $wgAntiLockFlags;
$title = $nt->getPrefixedDBkey();
if ( $this->isBadLink( $title ) ) { return 0; }
$id = $this->getGoodLinkID( $title );
if( ! is_integer( $id ) ) {
if ( $this->mForUpdate ) {
$db =& wfGetDB( DB_MASTER );
- $options = array( 'FOR UPDATE' );
+ if ( !( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) ) {
+ $options = array( 'FOR UPDATE' );
+ }
} else {
$db =& wfGetDB( DB_SLAVE );
$options = array();