- check for existing awstats-configuration-directory and model-file, fixes #45
This commit is contained in:
@@ -55,9 +55,22 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
{
|
{
|
||||||
$awstatsclean['header'] = "## GENERATED BY FROXLOR\n";
|
$awstatsclean['header'] = "## GENERATED BY FROXLOR\n";
|
||||||
$awstatsclean['path'] = '/etc/awstats';
|
$awstatsclean['path'] = '/etc/awstats';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dont do anyting if the directory not exists
|
||||||
|
* (e.g. awstats not installed yet or whatever)
|
||||||
|
* fixes #45
|
||||||
|
*/
|
||||||
|
if (is_dir($awstatsclean['dir']))
|
||||||
|
{
|
||||||
$awstatsclean['dir'] = dir($awstatsclean['path']);
|
$awstatsclean['dir'] = dir($awstatsclean['path']);
|
||||||
while($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
|
while($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
|
||||||
$awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry'];
|
$awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry'];
|
||||||
|
/**
|
||||||
|
* dont do anything if the file does not exist
|
||||||
|
*/
|
||||||
|
if (file_exists($awstatsclean['fullentry']))
|
||||||
|
{
|
||||||
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
|
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
|
||||||
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
|
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
|
||||||
fclose($awstatsclean['fh']);
|
fclose($awstatsclean['fh']);
|
||||||
@@ -65,6 +78,12 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
@unlink($awstatsclean['fullentry']);
|
@unlink($awstatsclean['fullentry']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "File '".$awstatsclean['fullentry']."' could not be found, please check if you followed all the instructions on the configuration page");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unset($awstatsclean);
|
unset($awstatsclean);
|
||||||
}
|
}
|
||||||
//end dhr
|
//end dhr
|
||||||
|
|||||||
Reference in New Issue
Block a user