* @param $page Page
*/
private function performAction( Page $page ) {
+ global $wgUseSquid, $wgSquidMaxage;
+
wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
$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;
* Print the history page for an article.
*/
function onView() {
- global $wgScript, $wgUseFileCache, $wgSquidMaxage;
+ global $wgScript, $wgUseFileCache;
$out = $this->getOutput();
$request = $this->getRequest();
wfProfileIn( __METHOD__ );
- if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL( 'action=history' ) ) {
- $out->setSquidMaxage( $wgSquidMaxage );
- }
-
$this->preCacheMessages();
# Fill in the file cache if not set already
}
public function show(){
- global $wgSquidMaxage;
-
- $request = $this->getRequest();
- if ( $request->getFullRequestURL() == $this->getTitle()->getInternalURL() ) {
- $this->getOutput()->setSquidMaxage( $wgSquidMaxage );
- }
-
$this->page->view();
}