From: Matteo Nastasi (mop) <nastasi@alternativeoutput.it>
Date: Wed, 18 May 2011 21:43:26 +0000 (+0200)
Subject: destroy_data process completed
X-Git-Tag: 3.5.5~5
X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=8e74a78fab641d685d534a821f114eda7c2cdd78;p=brisk.git

destroy_data process completed
---

diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 039118e..c829980 100644
--- a/web/Obj/brisk.phh
+++ b/web/Obj/brisk.phh
@@ -1145,7 +1145,8 @@ class Room {
 		$this->room_join_wakeup($user_cur, FALSE, 0); 
 		$table_cur->table_token = "";
                 $table_cur->wakeup_time = $curtime + WAKEUP_TIME;
-		Bin5::destroy_data($table_idx);
+                        
+                        $bri->destroy_data($table_idx);
 	      }
 	      else {
 		log_main("gm:: save_data");
diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh
index 7b26f01..1bf46a3 100644
--- a/web/briskin5/Obj/briskin5.phh
+++ b/web/briskin5/Obj/briskin5.phh
@@ -685,6 +685,36 @@ class Bin5_user extends User {
       return (FALSE);
   }
 
+  function destroy_data($tab_id) 
+  {
+      do {
+          if (($tok = @ftok(FTOK_PATH."/bin5/table".$tab_id."/user".$this->table_pos, "B")) == -1) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 1 [".FTOK_PATH."/bin5/table".$tab_id."/user".$this->table_pos."]");
+              break;
+          }
+          
+          if (($shm = @shmop_open($tok, 'a', 0, 0)) == FALSE) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 2");
+              break;
+          }
+          if (shmop_delete($shm) == 0) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 3");
+              break;
+          }
+          $shm = FALSE;
+
+          log_main("BIN5 USER DATA DESTROY SUCCESS");
+          
+          // log_main("QUI CI ARRIVA [".$bri->user[0]->name."]");
+          $ret = TRUE;
+      } while (0);
+      
+      if ($shm)
+          shm_detach($shm);
+      
+      return ($ret);
+  }
+
 } // end class Bin5_user
 
 
@@ -924,7 +954,7 @@ class Bin5 {
   
 
 
-  function destroy_data($table_idx) 
+  function destroy_data() 
   {
     GLOBAL $sess;