source: trunk/admin/maintenance.php @ 2297

Last change on this file since 2297 was 2297, checked in by plg, 17 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
RevLine 
[809]1<?php
2// +-----------------------------------------------------------------------+
[2297]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// +-----------------------------------------------------------------------+
[809]24// | PhpWebGallery - a PHP based picture gallery                           |
25// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
[2208]26// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
[809]27// +-----------------------------------------------------------------------+
[1987]28// | file          : $Id: maintenance.php 2297 2008-04-04 22:57:23Z plg $
[809]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
[1072]53include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
54
[809]55// +-----------------------------------------------------------------------+
[1072]56// | Check Access and exit when user status is not ok                      |
57// +-----------------------------------------------------------------------+
58check_status(ACCESS_ADMINISTRATOR);
59
60// +-----------------------------------------------------------------------+
[809]61// |                                actions                                |
62// +-----------------------------------------------------------------------+
63
[1111]64$action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : '';
[809]65
66switch ($action)
67{
68  case 'categories' :
69  {
70    update_uppercats();
71    update_category('all');
72    ordering();
73    update_global_rank();
[1981]74    invalidate_user_cache();
[809]75    break;
76  }
77  case 'images' :
78  {
79    update_path();
80    update_average_rate();
81    break;
82  }
[2062]83  case 'history_detail' :
[809]84  {
85    $query = '
86DELETE
[2062]87  FROM '.HISTORY_TABLE.'
[1987]88;';
89    pwg_query($query);
[2062]90    break;
91  }
92  case 'history_summary' :
93  {
[1987]94    $query = '
95DELETE
[2062]96  FROM '.HISTORY_SUMMARY_TABLE.'
[809]97;';
98    pwg_query($query);
99    break;
100  }
101  case 'sessions' :
102  {
[1080]103    pwg_session_gc();
[809]104    break;
105  }
[833]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  }
[1111]116  case 'database' :
117  {
118    do_maintenance_all_tables();
119    break;
120  }
[2208]121  case 'c13y' :
122  {
[2232]123    include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
124    $c13y = new check_integrity();
125    $c13y->maintenance();
[2208]126    break;
127  }
[2251]128  case 'compiled-templates' :
129  {
[2278]130    $template->delete_compiled_templates();
[2251]131    break;
132  }
[809]133  default :
134  {
135    break;
136  }
137}
138
139// +-----------------------------------------------------------------------+
140// |                             template init                             |
141// +-----------------------------------------------------------------------+
142
143$template->set_filenames(array('maintenance'=>'admin/maintenance.tpl'));
144
[2251]145$start_url = get_root_url().'admin.php?page=maintenance&amp;action=';
[809]146
[2251]147$template->assign(
[1111]148  array(
149    'U_MAINT_CATEGORIES' => $start_url.'categories',
150    'U_MAINT_IMAGES' => $start_url.'images',
[2062]151    'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail',
152    'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary',
[1111]153    'U_MAINT_SESSIONS' => $start_url.'sessions',
154    'U_MAINT_FEEDS' => $start_url.'feeds',
155    'U_MAINT_DATABASE' => $start_url.'database',
[2208]156    'U_MAINT_C13Y' => $start_url.'c13y',
[2251]157    'U_MAINT_COMPILED_TEMPLATES' => $start_url.'compiled-templates',
[1250]158    'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance',
[1111]159    )
160  );
[1080]161
[809]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.