From 5bed313c7fa49f41116da6af50ea082f46d2d591 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 25 Feb 2006 01:31:07 +0000 Subject: [PATCH] Avoid circular links updates --- includes/JobQueue.php | 2 +- includes/LinksUpdate.php | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/includes/JobQueue.php b/includes/JobQueue.php index 17ef11df75..7cd0878d11 100644 --- a/includes/JobQueue.php +++ b/includes/JobQueue.php @@ -181,7 +181,7 @@ class Job { $options = new ParserOptions; $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() ); - $update = new LinksUpdate( $this->title, $parserOutput ); + $update = new LinksUpdate( $this->title, $parserOutput, false ); $update->doUpdate(); return true; } diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index f1d217ba99..d74574e4fd 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -21,7 +21,8 @@ class LinksUpdate { $mExternals, # URLs of external links, array key only $mCategories, # Map of category names to sort keys $mDb, # Database connection reference - $mOptions; # SELECT options to be used (array) + $mOptions, # SELECT options to be used (array) + $mRecursive; # Whether to queue jobs for recursive updates /**#@-*/ /** @@ -30,7 +31,7 @@ class LinksUpdate { * @param integer $id * @param string $title */ - function LinksUpdate( $title, $parserOutput ) { + function LinksUpdate( $title, $parserOutput, $recursive = true ) { global $wgAntiLockFlags; if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) { @@ -52,6 +53,7 @@ class LinksUpdate { $this->mTemplates = $parserOutput->getTemplates(); $this->mExternals = $parserOutput->getExternalLinks(); $this->mCategories = $parserOutput->getCategories(); + $this->mRecursive = $recursive; } @@ -92,10 +94,12 @@ class LinksUpdate { $this->getTemplateInsertions( $existing ) ); # Refresh links of all pages including this page - $tlto = $this->mTitle->getTemplateLinksTo(); - if ( count( $tlto ) ) { - require_once( 'JobQueue.php' ); - Job::queueLinksJobs( $tlto ); + if ( $this->mRecursive ) { + $tlto = $this->mTitle->getTemplateLinksTo(); + if ( count( $tlto ) ) { + require_once( 'JobQueue.php' ); + Job::queueLinksJobs( $tlto ); + } } # Category links @@ -126,10 +130,12 @@ class LinksUpdate { $categoryUpdates = array_diff_assoc( $existing, $this->mCategories ) + array_diff_assoc( $this->mCategories, $existing ); # Refresh links of all pages including this page - $tlto = $this->mTitle->getTemplateLinksTo(); - if ( count( $tlto ) ) { - require_once( 'JobQueue.php' ); - Job::queueLinksJobs( $tlto ); + if ( $this->mRecursive ) { + $tlto = $this->mTitle->getTemplateLinksTo(); + if ( count( $tlto ) ) { + require_once( 'JobQueue.php' ); + Job::queueLinksJobs( $tlto ); + } } $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' ); -- 2.20.1