1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008 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']) and !is_adviser()) ? $_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 'compiled-templates' : |
---|
104 | { |
---|
105 | $template->delete_compiled_templates(); |
---|
106 | break; |
---|
107 | } |
---|
108 | default : |
---|
109 | { |
---|
110 | break; |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | // +-----------------------------------------------------------------------+ |
---|
115 | // | template init | |
---|
116 | // +-----------------------------------------------------------------------+ |
---|
117 | |
---|
118 | $template->set_filenames(array('maintenance'=>'maintenance.tpl')); |
---|
119 | |
---|
120 | $start_url = get_root_url().'admin.php?page=maintenance&action='; |
---|
121 | |
---|
122 | $template->assign( |
---|
123 | array( |
---|
124 | 'U_MAINT_CATEGORIES' => $start_url.'categories', |
---|
125 | 'U_MAINT_IMAGES' => $start_url.'images', |
---|
126 | 'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail', |
---|
127 | 'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary', |
---|
128 | 'U_MAINT_SESSIONS' => $start_url.'sessions', |
---|
129 | 'U_MAINT_FEEDS' => $start_url.'feeds', |
---|
130 | 'U_MAINT_DATABASE' => $start_url.'database', |
---|
131 | 'U_MAINT_C13Y' => $start_url.'c13y', |
---|
132 | 'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates', |
---|
133 | 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance', |
---|
134 | ) |
---|
135 | ); |
---|
136 | |
---|
137 | // +-----------------------------------------------------------------------+ |
---|
138 | // | sending html code | |
---|
139 | // +-----------------------------------------------------------------------+ |
---|
140 | |
---|
141 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
142 | ?> |
---|