diff options
Diffstat (limited to 'SemanticMediaWiki/includes/src/MediaWiki/Hooks/ArticlePurge.php')
-rw-r--r-- | SemanticMediaWiki/includes/src/MediaWiki/Hooks/ArticlePurge.php | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/SemanticMediaWiki/includes/src/MediaWiki/Hooks/ArticlePurge.php b/SemanticMediaWiki/includes/src/MediaWiki/Hooks/ArticlePurge.php deleted file mode 100644 index 65581464..00000000 --- a/SemanticMediaWiki/includes/src/MediaWiki/Hooks/ArticlePurge.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -namespace SMW\MediaWiki\Hooks; - -use SMW\FactboxCache; -use SMW\Application; -use SMW\CacheIdGenerator; - -use WikiPage; - -/** - * A function hook being executed before running "&action=purge" - * - * A temporary cache entry is created to mark and identify the - * Article that has been purged. - * - * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticlePurge - * - * @ingroup FunctionHook - * - * @license GNU GPL v2+ - * @since 1.9 - * - * @author mwjames - */ -class ArticlePurge { - - /** - * @var WikiPage - */ - protected $wikiPage = null; - - /** - * @since 1.9 - * - * @param WikiPage $wikiPage - */ - public function __construct( WikiPage &$wikiPage ) { - $this->wikiPage = $wikiPage; - } - - /** - * @since 1.9 - * - * @return CacheIdGenerator - */ - public static function newCacheId( $pageId ) { - return new CacheIdGenerator( $pageId, 'autorefresh' ); - } - - /** - * @see FunctionHook::process - * - * @since 1.9 - * - * @return true - */ - public function process() { - - $pageId = $this->wikiPage->getTitle()->getArticleID(); - - /** - * @var Settings $settings - */ - $settings = Application::getInstance()->getSettings(); - - /** - * @var CacheHandler $cache - */ - $cache = Application::getInstance()->getCache(); - - $cache->setCacheEnabled( $pageId > 0 ) - ->setKey( $this->newCacheId( $pageId ) ) - ->set( $settings->get( 'smwgAutoRefreshOnPurge' ) ); - - $cache->setCacheEnabled( $settings->get( 'smwgFactboxCacheRefreshOnPurge' ) ) - ->setKey( FactboxCache::newCacheId( $pageId ) ) - ->delete(); - - return true; - } - -} |