public static function sweep() { $watch_path = LookoutController::watchPath(); $inactive_users = array(); $orig_dir = getcwd(); chdir($watch_path); $worked = false; $watch_files = glob('*.sess'); foreach ($watch_files as $file) { $file_access_time = fileatime($file); $current_time = time(); $inactive = $current_time - $file_access_time > MAX_INACTIVE_TIME; if ($inactive) { $userid = explode('.', $file); array_push($inactive_users, $userid[0]); } $worked = true; } chdir($orig_dir); if (sizeof($inactive_users) > 0) { LookoutController::deleteInactiveWatch($inactive_users); AuthenticationController::autoLogout($inactive_users); $worked = true; } return $worked; }