From e469882b494df00aab18f2e38d18c5faa214c740 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 30 Mar 2011 18:42:06 +0200 Subject: [PATCH] removed all development error_log calls, removed many by reference operator and some optional logs --- web/Obj/brisk.phh | 19 ++----------------- web/Obj/dbase_pgsql.phh | 7 ------- web/admin.php | 3 --- web/briskin5/Obj/briskin5.phh | 11 ++--------- web/briskin5/index_rd.php | 4 ---- web/briskin5/index_wr.php | 8 ++++---- web/briskin5/statadm.php | 3 --- web/index_wr.php | 8 +++----- 8 files changed, 11 insertions(+), 52 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 13a21a3..ca9a140 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -638,8 +638,6 @@ class User { } function create($idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { - // error_log("User::create BEGIN", 0); - if (($thiz = new User()) == FALSE) return (FALSE); @@ -904,8 +902,6 @@ class User { static function load_data($id, $sess) { - // error_log("User::load_data BEGIN", 0); - log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] "); $doexit = FALSE; @@ -931,8 +927,6 @@ class User { break; } log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE")); - if (isset($user)) - log_only("bri count ".count($user)); if ($user == FALSE) { log_only("INIT MAIN DATA"); @@ -969,9 +963,6 @@ class User { $shm = FALSE; - // var_dump($user); - // error_log("User::save_data BEGIN", 0); - if (($tok = @ftok(FTOK_PATH."/user".$id, "B")) == -1) { return (FALSE); } @@ -2030,7 +2021,6 @@ class Room { log_auth("XXX", "authenticate: ".($authenticate != FALSE ? "TRUE" : "FALSE")); if ($authenticate != FALSE) { - // error_log(print_r(&$authenticate, TRUE),0); $user_type = $authenticate->type_get(); } else { @@ -2243,8 +2233,6 @@ class Room { GLOBAL $sess; $doexit = FALSE; - // error_log("Room::load_data BEGIN", 0); - do { if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) { log_main("ftok failed"); @@ -2270,8 +2258,6 @@ class Room { log_only("INIT MAIN DATA"); shm_detach($shm); - // error_log("DE CHE", 0); - $room = Room::create(); if (Room::save_data($room) == FALSE) @@ -2343,9 +2329,6 @@ class Room { $ret = FALSE; $shm = FALSE; - // var_dump($room); - // error_log("Room::save_data BEGIN", 0); - if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) return (FALSE); @@ -2942,6 +2925,8 @@ function secstoword($secs) { GLOBAL $G_lang; + $ret = ""; + $mins = floor($secs / 60); $secs = $secs % 60; if ($G_lang == 'en') { diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 004edb9..8dbdfb6 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -151,28 +151,21 @@ class BriskDB /* if it exists check for a valid challenge */ if (($a_sem = Challenges::lock_data()) != FALSE) { - // error_log("loop-2", 0); if (($chals = &Challenges::load_data()) != FALSE) { - // error_log("loop-1", 0); for ($e = 0 ; $e < $chals->item_n ; $e++) { - // error_log("loop", 0); log_main("challenge[".$e."]: ".$chals->item[$e]->login); if (strcmp($login, $chals->item[$e]->login) == 0) { - // error_log("loop2", 0); log_main("login_verify [".$pass."] with [".md5($chals->item[$e]->token.$user_obj->pass)."]"); if (strcmp($pass, md5($chals->item[$e]->token.$user_obj->pass)) == 0) { - // error_log("loop3", 0); log_main("login_verify SUCCESS for ".$login); $chals->rem($login); $ret = LoginDBItem::LoginDBItemFromRecord($user_obj); - // error_log("dbitem: ".print_r($ret, TRUE)); break; } } } // end for ($e = 0 ... - // error_log("end loop-1", 0); } if ($chals->ismod()) { diff --git a/web/admin.php b/web/admin.php index efeb744..64325d7 100644 --- a/web/admin.php +++ b/web/admin.php @@ -46,12 +46,9 @@ class ImpPoints function ImpPoints($s) { - // error_log($s, 0); $arr = explode('|', $s); - // error_log("TTOK: ".count($arr), 0); if (count($arr) != 20) { - // error_log("COUNT: ".count($arr)); return FALSE; } diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index cfac962..dc1e055 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -579,9 +579,7 @@ class Bin5_user extends User { static function load_data($tab_id, $id, $sess) { - // error_log("Bin5_user::load_data BEGIN id [".$id."]", 0); - - log_main("load_data: tab_id [".$tab_id."] id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] "); + log_main("Bin5_user::load_data: tab_id [".$tab_id."] id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] "); $doexit = FALSE; do { @@ -606,8 +604,6 @@ class Bin5_user extends User { break; } log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE")); - if (isset($user)) - log_only("bri count ".count($user)); if ($user == FALSE) { log_only("INIT MAIN DATA"); @@ -643,9 +639,6 @@ class Bin5_user extends User { $shm = FALSE; - // var_dump($user); - // error_log("Bin5_user::save_data BEGIN id [".$id."]", 0); - if (($tok = @ftok(FTOK_PATH."/bin5/table".$tab_id."/user".$id, "B")) == -1) { return (FALSE); } @@ -809,7 +802,7 @@ class Bin5 { $doexit = FALSE; $shm = FALSE; - log_wr("TABLE_IDX ".FTOK_PATH."/bin5/table".$table_idx."/table"); + log_wr("TABLE_FTOK ".FTOK_PATH."/bin5/table".$table_idx."/table"); do { if (($tok = @ftok(FTOK_PATH."/bin5/table".$table_idx."/table", "B")) == -1) { diff --git a/web/briskin5/index_rd.php b/web/briskin5/index_rd.php index a1cbd56..81c05f9 100644 --- a/web/briskin5/index_rd.php +++ b/web/briskin5/index_rd.php @@ -93,8 +93,6 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su return (FALSE); } - // error_log("maincheck: step di i [".$proxy_step['i']."]", 0); - // log_rd2("M"); /* Sync check (read only without modifications */ ignore_user_abort(TRUE); @@ -154,8 +152,6 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su log_lock("P"); $S_load_stat['U_heavy']++; - // if (($bri = &Bin5::load_data($table_idx, $table_token)) == FALSE) - // if (($user = Bin5_user::load_data($table_idx, $table_token)) == FALSE) if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) { break; } diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 5a2644f..05833a8 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -54,7 +54,7 @@ log_mop(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg)); $sem = Bin5::lock_data($table_idx); -if (($bri = &Bin5::load_data($table_idx,$table_token)) == FALSE) { +if (($bri = Bin5::load_data($table_idx,$table_token)) == FALSE) { echo "Bin5 Load data error"; log_wr("Bin5 Load data error"); Bin5::unlock_data($sem); @@ -69,7 +69,7 @@ if (($user = &$bri->get_user($sess, &$idx)) == FALSE) { } $argz = explode('|', $mesg); -log_wr('POSTSPLIT: '.$argz[0]); +log_wr('POSTSPLIT: '.$argz[0].' user->stat: ['.$user->stat.']'); log_mop($user->step, 'bin::index_wr.php: after get_user()'); if (false && $argz[0] == 'shutdown') { @@ -77,7 +77,7 @@ if (false && $argz[0] == 'shutdown') { log_rd2("bin5/index_wr.php: AUTO LOGOUT."); if ($user->stat == 'table') { - $bri->table_wakeup(&$user); + $bri->table_wakeup($user); // to force the logout $user->lacc = 0; } @@ -91,7 +91,7 @@ if (false && $argz[0] == 'shutdown') { *********************/ else if ($user->stat == 'table') { $user->laccwr = time(); - $table = &$bri->table[$user->table]; + $table = $bri->table[$user->table]; if ($argz[0] == 'tableinfo') { log_wr("PER DI TABLEINFO"); diff --git a/web/briskin5/statadm.php b/web/briskin5/statadm.php index 2ece714..bbde8eb 100644 --- a/web/briskin5/statadm.php +++ b/web/briskin5/statadm.php @@ -233,7 +233,6 @@ function main_pgsql($curtime) FROM %sbin5_matches as m, %sbin5_games as g WHERE g.mcode = m.code GROUP BY m.code, m.ttok", $G_dbpfx, $G_dbpfx, $G_dbpfx); - // error_log($mtc_sql, 0); if (pg_query($bdb->dbconn->db(), $mtc_sql) == FALSE) { log_crit("statadm: temporary matches table creation [$mtc_sql] failed"); break; @@ -241,7 +240,6 @@ function main_pgsql($curtime) $tmt_sql = sprintf("SELECT * FROM %sbin5_temp_matches WHERE tstamp < to_timestamp(%d)", $G_dbpfx, $curtime - TRI_LIMIT); - // error_log($tmt_sql, 0); // if deletable old matches exists then ... if (($tmt_pg = pg_query($bdb->dbconn->db(), $tmt_sql)) != FALSE) { @@ -262,7 +260,6 @@ function main_pgsql($curtime) $mtc_sql = sprintf("SELECT * from %sbin5_matches WHERE code = %d", $G_dbpfx, $tmt_obj->code); - // error_log($mtc_sql, 0); if (($mtc_pg = pg_query($bdb->dbconn->db(), $mtc_sql)) == FALSE || pg_numrows($mtc_pg) != 1) { log_crit("statadm: matches row select failed"); break; diff --git a/web/index_wr.php b/web/index_wr.php index 1348c12..c2deba8 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -113,7 +113,7 @@ if (($room = &Room::load_data()) == FALSE) { Room::unlock_data($sem); exit; } -if (($user = &$room->get_user($sess, &$idx)) == FALSE) { +if (($user = $room->get_user($sess, &$idx)) == FALSE) { Room::unlock_data($sem); $argz = explode('|', xcapemesg($mesg)); @@ -639,11 +639,9 @@ else if ($user->stat == 'room') { log_wr("postsave bri"); } // change room - $room->room_sitdown(&$user, $table_idx); - - log_wr("MOP finish"); - + $room->room_sitdown($user, $table_idx); + log_wr("MOP finish"); } else if ($argz[0] == 'logout') { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; -- 2.17.1