1<?php 2/** 3 * DokuWiki Plugin webdavclient (Action Component) 4 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 5 * @author Andreas Böhler <dev@aboehler.at> 6 */ 7 8// must be run within Dokuwiki 9if(!defined('DOKU_INC')) die(); 10 11class action_plugin_webdavclient extends DokuWiki_Action_Plugin { 12 13 protected $hlp = null; 14 15 // Load the helper plugin 16 public function action_plugin_webdavclient() { 17 18 $this->hlp =& plugin_load('helper', 'webdavclient'); 19 20 } 21 22 // Register our hooks 23 function register(Doku_Event_Handler $controller) { 24 $controller->register_hook('INDEXER_TASKS_RUN', 'BEFORE', $this, 'handle_indexer_sync'); 25 //$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_indexer_sync'); 26 } 27 28 function handle_indexer_sync(&$event, $param) 29 { 30 // Check if we use an external CRON or WebCRON instead 31 if($this->getConf('use_cron') === 1) 32 return; 33 34 // Try to sync the connectins; if one connection synced successfully, 35 // we stop the propagation 36 if($this->hlp->indexerSyncAllConnections() === true) 37 { 38 $event->preventDefault(); 39 $event->stopPropagation(); 40 } 41 } 42} 43