cache_dir);
}
function update_config()
{
foreach($_REQUEST as $var => $value)
{
if (! preg_match('/^'.Parseur::PREFIXE.'/', $var)) continue;
Variable::ecrire($var, $value);
}
// Bug 1.4.3.1
if (class_exists('CacheBase')) CacheBase::getCache()->reset_cache();
}
function prepare_page()
{
$date = intval(Variable::lire(Parseur::PREFIXE.'_cache_check_time'));
$this->last_date = $date > 0 ? date("d/m/Y H:i:s", $date) : 'Jamais';
$this->next_date = date("d/m/Y H:i:s", $date + 3600 * intval(Variable::lire(Parseur::PREFIXE.'_cache_check_period')));
if (is_dir($this->cache_dir)) $files = scandir ($this->cache_dir);
$this->cache_count = count($files) - 2; // -2 pour '.' et '..'
}
public function make_yes_no_radio($var_name)
{
$val = Variable::lire($var_name);
echo '
' . trad('Oui', 'admin') . '
' . trad('Non', 'admin');
}
public function clear_cache()
{
if ($dh = opendir($this->cache_dir))
{
while ($file = readdir($dh))
{
if ($file == '.' || $file == '..') continue;
unlink($this->cache_dir . '/' . $file);
}
}
ActionsModules::instance()->appel_module("clear_cache");
}
public function check_cache()
{
Analyse::cleanup_cache($this->cache_dir, 1);
}
public function check_cache_dir()
{
if (! is_dir($this->cache_dir))
{
mkdir($this->cache_dir, 0777, true);
@clearstatcache();
}
}
}
$adm = new AdmParseur();
$commande = lireParam('commande', 'string');
switch($commande)
{
case 'maj_config' :
$adm->update_config();
break;
case 'clear_cache' :
$adm->clear_cache();
break;
case 'check_cache' :
$adm->check_cache();
break;
case 'patch' :
$adm->patch();
break;
case 'check_cache_dir' :
$adm->check_cache_dir();
break;
}
$adm->prepare_page();
?>