From c6a4e7c1315fe187d234927597174a6d16ddf703 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 6 Oct 2015 13:31:31 -0700 Subject: [PATCH] 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 --- includes/Title.php | 7 ++----- includes/filerepo/file/File.php | 3 +-- includes/page/WikiFilePage.php | 3 +-- includes/page/WikiPage.php | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) 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 -- 2.20.1