1<?php
2
3/**
4 * Class remote_plugin_confmanager
5 */
6class remote_plugin_confmanager extends DokuWiki_Remote_Plugin {
7
8    /**
9     * @var helper_plugin_confmanager
10     */
11    private $helper;
12
13    /**
14     * Constructor
15     */
16    public function __construct() {
17        parent::__construct();
18
19        $this->helper = $this->loadHelper('confmanager', null);
20    }
21
22    /**
23     * Get all available methods with remote access.
24     *
25     * @return array Information about all provided methods.
26     */
27    public function _getMethods() {
28        return array(
29            'getConfigs' => array(
30                'args' => array(),
31                'return' => 'array'
32            )
33        );
34    }
35
36    /**
37     * @return mixed
38     * @throws RemoteAccessDeniedException
39     */
40    public function getConfigs() {
41        $this->ensureAdmin();
42        $this->helper->getConfigFiles();
43        return $this->getApi()->toDate(time());
44    }
45
46    private function ensureAdmin() {
47        if (!auth_isadmin()) {
48            throw new RemoteAccessDeniedException();
49        }
50    }
51}
52