*/ if(!defined('DOKU_INC')) die(); class action_plugin_davcard_cache extends DokuWiki_Action_Plugin { function __construct() { } function register(Doku_Event_Handler $controller) { $controller->register_hook('PARSER_CACHE_USE', 'BEFORE', $this, 'handle_parser_cache_use'); } function handle_parser_cache_use(Doku_Event $event, $param) { $cache = &$event->data; if(!isset($cache->page)) return; //purge only xhtml cache if($cache->mode != "xhtml") return; $meta = p_get_metadata($cache->page, 'plugin_davcard'); if($meta === null) return; // Force re-caching if the webdavclient has synced if(isset($meta['webdavclient'])) { $wdc =& plugin_load('helper', 'webdavclient'); if(is_null($wdc)) return; foreach($meta['webdavclient'] as $connectionId) { $cache->depends['files'][] = $wdc->getLastSyncChangeFileForConnection($connectionId); } } // Disable caching if there is a tabular addressbook if(isset($meta['addressbooks']) && in_array($cache->page, $meta['addressbooks']['id'])) { $event->preventDefault(); $event->stopPropagation(); $event->result = false; } } }