Dotclear

source: plugins/maintenance/_admin.php @ 1925:567a4a03e5df

Revision 1925:567a4a03e5df, 2.0 KB checked in by Denis Jean-Chirstian <contact@…>, 12 years ago (diff)

Revamp plugin maintenance, step 1, rewrite code to open it, addresses #999

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14// Sidebar menu
15$_menu['Plugins']->addItem(
16     __('Maintenance'),
17     'plugin.php?p=maintenance',
18     'index.php?pf=maintenance/icon.png',
19     preg_match('/plugin.php\?p=maintenance(&.*)?$/', $_SERVER['REQUEST_URI']),
20     $core->auth->isSuperAdmin()
21);
22
23// Admin behaviors
24$core->addBehavior('dcMaintenanceRegister', array('dcMaintenanceAdmin', 'register'));
25$core->addBehavior('adminDashboardFavs', array('dcMaintenanceAdmin', 'favs'));
26
27/**
28@ingroup PLUGIN_MAINTENANCE
29@nosubgrouping
30@brief Maintenance plugin admin class.
31
32Group of methods used on behaviors.
33*/
34class dcMaintenanceAdmin
35{
36     /**
37      * Register default tasks
38      *
39      * @param $core     <b>dcCore</b>  dcCore instance
40      * @param $tasks    <b>arrayObject</b>  Array of tasks to register
41      * @param $groups   <b>arrayObject</b>  Array of groups to register
42      */
43      public static function register($core, $tasks, $groups)
44     {
45          $groups['optimize'] = __('Optimize');
46          $groups['index'] = __('Count and index');
47          $groups['purge'] = __('Purge');
48          $groups['other'] = __('Other');
49
50          $tasks[] = 'dcMaintenanceCache';
51          $tasks[] = 'dcMaintenanceCountcomments';
52          $tasks[] = 'dcMaintenanceIndexcomments';
53          $tasks[] = 'dcMaintenanceIndexposts';
54          $tasks[] = 'dcMaintenanceLogs';
55          $tasks[] = 'dcMaintenanceVacuum';
56     }
57
58     /**
59      * Dashboard favs
60      *
61      * @param $core     <b>dcCore</b>  dcCore instance
62      * @param $favs     <b>arrayObject</b>  Array of favs
63      */
64     public static function favs($core, $favs)
65     {
66          $favs['maintenance'] = new ArrayObject(array(
67               'maintenance',
68               'Maintenance',
69               'plugin.php?p=maintenance',
70               'index.php?pf=maintenance/icon.png',
71               'index.php?pf=maintenance/icon-big.png',
72               null,null,null
73          ));
74     }
75
76     /** @todo Rminder*/
77}
Note: See TracBrowser for help on using the repository browser.

Sites map