1<?php
2
3// must be run within Dokuwiki
4if (!defined('DOKU_INC')) die();
5
6if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
7if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
8if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
9
10require_once DOKU_PLUGIN . 'admin.php';
11
12class admin_plugin_stale extends DokuWiki_Admin_Plugin
13{
14
15    /**
16     * @var string
17     */
18    private $msg;
19
20    public function getMenuSort()
21    {
22        return 13;
23    }
24
25    public function forAdminOnly()
26    {
27        return $this->getConf(helper_plugin_stale::CONF_ADMIN_ONLY);
28    }
29
30    public function getMenuIcon()
31    {
32        /** @var helper_plugin_stale $stale */
33        $stale = plugin_load('helper', 'stale');
34        return $stale->getIcon();
35    }
36
37
38    public function handle()
39    {
40
41        /** @var helper_plugin_stale $stale */
42        $stale = plugin_load('helper', 'stale');
43
44
45        $reason = $stale->canTouch();
46        if ($reason !== true) {
47            msg('Plugin stale: You can\'t touch the file for the following reason: ' . $reason, -1);
48            return false;
49        }
50
51        $this->msg = $stale->stale();
52
53        return true;
54    }
55
56    public function html()
57    {
58        ptln('<h1>' . $this->getLang('h1') . '</h1>');
59        ptln("<p>$this->msg</p>");
60    }
61}
62
63