[809] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | PhpWebGallery - a PHP based picture gallery | |
---|
| 4 | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
---|
[1987] | 5 | // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | |
---|
[809] | 6 | // +-----------------------------------------------------------------------+ |
---|
[1987] | 7 | // | file : $Id: maintenance.php 2062 2007-07-10 22:00:36Z rvelices $ |
---|
[809] | 8 | // | last update : $Date: 2007-07-10 22:00:36 +0000 (Tue, 10 Jul 2007) $ |
---|
| 9 | // | last modifier : $Author: rvelices $ |
---|
| 10 | // | revision : $Revision: 2062 $ |
---|
| 11 | // +-----------------------------------------------------------------------+ |
---|
| 12 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 13 | // | it under the terms of the GNU General Public License as published by | |
---|
| 14 | // | the Free Software Foundation | |
---|
| 15 | // | | |
---|
| 16 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 17 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 18 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 19 | // | General Public License for more details. | |
---|
| 20 | // | | |
---|
| 21 | // | You should have received a copy of the GNU General Public License | |
---|
| 22 | // | along with this program; if not, write to the Free Software | |
---|
| 23 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 24 | // | USA. | |
---|
| 25 | // +-----------------------------------------------------------------------+ |
---|
| 26 | |
---|
| 27 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 28 | { |
---|
| 29 | die ("Hacking attempt!"); |
---|
| 30 | } |
---|
| 31 | |
---|
[1072] | 32 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 33 | |
---|
[809] | 34 | // +-----------------------------------------------------------------------+ |
---|
[1072] | 35 | // | Check Access and exit when user status is not ok | |
---|
| 36 | // +-----------------------------------------------------------------------+ |
---|
| 37 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 38 | |
---|
| 39 | // +-----------------------------------------------------------------------+ |
---|
[809] | 40 | // | actions | |
---|
| 41 | // +-----------------------------------------------------------------------+ |
---|
| 42 | |
---|
[1111] | 43 | $action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : ''; |
---|
[809] | 44 | |
---|
| 45 | switch ($action) |
---|
| 46 | { |
---|
| 47 | case 'categories' : |
---|
| 48 | { |
---|
| 49 | update_uppercats(); |
---|
| 50 | update_category('all'); |
---|
| 51 | ordering(); |
---|
| 52 | update_global_rank(); |
---|
[1981] | 53 | invalidate_user_cache(); |
---|
[809] | 54 | break; |
---|
| 55 | } |
---|
| 56 | case 'images' : |
---|
| 57 | { |
---|
| 58 | update_path(); |
---|
| 59 | update_average_rate(); |
---|
| 60 | break; |
---|
| 61 | } |
---|
[2062] | 62 | case 'history_detail' : |
---|
[809] | 63 | { |
---|
| 64 | $query = ' |
---|
| 65 | DELETE |
---|
[2062] | 66 | FROM '.HISTORY_TABLE.' |
---|
[1987] | 67 | ;'; |
---|
| 68 | pwg_query($query); |
---|
[2062] | 69 | break; |
---|
| 70 | } |
---|
| 71 | case 'history_summary' : |
---|
| 72 | { |
---|
[1987] | 73 | $query = ' |
---|
| 74 | DELETE |
---|
[2062] | 75 | FROM '.HISTORY_SUMMARY_TABLE.' |
---|
[809] | 76 | ;'; |
---|
| 77 | pwg_query($query); |
---|
| 78 | break; |
---|
| 79 | } |
---|
| 80 | case 'sessions' : |
---|
| 81 | { |
---|
[1080] | 82 | pwg_session_gc(); |
---|
[809] | 83 | break; |
---|
| 84 | } |
---|
[833] | 85 | case 'feeds' : |
---|
| 86 | { |
---|
| 87 | $query = ' |
---|
| 88 | DELETE |
---|
| 89 | FROM '.USER_FEED_TABLE.' |
---|
| 90 | WHERE last_check IS NULL |
---|
| 91 | ;'; |
---|
| 92 | pwg_query($query); |
---|
| 93 | break; |
---|
| 94 | } |
---|
[1111] | 95 | case 'database' : |
---|
| 96 | { |
---|
| 97 | do_maintenance_all_tables(); |
---|
| 98 | break; |
---|
| 99 | } |
---|
[809] | 100 | default : |
---|
| 101 | { |
---|
| 102 | break; |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | // +-----------------------------------------------------------------------+ |
---|
| 107 | // | template init | |
---|
| 108 | // +-----------------------------------------------------------------------+ |
---|
| 109 | |
---|
| 110 | $template->set_filenames(array('maintenance'=>'admin/maintenance.tpl')); |
---|
| 111 | |
---|
| 112 | $start_url = PHPWG_ROOT_PATH.'admin.php?page=maintenance&action='; |
---|
| 113 | |
---|
[1111] | 114 | $template->assign_vars( |
---|
| 115 | array( |
---|
| 116 | 'U_MAINT_CATEGORIES' => $start_url.'categories', |
---|
| 117 | 'U_MAINT_IMAGES' => $start_url.'images', |
---|
[2062] | 118 | 'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail', |
---|
| 119 | 'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary', |
---|
[1111] | 120 | 'U_MAINT_SESSIONS' => $start_url.'sessions', |
---|
| 121 | 'U_MAINT_FEEDS' => $start_url.'feeds', |
---|
| 122 | 'U_MAINT_DATABASE' => $start_url.'database', |
---|
[1250] | 123 | 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance', |
---|
[1111] | 124 | ) |
---|
| 125 | ); |
---|
[1080] | 126 | |
---|
[809] | 127 | // +-----------------------------------------------------------------------+ |
---|
| 128 | // | sending html code | |
---|
| 129 | // +-----------------------------------------------------------------------+ |
---|
| 130 | |
---|
| 131 | $template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance'); |
---|
| 132 | ?> |
---|