phpldapadmin/htdocs/purge_cache.php

36 lines
778 B
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 10:46:00 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9 2007/12/15 07:50:30 wurley Exp $
2009-06-30 09:29:51 +00:00
/**
* @package phpLDAPadmin
*/
/**
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 10:46:00 +00:00
if (! $_SESSION['plaConfig']->isCommandAvailable('purge'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')));
2009-06-30 09:22:30 +00:00
2009-06-30 10:46:00 +00:00
$purge_session_keys = array('cache');
2009-06-30 09:22:30 +00:00
$size = 0;
2009-06-30 09:29:51 +00:00
foreach ($purge_session_keys as $key) {
2009-06-30 10:26:08 +00:00
if (isset($_SESSION[$key])) {
$size += strlen(serialize($_SESSION[$key]));
unset($_SESSION[$key]);
}
2009-06-30 09:22:30 +00:00
}
2009-06-30 09:29:51 +00:00
if (! $size)
2009-06-30 10:46:00 +00:00
$body = _('No cache to purge.');
2009-06-30 09:22:30 +00:00
else
2009-06-30 10:46:00 +00:00
$body = sprintf(_('Purged %s bytes of cache.'),number_format($size));
2009-06-30 09:22:30 +00:00
2009-06-30 10:46:00 +00:00
system_message(array(
'title'=>_('Purge cache'),
'body'=>$body,
'type'=>'info'),
'index.php');
2009-06-30 10:26:08 +00:00
?>