https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112979
Revision: 112979
Author: jeroendedauw
Date: 2012-03-04 17:13:28 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
cache html
Modified Paths:
--------------
trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
Modified: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
===================================================================
--- trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
2012-03-04 16:58:03 UTC (rev 112978)
+++ trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
2012-03-04 17:13:28 UTC (rev 112979)
@@ -32,9 +32,19 @@
public function execute( $subPage ) {
parent::execute( $subPage );
+ $cache = wfGetCache( CACHE_ANYTHING );
+ $cacheKey = wfMemcKey( get_class( $this ),
$this->getLanguage()->getCode() );
+ $cachedHTML = $cache->get( $cacheKey );
+
$out = $this->getOutput();
- $this->displaySummaryTable();
+ if ( $this->getRequest()->getText( 'action' ) !== 'purge' &&
is_string( $cachedHTML ) ) {
+ $out->addHTML( $cachedHTML );
+ }
+ else {
+ $this->displaySummaryTable();
+ $cache->set( $cacheKey, $out->getHTML(), 3600 );
+ }
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs