@@ -37,9 +37,15 @@
exit;
}
function isBeforeDate($first, $reference) {
function isBeforeDate($toCheck, $reference) {
$formatted = date("Y-m-d", $toCheck);
$refUnix = strtotime($reference);
if($toCheck < $refUnix) {
return true;
return false;
function emptySavedDir($todate = null) {
// Empty the saved_schedules directory
@@ -51,11 +57,13 @@
// Do this the new fun php5 OO-way
foreach(new DirectoryIterator($dir) as $file) {
$isBeforeDate = isBeforeDate($file->getCTime, $todate);
if(is_numeric($file->getFilename())){
$isBeforeDate = isBeforeDate($file->getCTime(), $todate);
if(!$todate || $isBeforeDate) {
// unlink($dir . '/' . $file->getFilename());
echo "<p>Erased file: " . $dir . '/' . $file->getFilename() . "</p>";
$date = date("Y-m-d",$file->getCTime());
echo "<p>Erased file: " . $dir . '/' . $file->getFilename() . " ({$date})</p>";
Status change: