function NWEmptyDir($object = "./") { if (!($object = NWPathComplete($object))) { if (DEBUG) { NWWriteLog("Error completing path."); } return false; } $scanDir = scandir($object); if (count($scanDir) >= 1) { foreach ($scanDir as $value) { if ($value != ".." and $value != ".") { NWDelete($object . $value); } } } return true; }
function NWDeleteLog($date = "today", $path = "./Logs/") { if ($date = "today") { $date = strtotime(date("d-m-y", time())); } $file = "log_" . $date . ".txt"; if (file_exists($path . $file)) { if (!NWDelete($path . $file, false)) { if (DEBUG) { NWWriteLog("Couldn't clear history."); } return false; } else { if (DEBUG) { NWWriteLog("Log cleared."); } return true; } } else { return false; } }