Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/79042
Change subject: Purge page cache for every AFTv5 protection change
......................................................................
Purge page cache for every AFTv5 protection change
Visibility of AFTv5 form is (in part) defined via page_restrictions.
This restriction level will be exposed to JS (ConfigVars); purging the cache
when this level changes makes sure the value exposed is always up-to-date.
Cache was already being purged, but only when restriction level was changed via
API call to ApiSetStatusArticleFeedbackv5. The restriction level can also be
changed via the hook in ?action=protect (in which case this purge was not being
performed).
Change-Id: I6bbec60f42a7aa21f691e175b963bab794387055
---
M ArticleFeedbackv5.permissions.php
M api/ApiSetStatusArticleFeedbackv5.php
2 files changed, 8 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticleFeedbackv5
refs/changes/42/79042/1
diff --git a/ArticleFeedbackv5.permissions.php
b/ArticleFeedbackv5.permissions.php
index 9d73372..4dcb309 100644
--- a/ArticleFeedbackv5.permissions.php
+++ b/ArticleFeedbackv5.permissions.php
@@ -184,8 +184,9 @@
return false;
}
- // make sure an articleId was passed
- if ( !$articleId ) {
+ // make sure a valid articleId was passed
+ $pageObj = WikiPage::newFromID( $articleId );
+ if ( !$pageObj ) {
return false;
}
@@ -231,6 +232,11 @@
);
}
+ // purge page's cache, to accurately expose updated changes to
JS
+ if ( $dbw->affectedRows() > 0 ) {
+ $pageObj->doPurge();
+ }
+
return true;
}
diff --git a/api/ApiSetStatusArticleFeedbackv5.php
b/api/ApiSetStatusArticleFeedbackv5.php
index da8d43b..fe57052 100644
--- a/api/ApiSetStatusArticleFeedbackv5.php
+++ b/api/ApiSetStatusArticleFeedbackv5.php
@@ -75,9 +75,6 @@
$expiry
);
- // purge page's cache, to accurately expose updated
changes to JS
- $pageObj->doPurge();
-
if ( !$success ) {
$this->dieUsage(
$this->msg(
'articlefeedbackv5-error-unknown' )->escaped(),
--
To view, visit https://gerrit.wikimedia.org/r/79042
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6bbec60f42a7aa21f691e175b963bab794387055
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ArticleFeedbackv5
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits