1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
25 | { |
---|
26 | die ("Hacking attempt!"); |
---|
27 | } |
---|
28 | |
---|
29 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
30 | |
---|
31 | // +-----------------------------------------------------------------------+ |
---|
32 | // | Check Access and exit when user status is not ok | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | check_status(ACCESS_ADMINISTRATOR); |
---|
35 | |
---|
36 | // +-----------------------------------------------------------------------+ |
---|
37 | // | actions | |
---|
38 | // +-----------------------------------------------------------------------+ |
---|
39 | |
---|
40 | $action = isset($_GET['action']) ? $_GET['action'] : ''; |
---|
41 | |
---|
42 | switch ($action) |
---|
43 | { |
---|
44 | case 'categories' : |
---|
45 | { |
---|
46 | update_uppercats(); |
---|
47 | update_category('all'); |
---|
48 | update_global_rank(); |
---|
49 | invalidate_user_cache(true); |
---|
50 | break; |
---|
51 | } |
---|
52 | case 'images' : |
---|
53 | { |
---|
54 | update_path(); |
---|
55 | update_average_rate(); |
---|
56 | break; |
---|
57 | } |
---|
58 | case 'history_detail' : |
---|
59 | { |
---|
60 | $query = ' |
---|
61 | DELETE |
---|
62 | FROM '.HISTORY_TABLE.' |
---|
63 | ;'; |
---|
64 | pwg_query($query); |
---|
65 | break; |
---|
66 | } |
---|
67 | case 'history_summary' : |
---|
68 | { |
---|
69 | $query = ' |
---|
70 | DELETE |
---|
71 | FROM '.HISTORY_SUMMARY_TABLE.' |
---|
72 | ;'; |
---|
73 | pwg_query($query); |
---|
74 | break; |
---|
75 | } |
---|
76 | case 'sessions' : |
---|
77 | { |
---|
78 | pwg_session_gc(); |
---|
79 | break; |
---|
80 | } |
---|
81 | case 'feeds' : |
---|
82 | { |
---|
83 | $query = ' |
---|
84 | DELETE |
---|
85 | FROM '.USER_FEED_TABLE.' |
---|
86 | WHERE last_check IS NULL |
---|
87 | ;'; |
---|
88 | pwg_query($query); |
---|
89 | break; |
---|
90 | } |
---|
91 | case 'database' : |
---|
92 | { |
---|
93 | do_maintenance_all_tables(); |
---|
94 | break; |
---|
95 | } |
---|
96 | case 'c13y' : |
---|
97 | { |
---|
98 | include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php'); |
---|
99 | $c13y = new check_integrity(); |
---|
100 | $c13y->maintenance(); |
---|
101 | break; |
---|
102 | } |
---|
103 | case 'search' : |
---|
104 | { |
---|
105 | $query = ' |
---|
106 | DELETE |
---|
107 | FROM '.SEARCH_TABLE.' |
---|
108 | ;'; |
---|
109 | pwg_query($query); |
---|
110 | break; |
---|
111 | } |
---|
112 | case 'compiled-templates' : |
---|
113 | { |
---|
114 | $template->delete_compiled_templates(); |
---|
115 | break; |
---|
116 | } |
---|
117 | default : |
---|
118 | { |
---|
119 | break; |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | // +-----------------------------------------------------------------------+ |
---|
124 | // | template init | |
---|
125 | // +-----------------------------------------------------------------------+ |
---|
126 | |
---|
127 | $template->set_filenames(array('maintenance'=>'maintenance.tpl')); |
---|
128 | |
---|
129 | $start_url = get_root_url().'admin.php?page=maintenance&action='; |
---|
130 | |
---|
131 | $template->assign( |
---|
132 | array( |
---|
133 | 'U_MAINT_CATEGORIES' => $start_url.'categories', |
---|
134 | 'U_MAINT_IMAGES' => $start_url.'images', |
---|
135 | 'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail', |
---|
136 | 'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary', |
---|
137 | 'U_MAINT_SESSIONS' => $start_url.'sessions', |
---|
138 | 'U_MAINT_FEEDS' => $start_url.'feeds', |
---|
139 | 'U_MAINT_DATABASE' => $start_url.'database', |
---|
140 | 'U_MAINT_C13Y' => $start_url.'c13y', |
---|
141 | 'U_MAINT_SEARCH' => $start_url.'search', |
---|
142 | 'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates', |
---|
143 | 'U_HELP' => get_root_url().'admin/popuphelp.php?page=maintenance', |
---|
144 | ) |
---|
145 | ); |
---|
146 | |
---|
147 | // +-----------------------------------------------------------------------+ |
---|
148 | // | Define advanced features | |
---|
149 | // +-----------------------------------------------------------------------+ |
---|
150 | |
---|
151 | $advanced_features = array(); |
---|
152 | |
---|
153 | array_push( |
---|
154 | $advanced_features, |
---|
155 | array( |
---|
156 | 'CAPTION' => l10n('Not linked elements'), |
---|
157 | 'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked' |
---|
158 | ) |
---|
159 | ); |
---|
160 | |
---|
161 | array_push( |
---|
162 | $advanced_features, |
---|
163 | array( |
---|
164 | 'CAPTION' => l10n('Files with same name in more than one physical album'), |
---|
165 | 'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates' |
---|
166 | ) |
---|
167 | ); |
---|
168 | |
---|
169 | //$advanced_features is array of array composed of CAPTION & URL |
---|
170 | $advanced_features = trigger_event( |
---|
171 | 'get_admin_advanced_features_links', |
---|
172 | $advanced_features |
---|
173 | ); |
---|
174 | |
---|
175 | $template->assign('advanced_features', $advanced_features); |
---|
176 | |
---|
177 | // +-----------------------------------------------------------------------+ |
---|
178 | // | sending html code | |
---|
179 | // +-----------------------------------------------------------------------+ |
---|
180 | |
---|
181 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
182 | ?> |
---|