2005-08-14 01:09:54 +02:00
|
|
|
<?php
|
|
|
|
// +-----------------------------------------------------------------------+
|
2011-01-18 01:02:52 +01:00
|
|
|
// | Piwigo - a PHP based photo gallery |
|
2008-04-05 00:57:23 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
2011-01-18 01:02:52 +01:00
|
|
|
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
|
2008-04-05 00:57:23 +02:00
|
|
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
|
|
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
2005-08-14 01:09:54 +02:00
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
|
// | USA. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (!defined('PHPWG_ROOT_PATH'))
|
|
|
|
{
|
|
|
|
die ("Hacking attempt!");
|
|
|
|
}
|
2006-03-09 23:46:28 +01:00
|
|
|
|
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Check Access and exit when user status is not ok |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2011-01-19 15:59:49 +01:00
|
|
|
|
2006-03-09 23:46:28 +01:00
|
|
|
check_status(ACCESS_ADMINISTRATOR);
|
2005-08-14 01:09:54 +02:00
|
|
|
|
2011-01-19 15:59:49 +01:00
|
|
|
if (isset($_GET['action']))
|
|
|
|
{
|
|
|
|
check_pwg_token();
|
|
|
|
}
|
|
|
|
|
2005-08-14 01:09:54 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | actions |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2010-12-14 14:47:24 +01:00
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : '';
|
2005-08-14 01:09:54 +02:00
|
|
|
|
|
|
|
switch ($action)
|
|
|
|
{
|
|
|
|
case 'categories' :
|
|
|
|
{
|
|
|
|
update_uppercats();
|
|
|
|
update_category('all');
|
|
|
|
update_global_rank();
|
2008-11-19 21:03:49 +01:00
|
|
|
invalidate_user_cache(true);
|
2005-08-14 01:09:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'images' :
|
|
|
|
{
|
|
|
|
update_path();
|
|
|
|
update_average_rate();
|
|
|
|
break;
|
|
|
|
}
|
2011-01-19 14:19:16 +01:00
|
|
|
case 'delete_orphan_tags' :
|
|
|
|
{
|
|
|
|
delete_orphan_tags();
|
|
|
|
break;
|
|
|
|
}
|
2007-07-11 00:00:36 +02:00
|
|
|
case 'history_detail' :
|
2005-08-14 01:09:54 +02:00
|
|
|
{
|
|
|
|
$query = '
|
2007-04-28 00:25:05 +02:00
|
|
|
DELETE
|
2007-07-11 00:00:36 +02:00
|
|
|
FROM '.HISTORY_TABLE.'
|
2007-04-28 00:25:05 +02:00
|
|
|
;';
|
|
|
|
pwg_query($query);
|
2007-07-11 00:00:36 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'history_summary' :
|
|
|
|
{
|
2007-04-28 00:25:05 +02:00
|
|
|
$query = '
|
2005-08-14 01:09:54 +02:00
|
|
|
DELETE
|
2007-07-11 00:00:36 +02:00
|
|
|
FROM '.HISTORY_SUMMARY_TABLE.'
|
2005-08-14 01:09:54 +02:00
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'sessions' :
|
|
|
|
{
|
2006-03-15 00:52:47 +01:00
|
|
|
pwg_session_gc();
|
2005-08-19 15:54:40 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'feeds' :
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
DELETE
|
|
|
|
FROM '.USER_FEED_TABLE.'
|
|
|
|
WHERE last_check IS NULL
|
2005-08-14 01:09:54 +02:00
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
2006-03-28 23:05:12 +02:00
|
|
|
case 'database' :
|
|
|
|
{
|
|
|
|
do_maintenance_all_tables();
|
|
|
|
break;
|
|
|
|
}
|
2008-02-13 21:13:12 +01:00
|
|
|
case 'c13y' :
|
|
|
|
{
|
2008-03-01 14:23:51 +01:00
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
|
|
|
|
$c13y = new check_integrity();
|
|
|
|
$c13y->maintenance();
|
2008-02-13 21:13:12 +01:00
|
|
|
break;
|
|
|
|
}
|
2009-07-04 21:20:40 +02:00
|
|
|
case 'search' :
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
DELETE
|
|
|
|
FROM '.SEARCH_TABLE.'
|
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
2008-03-05 03:14:36 +01:00
|
|
|
case 'compiled-templates' :
|
|
|
|
{
|
2008-03-13 02:43:45 +01:00
|
|
|
$template->delete_compiled_templates();
|
2011-01-12 21:41:00 +01:00
|
|
|
FileCombiner::clear_combined_files();
|
2008-03-05 03:14:36 +01:00
|
|
|
break;
|
|
|
|
}
|
2005-08-14 01:09:54 +02:00
|
|
|
default :
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | template init |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2008-09-14 09:16:15 +02:00
|
|
|
$template->set_filenames(array('maintenance'=>'maintenance.tpl'));
|
2005-08-14 01:09:54 +02:00
|
|
|
|
2011-01-19 15:59:49 +01:00
|
|
|
$url_format = get_root_url().'admin.php?page=maintenance&action=%s&pwg_token='.get_pwg_token();
|
2005-08-14 01:09:54 +02:00
|
|
|
|
2008-03-05 03:14:36 +01:00
|
|
|
$template->assign(
|
2006-03-28 23:05:12 +02:00
|
|
|
array(
|
2011-01-19 15:59:49 +01:00
|
|
|
'U_MAINT_CATEGORIES' => sprintf($url_format, 'categories'),
|
|
|
|
'U_MAINT_IMAGES' => sprintf($url_format, 'images'),
|
|
|
|
'U_MAINT_ORPHAN_TAGS' => sprintf($url_format, 'delete_orphan_tags'),
|
|
|
|
'U_MAINT_HISTORY_DETAIL' => sprintf($url_format, 'history_detail'),
|
|
|
|
'U_MAINT_HISTORY_SUMMARY' => sprintf($url_format, 'history_summary'),
|
|
|
|
'U_MAINT_SESSIONS' => sprintf($url_format, 'sessions'),
|
|
|
|
'U_MAINT_FEEDS' => sprintf($url_format, 'feeds'),
|
|
|
|
'U_MAINT_DATABASE' => sprintf($url_format, 'database'),
|
|
|
|
'U_MAINT_C13Y' => sprintf($url_format, 'c13y'),
|
|
|
|
'U_MAINT_SEARCH' => sprintf($url_format, 'search'),
|
|
|
|
'U_MAINT_COMPILED_TEMPLATES' => sprintf($url_format, 'compiled-templates'),
|
2010-04-18 20:59:37 +02:00
|
|
|
'U_HELP' => get_root_url().'admin/popuphelp.php?page=maintenance',
|
2006-03-28 23:05:12 +02:00
|
|
|
)
|
|
|
|
);
|
2006-03-15 00:52:47 +01:00
|
|
|
|
2010-04-09 23:38:16 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Define advanced features |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
$advanced_features = array();
|
|
|
|
|
|
|
|
//$advanced_features is array of array composed of CAPTION & URL
|
|
|
|
$advanced_features = trigger_event(
|
|
|
|
'get_admin_advanced_features_links',
|
|
|
|
$advanced_features
|
|
|
|
);
|
|
|
|
|
|
|
|
$template->assign('advanced_features', $advanced_features);
|
|
|
|
|
2005-08-14 01:09:54 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | sending html code |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
$template->assign_var_from_handle('ADMIN_CONTENT', 'maintenance');
|
|
|
|
?>
|