source: trunk/admin/maintenance.php @ 5283

Last change on this file since 5283 was 5196, checked in by plg, 15 years ago

increase copyright year to 2010

  • Property svn:eol-style set to LF
File size: 4.7 KB
RevLine 
[809]1<?php
2// +-----------------------------------------------------------------------+
[2297]3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
[5196]5// | Copyright(C) 2008-2010 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
24if (!defined('PHPWG_ROOT_PATH'))
25{
26  die ("Hacking attempt!");
27}
28
[1072]29include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
30
[809]31// +-----------------------------------------------------------------------+
[1072]32// | Check Access and exit when user status is not ok                      |
33// +-----------------------------------------------------------------------+
34check_status(ACCESS_ADMINISTRATOR);
35
36// +-----------------------------------------------------------------------+
[809]37// |                                actions                                |
38// +-----------------------------------------------------------------------+
39
[1111]40$action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : '';
[809]41
42switch ($action)
43{
44  case 'categories' :
45  {
46    update_uppercats();
47    update_category('all');
48    update_global_rank();
[2890]49    invalidate_user_cache(true);
[809]50    break;
51  }
52  case 'images' :
53  {
54    update_path();
55    update_average_rate();
56    break;
57  }
[2062]58  case 'history_detail' :
[809]59  {
60    $query = '
61DELETE
[2062]62  FROM '.HISTORY_TABLE.'
[1987]63;';
64    pwg_query($query);
[2062]65    break;
66  }
67  case 'history_summary' :
68  {
[1987]69    $query = '
70DELETE
[2062]71  FROM '.HISTORY_SUMMARY_TABLE.'
[809]72;';
73    pwg_query($query);
74    break;
75  }
76  case 'sessions' :
77  {
[1080]78    pwg_session_gc();
[809]79    break;
80  }
[833]81  case 'feeds' :
82  {
83    $query = '
84DELETE
85  FROM '.USER_FEED_TABLE.'
86  WHERE last_check IS NULL
87;';
88    pwg_query($query);
89    break;
90  }
[1111]91  case 'database' :
92  {
93    do_maintenance_all_tables();
94    break;
95  }
[2208]96  case 'c13y' :
97  {
[2232]98    include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
99    $c13y = new check_integrity();
100    $c13y->maintenance();
[2208]101    break;
102  }
[3517]103  case 'search' :
104  {
105    $query = '
106DELETE
107  FROM '.SEARCH_TABLE.'
108;';
109    pwg_query($query);
110    break;
111  }
[2251]112  case 'compiled-templates' :
113  {
[2278]114    $template->delete_compiled_templates();
[2251]115    break;
116  }
[809]117  default :
118  {
119    break;
120  }
121}
122
123// +-----------------------------------------------------------------------+
124// |                             template init                             |
125// +-----------------------------------------------------------------------+
126
[2530]127$template->set_filenames(array('maintenance'=>'maintenance.tpl'));
[809]128
[2251]129$start_url = get_root_url().'admin.php?page=maintenance&amp;action=';
[809]130
[2251]131$template->assign(
[1111]132  array(
133    'U_MAINT_CATEGORIES' => $start_url.'categories',
134    'U_MAINT_IMAGES' => $start_url.'images',
[2062]135    'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail',
136    'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary',
[1111]137    'U_MAINT_SESSIONS' => $start_url.'sessions',
138    'U_MAINT_FEEDS' => $start_url.'feeds',
139    'U_MAINT_DATABASE' => $start_url.'database',
[2208]140    'U_MAINT_C13Y' => $start_url.'c13y',
[5094]141        'U_MAINT_SEARCH' => $start_url.'search',
[2251]142    'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates',
[1250]143    'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance',
[1111]144    )
145  );
[1080]146
[809]147// +-----------------------------------------------------------------------+
148// |                           sending html code                           |
149// +-----------------------------------------------------------------------+
150
151$template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance');
152?>
Note: See TracBrowser for help on using the repository browser.