Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 220
.timestamp.tmp.BUILDDATE.tmp",
// with BUILDDATE != current published configuration build date (tmp file before last publish)
// THEN consider temp file as outdated, and ready to be cleaned up.
$path_parts = pathinfo($filepath);
$filename = $path_parts['basename'];
$filename_parts = explode(".", $filename);
if (count($filename_parts) > 3 && array_pop($filename_parts) === 'tmp') {
$tempFileBuildDate = array_pop($filename_parts);
if (array_pop($filename_parts) === 'tmp' && $tempFileBuildDate !== Configuration::BUILDDATE) {
return true;
}
}
return false;
}
/**
* Check path for temp file and remove if temp file is outdated.
* * This function is harmless if no correspondingly named file exists.
*
* @param $path
*/
public static function deleteTempFiles($path)
{
if (is_dir($path) && !is_link($path)) {
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
$newPath = "$path/$file";
self::deleteTempFiles($newPath);
}
} else {
// if is_link or is_file
if (self::isOutdatedTempFile($path)) {
unlink($path);
}
}
}
}