From: Matteo Nastasi (mop) Date: Thu, 26 Jun 2014 06:19:27 +0000 (+0200) Subject: unused Brisk::load_data and save_data static methods removed X-Git-Tag: v4.14.3~11^2~3 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=356cad47d20258b4888caac71b143b6b6e1831e0;p=brisk.git unused Brisk::load_data and save_data static methods removed --- diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index b2598b2..9e0eb12 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2244,101 +2244,6 @@ class Brisk } } - function load_data() - { - GLOBAL $sess; - - do { - if (($tok = @ftok(FTOK_PATH."/main", "C")) == -1) { - log_main("ftok failed"); - break; - } - - if (($shm_sz = sharedmem_sz($tok)) == -1) { - log_main("shmop_open failed"); - } - - if ($shm_sz == -1) - $shm_sz = SHM_DIMS_MIN; - - if ($shm = shm_attach($tok, $shm_sz)) { - $brisk = @shm_get_var($shm, $tok); // CHECKED BELOW - - log_only("bri == ".($brisk == FALSE ? "FALSE" : "TRUE")." bri === ".($brisk === FALSE ? "FALSE" : "TRUE")." bri isset ".(isset($brisk) ? "TRUE" : "FALSE")); - if (isset($brisk)) - log_only("bri count ".count($brisk)); - - if ($brisk == FALSE) { - log_only("INIT MAIN DATA"); - shm_detach($shm); - - $brisk = Brisk::create(); - - log_shme("Brisk::create"); - - if (Brisk::save_data($brisk) == FALSE) - return FALSE; - - return $brisk; - } - $brisk->shm_sz = $shm_sz; - - shm_detach($shm); - - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - if (($brisk->user[$i] = User::load_data($i, FALSE)) == FALSE) { - log_crit("User::load_data failed"); - break; - } - } - if ($i < MAX_PLAYERS) { - break; - } - } - - // - // SHSPLIT: load users from the shared memory - // - return ($brisk); - } while (0); - - return (FALSE); - } - - - function save_data_orig($brisk) - { - GLOBAL $sess; - - $shm = FALSE; - - // var_dump($brisk); - - if (($tok = @ftok(FTOK_PATH."/main", "C")) == -1) - return (FALSE); - - while ($brisk->shm_sz < SHM_DIMS_MAX) { - if (($shm = shm_attach($tok, $brisk->shm_sz)) == FALSE) - break; - - // log_only("PUT_VAR DI ".strlen(serialize($brisk))); - if (@shm_put_var($shm, $tok, $brisk) != FALSE) { - shm_detach($shm); - return (TRUE); - } - if (shm_remove($shm) === FALSE) { - log_only("REMOVE FALLITA"); - break; - } - shm_detach($shm); - $brisk->shm_sz += SHM_DIMS_DLT; - } - - if ($shm) - shm_detach($shm); - - return (FALSE); - } function dump_data() { $brisk_ser = serialize($this); @@ -2350,55 +2255,6 @@ class Brisk return (FALSE); } - function save_data($brisk) - { - GLOBAL $sess; - - $ret = FALSE; - $shm = FALSE; - - if (($tok = @ftok(FTOK_PATH."/main", "C")) == -1) - return (FALSE); - - // SHSPLIT: before save the $brisk you must save users, - // detach from main struct and (then) reattach - $user_park = array(); - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - $user_park[$i] = $brisk->user[$i]; - $brisk->user[$i] = FALSE; - } - - while ($brisk->shm_sz < SHM_DIMS_MAX) { - if (($shm = shm_attach($tok, $brisk->shm_sz)) == FALSE) - break; - - // log_only("PUT_VAR DI ".strlen(serialize($brisk))); - if (@shm_put_var($shm, $tok, $brisk) != FALSE) { - log_shme("Brisk::save_data"); - $ret = TRUE; - break; - } - if (shm_remove($shm) === FALSE) { - log_only("REMOVE FALLITA"); - break; - } - shm_detach($shm); - $brisk->shm_sz += SHM_DIMS_DLT; - } - - if ($shm) - shm_detach($shm); - - // SHSPLIT: reattach users to the room class - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - User::save_data($user_park[$i], $i); - $brisk->user[$i] = $user_park[$i]; - } - log_load("FINISH: ".($ret == TRUE ? "TRUE" : "FALSE")); - - return ($ret); - } - static function lock_data($is_exclusive) { if (($res = file_lock(FTOK_PATH."/main", $is_exclusive)) != FALSE) { diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index ef9dfda..3391a55 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -527,8 +527,6 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) log_wr("NOSENSE"); } } - log_wr("before save data"); - log_wr($user->step, 'bin::index_wr.php: after save_data()'); return TRUE; } ?> diff --git a/web/index_wr.php b/web/index_wr.php index 3e862d1..2977049 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -852,9 +852,6 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) } } } - log_wr("before save data"); - // Brisk::save_data($brisk); - log_wr($user->step, 'index_wr.php: after save_data()'); /* Brisk::unlock_data($sem); */ /* exit; */