source: trunk/admin/maintenance.php @ 2297

Last change on this file since 2297 was 2297, checked in by plg, 16 years ago

Modification: new header on PHP files, PhpWebGallery renamed Piwigo.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 KB
Line 
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// | PhpWebGallery - a PHP based picture gallery                           |
25// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
26// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
27// +-----------------------------------------------------------------------+
28// | file          : $Id: maintenance.php 2297 2008-04-04 22:57:23Z plg $
29// | last update   : $Date: 2008-04-04 22:57:23 +0000 (Fri, 04 Apr 2008) $
30// | last modifier : $Author: plg $
31// | revision      : $Revision: 2297 $
32// +-----------------------------------------------------------------------+
33// | This program is free software; you can redistribute it and/or modify  |
34// | it under the terms of the GNU General Public License as published by  |
35// | the Free Software Foundation                                          |
36// |                                                                       |
37// | This program is distributed in the hope that it will be useful, but   |
38// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
39// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
40// | General Public License for more details.                              |
41// |                                                                       |
42// | You should have received a copy of the GNU General Public License     |
43// | along with this program; if not, write to the Free Software           |
44// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
45// | USA.                                                                  |
46// +-----------------------------------------------------------------------+
47
48if (!defined('PHPWG_ROOT_PATH'))
49{
50  die ("Hacking attempt!");
51}
52
53include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
54
55// +-----------------------------------------------------------------------+
56// | Check Access and exit when user status is not ok                      |
57// +-----------------------------------------------------------------------+
58check_status(ACCESS_ADMINISTRATOR);
59
60// +-----------------------------------------------------------------------+
61// |                                actions                                |
62// +-----------------------------------------------------------------------+
63
64$action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : '';
65
66switch ($action)
67{
68  case 'categories' :
69  {
70    update_uppercats();
71    update_category('all');
72    ordering();
73    update_global_rank();
74    invalidate_user_cache();
75    break;
76  }
77  case 'images' :
78  {
79    update_path();
80    update_average_rate();
81    break;
82  }
83  case 'history_detail' :
84  {
85    $query = '
86DELETE
87  FROM '.HISTORY_TABLE.'
88;';
89    pwg_query($query);
90    break;
91  }
92  case 'history_summary' :
93  {
94    $query = '
95DELETE
96  FROM '.HISTORY_SUMMARY_TABLE.'
97;';
98    pwg_query($query);
99    break;
100  }
101  case 'sessions' :
102  {
103    pwg_session_gc();
104    break;
105  }
106  case 'feeds' :
107  {
108    $query = '
109DELETE
110  FROM '.USER_FEED_TABLE.'
111  WHERE last_check IS NULL
112;';
113    pwg_query($query);
114    break;
115  }
116  case 'database' :
117  {
118    do_maintenance_all_tables();
119    break;
120  }
121  case 'c13y' :
122  {
123    include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
124    $c13y = new check_integrity();
125    $c13y->maintenance();
126    break;
127  }
128  case 'compiled-templates' :
129  {
130    $template->delete_compiled_templates();
131    break;
132  }
133  default :
134  {
135    break;
136  }
137}
138
139// +-----------------------------------------------------------------------+
140// |                             template init                             |
141// +-----------------------------------------------------------------------+
142
143$template->set_filenames(array('maintenance'=>'admin/maintenance.tpl'));
144
145$start_url = get_root_url().'admin.php?page=maintenance&amp;action=';
146
147$template->assign(
148  array(
149    'U_MAINT_CATEGORIES' => $start_url.'categories',
150    'U_MAINT_IMAGES' => $start_url.'images',
151    'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail',
152    'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary',
153    'U_MAINT_SESSIONS' => $start_url.'sessions',
154    'U_MAINT_FEEDS' => $start_url.'feeds',
155    'U_MAINT_DATABASE' => $start_url.'database',
156    'U_MAINT_C13Y' => $start_url.'c13y',
157    'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates',
158    'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance',
159    )
160  );
161
162// +-----------------------------------------------------------------------+
163// |                           sending html code                           |
164// +-----------------------------------------------------------------------+
165
166$template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance');
167?>
Note: See TracBrowser for help on using the repository browser.