Parent5446 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59848
Change subject: Fixed behavior of Title::invalidateCache.
......................................................................
Fixed behavior of Title::invalidateCache.
Removed actions that should not be in Title::invalidateCache,
specifically the clearing of the InfoAction cache, and added
those actions to their appropriate locations.
Added a new method InfoAction::invalidateCache that clears the
cache for a given title.
Bug: 46816
Change-Id: I38ac616d2e99fb339aca33425745368ba85b6350
---
M includes/Title.php
M includes/WikiPage.php
M includes/actions/InfoAction.php
M includes/job/jobs/RefreshLinksJob.php
4 files changed, 20 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/48/59848/1
diff --git a/includes/Title.php b/includes/Title.php
index d0ac97b..7101979 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -4531,18 +4531,8 @@
__METHOD__
);
} );
- HTMLFileCache::clearFileCache( $this );
- // Clear page info.
- $revision = WikiPage::factory( $this )->getRevision();
- if ( $revision !== null ) {
- $memcKey = wfMemcKey( 'infoaction',
$this->getPrefixedText(), $revision->getId() );
- $success = $wgMemc->delete( $memcKey );
- } else {
- $success = true;
- }
-
- return $success;
+ return true;
}
/**
diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 3f7e497..36e583b 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -2437,6 +2437,7 @@
}
$this->mTitle->flushRestrictions();
+ InfoAction::invalidateCache( $this->mTitle );
if ( $logAction == 'unprotect' ) {
$logParams = array();
@@ -2907,6 +2908,7 @@
// File cache
HTMLFileCache::clearFileCache( $title );
+ InfoAction::invalidateCache( $title );
// Messages
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
@@ -2949,6 +2951,7 @@
// Clear file cache for this page only
HTMLFileCache::clearFileCache( $title );
+ InfoAction::invalidateCache( $title );
}
/**#@-*/
diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index 55fa108..8a0eff4 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -56,6 +56,21 @@
}
/**
+ * Clear the info cache for a given Title.
+ *
+ * @since 1.22
+ * @param Title $title Title to clear cache for
+ */
+ public static function invalidateCache( Title $title ) {
+ // Clear page info.
+ $revision = WikiPage::factory( $title )->getRevision();
+ if ( $revision !== null ) {
+ $memcKey = wfMemcKey( 'infoaction',
$this->getPrefixedText(), $revision->getId() );
+ $wgMemc->delete( $memcKey );
+ }
+ }
+
+ /**
* Shows page information on GET request.
*
* @return string Page information that will be added to the output
diff --git a/includes/job/jobs/RefreshLinksJob.php
b/includes/job/jobs/RefreshLinksJob.php
index 9dbe827..d8c71b5 100644
--- a/includes/job/jobs/RefreshLinksJob.php
+++ b/includes/job/jobs/RefreshLinksJob.php
@@ -64,6 +64,7 @@
}
self::runForTitleInternal( $this->title, $revision, __METHOD__
);
+ InfoAction::invalidateCache( $this->title );
wfProfileOut( __METHOD__ );
return true;
--
To view, visit https://gerrit.wikimedia.org/r/59848
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38ac616d2e99fb339aca33425745368ba85b6350
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits