aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2012-06-05 20:51:00 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2012-06-05 20:51:00 +0000
commitd96161d71abfc9935a1c98c04e8366545fcd8937 (patch)
tree4572ab374b5875f0f966c201e050bb4921cdf41e /includes
parent612185643ccf6fcb00642e79eeb9f40092b36961 (diff)
parent6eac0a40cf8b0922f89697ad038346e0a68a0eda (diff)
downloadmediawikicore-d96161d71abfc9935a1c98c04e8366545fcd8937.tar.gz
mediawikicore-d96161d71abfc9935a1c98c04e8366545fcd8937.zip
Merge "setSquidMaxage() globally if we can purge it, instead of in actions."
Diffstat (limited to 'includes')
-rw-r--r--includes/Wiki.php11
-rw-r--r--includes/actions/HistoryAction.php6
-rw-r--r--includes/actions/ViewAction.php7
3 files changed, 12 insertions, 12 deletions
diff --git a/includes/Wiki.php b/includes/Wiki.php
index b20cb958378b..08e06eae3139 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -462,6 +462,8 @@ class MediaWiki {
* @param $page Page
*/
private function performAction( Page $page ) {
+ global $wgUseSquid, $wgSquidMaxage;
+
wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
@@ -480,6 +482,15 @@ class MediaWiki {
$action = Action::factory( $act, $page );
if ( $action instanceof Action ) {
+ # When it's a known action, let Squid cache things if we can purge them.
+ # If the action is unknown, we don't know what may happen in an extension,
+ # but not caching can be always safe.
+ if ( $wgUseSquid &&
+ in_array( $request->getFullRequestURL(), $title->getSquidURLs() )
+ ) {
+ $output->setSquidMaxage( $wgSquidMaxage );
+ }
+
$action->show();
wfProfileOut( __METHOD__ );
return;
diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php
index 8e6bcd9529ad..94bf50ce9401 100644
--- a/includes/actions/HistoryAction.php
+++ b/includes/actions/HistoryAction.php
@@ -87,7 +87,7 @@ class HistoryAction extends FormlessAction {
* Print the history page for an article.
*/
function onView() {
- global $wgScript, $wgUseFileCache, $wgSquidMaxage;
+ global $wgScript, $wgUseFileCache;
$out = $this->getOutput();
$request = $this->getRequest();
@@ -101,10 +101,6 @@ class HistoryAction extends FormlessAction {
wfProfileIn( __METHOD__ );
- if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL( 'action=history' ) ) {
- $out->setSquidMaxage( $wgSquidMaxage );
- }
-
$this->preCacheMessages();
# Fill in the file cache if not set already
diff --git a/includes/actions/ViewAction.php b/includes/actions/ViewAction.php
index d43e5fb3bbc2..d57585ee1f52 100644
--- a/includes/actions/ViewAction.php
+++ b/includes/actions/ViewAction.php
@@ -34,13 +34,6 @@ class ViewAction extends FormlessAction {
}
public function show(){
- global $wgSquidMaxage;
-
- $request = $this->getRequest();
- if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL() ) {
- $this->getOutput()->setSquidMaxage( $wgSquidMaxage );
- }
-
$this->page->view();
}