From: Aaron Schulz Date: Tue, 6 Oct 2015 20:31:31 +0000 (-0700) Subject: Defer execution of HTMLCacheUpdate instances X-Git-Tag: 1.31.0-rc.0~9525^2 X-Git-Url: http://git.cyclocoop.org/%22.%20%20%20generer_url_action%28%22logout%22%2C%22logout=prive%22%29%20.%20%20%20%22?a=commitdiff_plain;h=c6a4e7c1315fe187d234927597174a6d16ddf703;p=lhc%2Fweb%2Fwiklou.git Defer execution of HTMLCacheUpdate instances None of these places need it to happen right now, so for performance and consistent style, defer them too. Change-Id: Id0a2a352bfc04a783c3ebc54b059b241bb6a6f7e --- diff --git a/includes/Title.php b/includes/Title.php index e2cbc8ed20..8e5fae93b9 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4418,12 +4418,9 @@ class Title { * on the number of links. Typically called on create and delete. */ public function touchLinks() { - $u = new HTMLCacheUpdate( $this, 'pagelinks' ); - $u->doUpdate(); - + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks' ) ); if ( $this->getNamespace() == NS_CATEGORY ) { - $u = new HTMLCacheUpdate( $this, 'categorylinks' ); - $u->doUpdate(); + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'categorylinks' ) ); } } diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 43d1eb5f6b..588ae6b2fd 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1430,8 +1430,7 @@ abstract class File implements IDBAccessObject { // Purge cache of all pages using this file $title = $this->getTitle(); if ( $title ) { - $update = new HTMLCacheUpdate( $title, 'imagelinks' ); - $update->doUpdate(); + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $title, 'imagelinks' ) ); } } diff --git a/includes/page/WikiFilePage.php b/includes/page/WikiFilePage.php index bfcd4c3111..c508abe389 100644 --- a/includes/page/WikiFilePage.php +++ b/includes/page/WikiFilePage.php @@ -169,8 +169,7 @@ class WikiFilePage extends WikiPage { $this->loadFile(); if ( $this->mFile->exists() ) { wfDebug( 'ImagePage::doPurge purging ' . $this->mFile->getName() . "\n" ); - $update = new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ); - $update->doUpdate(); + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ) ); $this->mFile->upgradeRow(); $this->mFile->purgeCache( array( 'forThumbRefresh' => true ) ); } else { diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 98cc80abd0..e47e06cb49 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3221,8 +3221,7 @@ class WikiPage implements Page, IDBAccessObject { // Images if ( $title->getNamespace() == NS_FILE ) { - $update = new HTMLCacheUpdate( $title, 'imagelinks' ); - $update->doUpdate(); + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $title, 'imagelinks' ) ); } // User talk pages