[809] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 5 | // | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | |
---|
[2297] | 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 | // +-----------------------------------------------------------------------+ |
---|
[809] | 23 | |
---|
| 24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 25 | { |
---|
| 26 | die ("Hacking attempt!"); |
---|
| 27 | } |
---|
| 28 | |
---|
[1072] | 29 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 30 | |
---|
[809] | 31 | // +-----------------------------------------------------------------------+ |
---|
[1072] | 32 | // | Check Access and exit when user status is not ok | |
---|
| 33 | // +-----------------------------------------------------------------------+ |
---|
[8765] | 34 | |
---|
[1072] | 35 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 36 | |
---|
[8765] | 37 | if (isset($_GET['action'])) |
---|
| 38 | { |
---|
| 39 | check_pwg_token(); |
---|
| 40 | } |
---|
| 41 | |
---|
[1072] | 42 | // +-----------------------------------------------------------------------+ |
---|
[809] | 43 | // | actions | |
---|
| 44 | // +-----------------------------------------------------------------------+ |
---|
| 45 | |
---|
[8126] | 46 | $action = isset($_GET['action']) ? $_GET['action'] : ''; |
---|
[809] | 47 | |
---|
| 48 | switch ($action) |
---|
| 49 | { |
---|
| 50 | case 'categories' : |
---|
| 51 | { |
---|
| 52 | update_uppercats(); |
---|
| 53 | update_category('all'); |
---|
| 54 | update_global_rank(); |
---|
[2890] | 55 | invalidate_user_cache(true); |
---|
[809] | 56 | break; |
---|
| 57 | } |
---|
| 58 | case 'images' : |
---|
| 59 | { |
---|
| 60 | update_path(); |
---|
[11827] | 61 | include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php'); |
---|
| 62 | update_rating_score(); |
---|
[809] | 63 | break; |
---|
| 64 | } |
---|
[8762] | 65 | case 'delete_orphan_tags' : |
---|
| 66 | { |
---|
| 67 | delete_orphan_tags(); |
---|
| 68 | break; |
---|
| 69 | } |
---|
[2062] | 70 | case 'history_detail' : |
---|
[809] | 71 | { |
---|
| 72 | $query = ' |
---|
| 73 | DELETE |
---|
[2062] | 74 | FROM '.HISTORY_TABLE.' |
---|
[1987] | 75 | ;'; |
---|
| 76 | pwg_query($query); |
---|
[2062] | 77 | break; |
---|
| 78 | } |
---|
| 79 | case 'history_summary' : |
---|
| 80 | { |
---|
[1987] | 81 | $query = ' |
---|
| 82 | DELETE |
---|
[2062] | 83 | FROM '.HISTORY_SUMMARY_TABLE.' |
---|
[809] | 84 | ;'; |
---|
| 85 | pwg_query($query); |
---|
| 86 | break; |
---|
| 87 | } |
---|
| 88 | case 'sessions' : |
---|
| 89 | { |
---|
[1080] | 90 | pwg_session_gc(); |
---|
[809] | 91 | break; |
---|
| 92 | } |
---|
[833] | 93 | case 'feeds' : |
---|
| 94 | { |
---|
| 95 | $query = ' |
---|
| 96 | DELETE |
---|
| 97 | FROM '.USER_FEED_TABLE.' |
---|
| 98 | WHERE last_check IS NULL |
---|
| 99 | ;'; |
---|
| 100 | pwg_query($query); |
---|
| 101 | break; |
---|
| 102 | } |
---|
[1111] | 103 | case 'database' : |
---|
| 104 | { |
---|
| 105 | do_maintenance_all_tables(); |
---|
| 106 | break; |
---|
| 107 | } |
---|
[2208] | 108 | case 'c13y' : |
---|
| 109 | { |
---|
[2232] | 110 | include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php'); |
---|
| 111 | $c13y = new check_integrity(); |
---|
| 112 | $c13y->maintenance(); |
---|
[2208] | 113 | break; |
---|
| 114 | } |
---|
[3517] | 115 | case 'search' : |
---|
| 116 | { |
---|
| 117 | $query = ' |
---|
| 118 | DELETE |
---|
| 119 | FROM '.SEARCH_TABLE.' |
---|
| 120 | ;'; |
---|
| 121 | pwg_query($query); |
---|
| 122 | break; |
---|
| 123 | } |
---|
[12797] | 124 | case 'compiled-templates': |
---|
[2251] | 125 | { |
---|
[2278] | 126 | $template->delete_compiled_templates(); |
---|
[8634] | 127 | FileCombiner::clear_combined_files(); |
---|
[2251] | 128 | break; |
---|
| 129 | } |
---|
[12797] | 130 | case 'derivatives': |
---|
| 131 | { |
---|
| 132 | clear_derivative_cache(); |
---|
| 133 | break; |
---|
| 134 | } |
---|
[809] | 135 | default : |
---|
| 136 | { |
---|
| 137 | break; |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | // +-----------------------------------------------------------------------+ |
---|
| 142 | // | template init | |
---|
| 143 | // +-----------------------------------------------------------------------+ |
---|
| 144 | |
---|
[2530] | 145 | $template->set_filenames(array('maintenance'=>'maintenance.tpl')); |
---|
[809] | 146 | |
---|
[8765] | 147 | $url_format = get_root_url().'admin.php?page=maintenance&action=%s&pwg_token='.get_pwg_token(); |
---|
[809] | 148 | |
---|
[2251] | 149 | $template->assign( |
---|
[1111] | 150 | array( |
---|
[8765] | 151 | 'U_MAINT_CATEGORIES' => sprintf($url_format, 'categories'), |
---|
| 152 | 'U_MAINT_IMAGES' => sprintf($url_format, 'images'), |
---|
| 153 | 'U_MAINT_ORPHAN_TAGS' => sprintf($url_format, 'delete_orphan_tags'), |
---|
| 154 | 'U_MAINT_HISTORY_DETAIL' => sprintf($url_format, 'history_detail'), |
---|
| 155 | 'U_MAINT_HISTORY_SUMMARY' => sprintf($url_format, 'history_summary'), |
---|
| 156 | 'U_MAINT_SESSIONS' => sprintf($url_format, 'sessions'), |
---|
| 157 | 'U_MAINT_FEEDS' => sprintf($url_format, 'feeds'), |
---|
| 158 | 'U_MAINT_DATABASE' => sprintf($url_format, 'database'), |
---|
| 159 | 'U_MAINT_C13Y' => sprintf($url_format, 'c13y'), |
---|
| 160 | 'U_MAINT_SEARCH' => sprintf($url_format, 'search'), |
---|
| 161 | 'U_MAINT_COMPILED_TEMPLATES' => sprintf($url_format, 'compiled-templates'), |
---|
[12797] | 162 | 'U_MAINT_DERIVATIVES' => sprintf($url_format, 'derivatives'), |
---|
[5920] | 163 | 'U_HELP' => get_root_url().'admin/popuphelp.php?page=maintenance', |
---|
[1111] | 164 | ) |
---|
| 165 | ); |
---|
[1080] | 166 | |
---|
[809] | 167 | // +-----------------------------------------------------------------------+ |
---|
[5745] | 168 | // | Define advanced features | |
---|
| 169 | // +-----------------------------------------------------------------------+ |
---|
| 170 | |
---|
| 171 | $advanced_features = array(); |
---|
| 172 | |
---|
| 173 | //$advanced_features is array of array composed of CAPTION & URL |
---|
| 174 | $advanced_features = trigger_event( |
---|
| 175 | 'get_admin_advanced_features_links', |
---|
| 176 | $advanced_features |
---|
| 177 | ); |
---|
| 178 | |
---|
| 179 | $template->assign('advanced_features', $advanced_features); |
---|
| 180 | |
---|
| 181 | // +-----------------------------------------------------------------------+ |
---|
[809] | 182 | // | sending html code | |
---|
| 183 | // +-----------------------------------------------------------------------+ |
---|
| 184 | |
---|
| 185 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
| 186 | ?> |
---|