"; HotPotGC(api_get_path(SYS_PATH), 1, 1); /** * Garbage collector caller function */ function HotPotGC($root_sys, $flag, $userID) { // flag[0,1] - print or delete the HotPotatoes temp files (.t.html) $documentPath = $root_sys."courses"; HotPotGCt($documentPath, $flag, $userID); } /** * Garbage collector */ function HotPotGCt($folder, $flag, $userID) { // Garbage Collector $filelist = array(); if ($dir = @opendir($folder)) { while (($file = readdir($dir)) !== false) { if ($file != ".") { if ($file != "..") { $full_name = $folder."/".$file; if (is_dir($full_name)) { HotPotGCt($folder."/".$file, $flag); } else { $filelist[] = $file; } } } } closedir($dir); } while (list ($key, $val) = each($filelist)) { if (stristr($val, $userID.".t.html")) { if ($flag == 1) { FileManager::my_delete($folder."/".$val); } else { echo $folder."/".$val."
"; } } } }