function reload_slave_password() { global $gbl, $sgbl, $login, $ghtml; static $time; if (!lxfile_exists('__path_slave_db')) { return; } $stat = llstat("__path_slave_db"); $cur = $stat['mtime']; if ($cur > $time) { $rmt = unserialize(lfile_get_contents("__path_slave_db")); $login->password = $rmt->password; $time = $cur; } }
function reload_lxserver_password() { global $gbl, $sgbl, $login, $ghtml; static $time; $stat = llstat("__path_admin_pass"); $cur = $stat['mtime']; if ($cur > $time) { $rmt = lfile_get_contents("__path_admin_pass"); $login->password = $rmt; $time = $cur; } }
function get_with_cache($file, $cmdarglist) { global $global_shell_out, $global_shell_error, $global_shell_ret; $stat = @llstat($file); lxfile_mkdir("__path_program_root/cache"); $tim = 120; //$tim = 1; $c = lfile_get_contents($file); if (time() - $stat['mtime'] > $tim || !$c) { // Hack hack.. The lxshell_output does not take strings. You need to supply them together. $val = call_user_func_array('lxshell_output', $cmdarglist); lfile_put_contents($file, $val); return $val; } return lfile_get_contents($file); }