- clear php-fcgi-starter directories so no old files for non-existing domains are on the filesystem, fixes #367

This commit is contained in:
Michael Kaufmann (d00p)
2010-08-17 06:40:20 +00:00
parent 015f51f8d3
commit e444ebff62

View File

@@ -75,8 +75,7 @@ while($row = $db->fetch_array($result_tasks))
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
fclose($awstatsclean['fh']);
if($awstatsclean['headerRead'] == $awstatsclean['header'] || $awstatsclean['headerRead'] ==
$awstatsclean['headerold']) {
if($awstatsclean['headerRead'] == $awstatsclean['header'] || $awstatsclean['headerRead'] == $awstatsclean['headerold']) {
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Removing awstats configuration ".$awstatsclean['fullentry']." for re-creation");
@unlink($awstatsclean['fullentry']);
}
@@ -91,6 +90,34 @@ $awstatsclean['headerold']) {
}
//end dhr
// clear fcgid - starter files prior to re-creation to keep it clean, #367
if ($settings['system']['mod_fcgid'] == '1')
{
$configdir = makeCorrectDir($settings['system']['mod_fcgid_configdir']);
if (is_dir($configdir))
{
$its = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($configdir)
);
// iterate through all subdirs,
// look for php-fcgi-starter files
// and take immutable-flag away from them
// so we can delete them :)
foreach ($its as $fullFileName => $it )
{
if ($it->isFile() && $it->getFilename() == 'php-fcgi-starter')
{
removeImmutable($its->getPathname());
}
}
// now get rid of old stuff
//(but append /* so we don't delete the directory)
safe_exec('rm -rf '. escapeshellarg(makeCorrectFile($configdir.'/*')));
}
}
if(!isset($webserver))
{
if($settings['system']['webserver'] == "apache2")
@@ -236,7 +263,7 @@ $awstatsclean['headerold']) {
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
safe_exec('rm -rf '.escapeshellarg($maildir));
}
/*
* see if we have some php-fcgid leftovers if used
* and remove them, #200