Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344737 )

Change subject: WikiPage: Remove unused doPurge flags
......................................................................

WikiPage: Remove unused doPurge flags

The only callsites that use this argument are PurgeAction and
ApiPurge, both of which always use the default PURGE_ALL.

The flags were originally introduced in c84ba4d86 to accomodate
lightweight use of action=purge over GET instead of POST, which
would only do the CDN purge, not the more expensive parser cache
invalidation by bumping page_touched in the database.

However, lightweight purge over GET has since been deprecated
and removed in eada9409099 (T145649) and other commits.

Change-Id: If8db483742f88c9fffcf98d0f7a82e84aab237b4
---
M includes/actions/PurgeAction.php
M includes/api/ApiPurge.php
M includes/page/Article.php
M includes/page/WikiFilePage.php
M includes/page/WikiPage.php
5 files changed, 16 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/344737/1

diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php
index 942b731..b2002ff 100644
--- a/includes/actions/PurgeAction.php
+++ b/includes/actions/PurgeAction.php
@@ -42,7 +42,7 @@
        }
 
        public function onSubmit( $data ) {
-               return $this->page->doPurge( WikiPage::PURGE_ALL );
+               return $this->page->doPurge();
        }
 
        public function show() {
diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 3124638..407497e 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -56,7 +56,7 @@
                        $page = WikiPage::factory( $title );
                        if ( !$user->pingLimiter( 'purge' ) ) {
                                // Directly purge and skip the UI part of 
purge()
-                               $page->doPurge( WikiPage::PURGE_ALL );
+                               $page->doPurge();
                                $r['purged'] = true;
                        } else {
                                $this->addWarning( 'apierror-ratelimited' );
diff --git a/includes/page/Article.php b/includes/page/Article.php
index cb97126..d56addc 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -2044,8 +2044,8 @@
         * Call to WikiPage function for backwards compatibility.
         * @see WikiPage::doPurge
         */
-       public function doPurge( $flags = WikiPage::PURGE_ALL ) {
-               return $this->mPage->doPurge( $flags );
+       public function doPurge() {
+               return $this->mPage->doPurge();
        }
 
        /**
diff --git a/includes/page/WikiFilePage.php b/includes/page/WikiFilePage.php
index e4b524b..d02cca8 100644
--- a/includes/page/WikiFilePage.php
+++ b/includes/page/WikiFilePage.php
@@ -164,7 +164,7 @@
                return $this->mDupes;
        }
 
-       public function doPurge( $flags = self::PURGE_ALL ) {
+       public function doPurge() {
                $this->loadFile();
 
                if ( $this->mFile->exists() ) {
@@ -183,7 +183,7 @@
                        $this->mRepo->invalidateImageRedirect( $this->mTitle );
                }
 
-               return parent::doPurge( $flags );
+               return parent::doPurge();
        }
 
        /**
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 4bc8ad6..7afb4ba 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -84,11 +84,6 @@
         */
        protected $mLinksUpdated = '19700101000000';
 
-       const PURGE_CDN_CACHE = 1; // purge CDN cache for page variant URLs
-       const PURGE_CLUSTER_PCACHE = 2; // purge parser cache in the local 
datacenter
-       const PURGE_GLOBAL_PCACHE = 4; // set page_touched to clear parser 
cache in all datacenters
-       const PURGE_ALL = 7;
-
        /**
         * Constructor and clear the article
         * @param Title $title Reference to a Title object.
@@ -1119,10 +1114,9 @@
 
        /**
         * Perform the actions of a page purging
-        * @param integer $flags Bitfield of WikiPage::PURGE_* constants
         * @return bool
         */
-       public function doPurge( $flags = self::PURGE_ALL ) {
+       public function doPurge() {
                // Avoid PHP 7.1 warning of passing $this by reference
                $wikiPage = $this;
 
@@ -1130,30 +1124,16 @@
                        return false;
                }
 
-               if ( ( $flags & self::PURGE_GLOBAL_PCACHE ) == 
self::PURGE_GLOBAL_PCACHE ) {
-                       // Set page_touched in the database to invalidate all 
DC caches
-                       $this->mTitle->invalidateCache();
-               } elseif ( ( $flags & self::PURGE_CLUSTER_PCACHE ) == 
self::PURGE_CLUSTER_PCACHE ) {
-                       // Delete the parser options key in the local cluster 
to invalidate the DC cache
-                       ParserCache::singleton()->deleteOptionsKey( $this );
-                       // Avoid sending HTTP 304s in ViewAction to the client 
who just issued the purge
-                       $cache = ObjectCache::getLocalClusterInstance();
-                       $cache->set(
-                               $cache->makeKey( 'page', 'last-dc-purge', 
$this->getId() ),
-                               wfTimestamp( TS_MW ),
-                               $cache::TTL_HOUR
-                       );
-               }
+               // Set page_touched in the database to invalidate all DC caches
+               $this->mTitle->invalidateCache();
 
-               if ( ( $flags & self::PURGE_CDN_CACHE ) == 
self::PURGE_CDN_CACHE ) {
-                       // Clear any HTML file cache
-                       HTMLFileCache::clearFileCache( $this->getTitle() );
-                       // Send purge after any page_touched above update was 
committed
-                       DeferredUpdates::addUpdate(
-                               new CdnCacheUpdate( $this->mTitle->getCdnUrls() 
),
-                               DeferredUpdates::PRESEND
-                       );
-               }
+               // Clear any HTML file cache
+               HTMLFileCache::clearFileCache( $this->getTitle() );
+               // Send purge after any page_touched above update was committed
+               DeferredUpdates::addUpdate(
+                       new CdnCacheUpdate( $this->mTitle->getCdnUrls() ),
+                       DeferredUpdates::PRESEND
+               );
 
                if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                        $messageCache = MessageCache::singleton();

-- 
To view, visit https://gerrit.wikimedia.org/r/344737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8db483742f88c9fffcf98d0f7a82e84aab237b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to