2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2008-12-11 18:13:10 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2010-12-17 17:21:48 +00:00
|
|
|
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
2008-12-11 18:13:10 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* Cache Administration Area
|
|
|
|
*
|
2006-12-02 04:36:16 +00:00
|
|
|
*/
|
2010-05-14 09:32:16 +00:00
|
|
|
|
2021-09-14 13:28:03 -07:00
|
|
|
if(!empty($_POST) && !isset($_POST['e-token']))
|
|
|
|
{
|
|
|
|
$_POST['e-token'] = '';
|
|
|
|
}
|
2021-01-16 13:32:35 -08:00
|
|
|
require_once(__DIR__."/../class2.php");
|
2017-01-17 01:33:03 +01:00
|
|
|
|
2008-12-11 18:13:10 +00:00
|
|
|
if (!getperms("C"))
|
2008-11-02 11:04:34 +00:00
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect('admin');
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2008-12-11 18:13:10 +00:00
|
|
|
|
2017-01-17 01:33:03 +01:00
|
|
|
e107::coreLan('cache', true);
|
2009-08-28 16:11:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$e_sub_cat = 'cache';
|
2008-12-11 18:13:10 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once("auth.php");
|
2010-05-14 09:32:16 +00:00
|
|
|
$frm = e107::getForm();
|
2013-02-25 15:03:17 +01:00
|
|
|
$mes = e107::getMessage();
|
2008-12-11 18:13:10 +00:00
|
|
|
|
2010-05-14 09:32:16 +00:00
|
|
|
if (e107::getPref('cachestatus') == '2')
|
2008-11-02 11:04:34 +00:00
|
|
|
{
|
2010-05-14 09:32:16 +00:00
|
|
|
e107::getConfig()->set('cachestatus', 1)
|
|
|
|
->save(false);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2007-02-04 17:36:16 +00:00
|
|
|
|
2010-03-09 13:33:51 +00:00
|
|
|
if(!is_writable(e_CACHE_CONTENT))
|
2007-02-04 17:36:16 +00:00
|
|
|
{
|
2014-08-13 13:17:26 +02:00
|
|
|
$mes->addError(CACLAN_10." (".e_CACHE.")");
|
|
|
|
e107::getRender()->tablerender(CACLAN_3, $mes->render());
|
2007-02-04 17:36:16 +00:00
|
|
|
require_once("footer.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['submit_cache']))
|
|
|
|
{
|
2010-05-14 09:32:16 +00:00
|
|
|
e107::getConfig()->set('cachestatus', intval($_POST['cachestatus']))
|
|
|
|
->set('syscachestatus', intval($_POST['syscachestatus']))
|
2016-02-05 15:31:54 -08:00
|
|
|
->set('jscsscachestatus', intval($_POST['jscsscachestatus']))
|
2010-05-14 09:32:16 +00:00
|
|
|
->save(false);
|
2007-02-04 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
2010-05-14 09:32:16 +00:00
|
|
|
if (isset($_POST['trigger_empty_cache']))
|
2008-11-02 11:04:34 +00:00
|
|
|
{
|
2020-12-22 14:48:28 -08:00
|
|
|
e107::getLog()->addSuccess(CACLAN_6);
|
2022-06-07 12:33:50 -07:00
|
|
|
$triggerName = $_POST['option_clear_cache'];
|
2010-05-14 09:32:16 +00:00
|
|
|
switch ($_POST['option_clear_cache'])
|
|
|
|
{
|
|
|
|
case 'empty_contentcache':
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('content');
|
2020-12-22 09:36:02 -08:00
|
|
|
e107::getLog()->flushMessages(CACLAN_5);
|
2010-05-14 09:32:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'empty_syscache':
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('system');
|
2020-12-22 09:36:02 -08:00
|
|
|
e107::getLog()->flushMessages(CACLAN_16);
|
2021-01-05 10:04:26 -08:00
|
|
|
e107::getSession()->clear('addons-update-status');
|
2010-05-14 09:32:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'empty_dbcache':
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('db');
|
2020-12-22 09:36:02 -08:00
|
|
|
e107::getLog()->flushMessages(CACLAN_24);
|
2010-05-14 09:32:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'empty_imgcache':
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('image');
|
2020-12-22 09:36:02 -08:00
|
|
|
e107::getLog()->flushMessages(CACLAN_25);
|
2010-05-14 09:32:16 +00:00
|
|
|
break;
|
2010-12-17 17:21:48 +00:00
|
|
|
|
|
|
|
// used in standard page output and internal JS includes
|
|
|
|
case 'empty_browsercache':
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('browser');
|
2023-06-20 17:59:57 -07:00
|
|
|
e107::getLog()->flushMessages(CACLAN_27);
|
2010-12-17 17:21:48 +00:00
|
|
|
break;
|
2010-05-14 09:32:16 +00:00
|
|
|
|
2016-02-05 15:31:54 -08:00
|
|
|
case 'empty_jscss':
|
2016-02-05 16:26:33 -08:00
|
|
|
e107::getCache()->clearAll('js');
|
|
|
|
e107::getCache()->clearAll('css');
|
2023-06-20 17:59:57 -07:00
|
|
|
e107::getLog()->flushMessages(CACLAN_30);
|
2016-02-05 15:31:54 -08:00
|
|
|
break;
|
|
|
|
|
2010-05-14 09:32:16 +00:00
|
|
|
// all
|
|
|
|
default:
|
2012-04-26 01:33:33 +00:00
|
|
|
e107::getCache()->clearAll('content');
|
|
|
|
e107::getCache()->clearAll('system');
|
|
|
|
e107::getCache()->clearAll('db');
|
|
|
|
e107::getCache()->clearAll('image');
|
|
|
|
e107::getCache()->clearAll('browser');
|
2016-11-01 07:11:54 +01:00
|
|
|
e107::getCache()->clearAll('js');
|
|
|
|
e107::getCache()->clearAll('css');
|
2021-01-02 16:34:11 +01:00
|
|
|
e107::getSession()->clear('addons-update-status');
|
2020-12-22 09:36:02 -08:00
|
|
|
e107::getLog()->flushMessages(CACLAN_26);
|
2022-06-07 12:33:50 -07:00
|
|
|
$triggerName = 'default';
|
2010-05-14 09:32:16 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-06-07 12:33:50 -07:00
|
|
|
|
|
|
|
e107::getEvent()->trigger('admin_after_clear_cache', $triggerName);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-11-02 11:04:34 +00:00
|
|
|
|
2010-05-14 09:32:16 +00:00
|
|
|
$syscache_files = glob(e_CACHE_CONTENT.'S_*.*');
|
|
|
|
$cache_files = glob(e_CACHE_CONTENT.'C_*.*');
|
|
|
|
$imgcache_files = glob(e_CACHE_IMAGE.'*.cache.bin');
|
|
|
|
$dbcache_files = glob(e_CACHE_DB.'*.php');
|
2016-02-05 16:26:33 -08:00
|
|
|
$jscsscache_files = glob(e_WEB.'cache/*.{css,js}',GLOB_BRACE);
|
2007-02-04 17:36:16 +00:00
|
|
|
|
|
|
|
$syscache_files_num = count($syscache_files);
|
|
|
|
$cache_files_num = count($cache_files);
|
2010-05-14 09:32:16 +00:00
|
|
|
$imgcache_files_num = count($imgcache_files);
|
|
|
|
$dbcache_files_num = count($dbcache_files);
|
2016-02-05 15:31:54 -08:00
|
|
|
$jscsscache_files_num = count($jscsscache_files);
|
2007-02-04 17:36:16 +00:00
|
|
|
|
2012-03-22 19:41:11 +00:00
|
|
|
$syscache_label = $syscache_files_num.' '.($syscache_files_num != 1 ? CACLAN_19 : CACLAN_18);
|
|
|
|
$contentcache_label = $cache_files_num.' '.($cache_files_num != 1 ? CACLAN_19 : CACLAN_18);
|
|
|
|
$imgcache_label = $imgcache_files_num.' '.($imgcache_files_num != 1 ? CACLAN_19 : CACLAN_18);
|
|
|
|
$dbcache_label = $dbcache_files_num.' '.($dbcache_files_num != 1 ? CACLAN_19 : CACLAN_18);
|
2016-02-05 15:31:54 -08:00
|
|
|
$jscsscache_label = $jscsscache_files_num.' '.($jscsscache_files_num != 1 ? CACLAN_19 : CACLAN_18);
|
2007-02-04 17:36:16 +00:00
|
|
|
|
2008-12-12 16:36:45 +00:00
|
|
|
$text = "
|
2006-12-02 04:36:16 +00:00
|
|
|
<form method='post' action='".e_SELF."'>
|
2008-12-12 16:36:45 +00:00
|
|
|
<fieldset id='core-cache-settings'>
|
|
|
|
<legend class='e-hideme'>".CACLAN_3."</legend>
|
2012-11-26 03:23:20 -08:00
|
|
|
<table class='table adminlist'>
|
2012-05-13 05:26:11 +00:00
|
|
|
<colgroup>
|
2012-03-22 19:41:11 +00:00
|
|
|
<col style='width:60%' />
|
|
|
|
<col style='width:20%' />
|
2008-12-12 16:36:45 +00:00
|
|
|
<col style='width:20%' />
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th><!-- --></th>
|
2012-03-22 19:41:11 +00:00
|
|
|
<th class='left'>".CACLAN_17."</th>
|
2015-04-11 20:40:29 -07:00
|
|
|
<th class='left last'>".CACLAN_1."</th>
|
2008-12-12 16:36:45 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2012-06-03 09:45:20 +00:00
|
|
|
<strong class='e-tip'>".CACLAN_11."</strong>
|
2021-02-12 12:19:58 -08:00
|
|
|
".$frm->help(CACLAN_13)."
|
2008-12-12 16:36:45 +00:00
|
|
|
</td>
|
2012-03-22 19:41:11 +00:00
|
|
|
<td>{$contentcache_label}</td>
|
2015-04-11 20:40:29 -07:00
|
|
|
<td class='left middle'>
|
2010-05-14 09:32:16 +00:00
|
|
|
".$frm->radio_switch('cachestatus', e107::getPref('cachestatus'))."
|
2008-12-12 16:36:45 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2012-06-03 09:45:20 +00:00
|
|
|
<strong class='e-tip'>".CACLAN_12."</strong>
|
2021-02-12 12:19:58 -08:00
|
|
|
".$frm->help(CACLAN_14)."
|
2008-12-12 16:36:45 +00:00
|
|
|
</td>
|
2012-03-22 19:41:11 +00:00
|
|
|
<td>{$syscache_label}</td>
|
2015-04-11 20:40:29 -07:00
|
|
|
<td class='left middle'>
|
2010-05-14 09:32:16 +00:00
|
|
|
".$frm->radio_switch('syscachestatus', e107::getPref('syscachestatus'))."
|
|
|
|
</td>
|
|
|
|
</tr>
|
2016-02-05 15:31:54 -08:00
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>
|
2021-02-12 12:19:58 -08:00
|
|
|
<strong class='e-tip'>".CACLAN_28."</strong>".$frm->help(CACLAN_29)."
|
2021-02-04 08:45:10 -08:00
|
|
|
|
2016-02-05 15:31:54 -08:00
|
|
|
</td>
|
|
|
|
<td>{$jscsscache_label}</td>
|
|
|
|
<td class='left middle'>
|
|
|
|
".$frm->radio_switch('jscsscachestatus', e107::getPref('jscsscachestatus'))."
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2010-05-14 09:32:16 +00:00
|
|
|
<tr>
|
|
|
|
<td>
|
2021-02-12 12:19:58 -08:00
|
|
|
<strong class='e-tip'>".CACLAN_20."</strong>".$frm->help(CACLAN_21)."
|
2010-05-14 09:32:16 +00:00
|
|
|
</td>
|
2012-03-22 19:41:11 +00:00
|
|
|
<td>{$dbcache_label}</td>
|
2015-04-11 20:40:29 -07:00
|
|
|
<td class='left middle'>
|
2010-05-14 09:32:16 +00:00
|
|
|
".LAN_ENABLED."
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2021-02-12 12:19:58 -08:00
|
|
|
<strong class='e-tip'>".CACLAN_22."</strong>".$frm->help(CACLAN_23)."
|
2010-05-14 09:32:16 +00:00
|
|
|
</td>
|
2012-03-22 19:41:11 +00:00
|
|
|
<td>{$imgcache_label}</td>
|
2015-04-11 20:40:29 -07:00
|
|
|
<td class='left middle'>
|
2010-05-14 09:32:16 +00:00
|
|
|
".LAN_ENABLED."
|
2008-12-12 16:36:45 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2016-02-05 15:31:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-12 16:36:45 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2015-04-11 20:40:29 -07:00
|
|
|
<div class='buttons-bar form-inline'>
|
2013-03-07 16:05:03 +02:00
|
|
|
<div class='f-right'>".$frm->admin_button('submit_cache', CACLAN_2, 'update')."</div>
|
2013-04-25 17:29:46 -07:00
|
|
|
".$frm->select('option_clear_cache', array(
|
2010-05-14 09:32:16 +00:00
|
|
|
'empty_all' => CACLAN_26,
|
|
|
|
'empty_contentcache' => CACLAN_5,
|
|
|
|
'empty_syscache' => CACLAN_16,
|
2016-02-05 15:31:54 -08:00
|
|
|
'empty_jscss' => CACLAN_30,
|
2010-05-14 09:32:16 +00:00
|
|
|
'empty_dbcache' => CACLAN_24,
|
|
|
|
'empty_imgcache' => CACLAN_25,
|
2010-12-17 17:21:48 +00:00
|
|
|
'empty_browsercache' => CACLAN_27,
|
2010-05-14 09:32:16 +00:00
|
|
|
))."
|
|
|
|
".$frm->admin_button('trigger_empty_cache', LAN_DELETE, 'delete')."
|
2021-09-14 13:28:03 -07:00
|
|
|
<input type='hidden' name='e-token' value='" . defset('e_TOKEN') . "' />
|
2008-12-12 16:36:45 +00:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>";
|
2008-12-11 18:13:10 +00:00
|
|
|
|
2013-02-25 15:03:17 +01:00
|
|
|
e107::getRender()->tablerender(CACLAN_3, $mes->render().$text);
|
2008-12-11 18:13:10 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once("footer.php");
|
2010-05-14 09:32:16 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
?>
|