public static function callRegisteredShutdown() { Compile::complete(); //krumo(FileFolder::getLatestFile(NULL, NULL, 20)); FileFolder::file_put_contents(Compile::$tmpPath . "compile.txt", json_encode(FileFolder::getLatestFile(NULL, NULL, 20))); //krumo(json_decode(file_get_contents(dirname(__FILE__)."/compile.txt"), true)); FileFolder::folderCopy(Compile::$unminifiedPath, Compile::$tmpPath . "/last/"); }
public static function getLatestFile($arr = NULL, $src = NULL, $sendBackNum = 1, $recursive = true) { $orig = NULL; if (is_null($arr)) { $orig = true; } if (is_null($arr)) { $arr = array(); } if (is_null($src)) { $src = Import::$uber_src_path; } //------------------------------------------------------ if (file_exists($src)) { $dir = opendir($src); //------------------------------------------------------ while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { $filePath = $src . $file; if (is_dir($filePath)) { if ($recursive) { $arr = FileFolder::getLatestFile($arr, $filePath . "/"); } } else { $arr[$filePath] = filectime($filePath); } } } //------------------------------------------------------ if ($orig) { //uasort($arr, "FileFolder::getLatestFile_sort"); arsort($arr); if ($sendBackNum == "*") { return $arr; } else { return array_slice($arr, 0, $sendBackNum, true); } } else { return $arr; } } else { $chk['bool'] = false; $chk['error'] = true; $chk['message'] = $src . " does not exists!!!!!"; return $chk; } }
public function htmlExist_CHK($dir) { $dir = explode("?", $dir); $dir = $dir[0]; //--------------------------------------------------------- $files = FileFolder::getLatestFile(NULL, $dir . "/", "*", false); //--------------------------------------------------------- $bool = true; //--------------------------------------------------------- foreach ($files as $key => $value) { if (is_integer(strpos($key, ".html")) || is_integer(strpos($key, "index.php"))) { $bool = false; } } //--------------------------------------------------------- if ($bool) { $chk = array(); $chk = $this->deleteFile($getFile['result'][0]['id'], true); $chk['bool'] = false; $chk['error'] = true; $chk['message'] = $this->notifications_CFG(["head" => "No html file exist inside of:", "message" => $dir]); $chk['contents'] = $files; die(json_encode($chk)); } return $bool; }
public static function getLatestFile($arr = NULL, $src = NULL, $sendBackNum = 1) { if (is_null($arr)) { $orig = true; } if (is_null($arr)) { $arr = array(); } if (is_null($src)) { $src = Import::$uber_src_path; } //------------------------------------------------------ $dir = opendir($src); //------------------------------------------------------ while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { $filePath = $src . $file; if (is_dir($filePath)) { $arr = FileFolder::getLatestFile($arr, $filePath . "/"); } else { $arr[$filePath] = filectime($filePath); } } } //------------------------------------------------------ if ($orig) { //uasort($arr, "FileFolder::getLatestFile_sort"); arsort($arr); if ($sendBackNum == "*") { return $arr; } else { return array_slice($arr, 0, $sendBackNum, true); } } else { return $arr; } }