phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.28


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.28
Date: Sun, 27 Jun 2004 15:56:03 +0200

Update of /sync/inc
Modified Files:
        Branch: 
          class.ui_sync.inc.php

date: 2004/06/27 13:56:03;  author: mkaemmerer;  state: Exp;  lines: +53 -18

Log Message:
- cleartables clears now only personal items, not everything
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.27 sync/inc/class.ui_sync.inc.php:1.28
--- sync/inc/class.ui_sync.inc.php:1.27 Thu Jun 17 16:00:26 2004
+++ sync/inc/class.ui_sync.inc.php      Sun Jun 27 13:56:03 2004
@@ -31,6 +31,18 @@
     var $bo;
 
     /**
+     * @var     object   $ipc  variable module ipc object
+     * @access  private
+     */
+    var $ipc;
+
+    /**
+     * @var     object   $ipcManager  variable ipc manager
+     * @access  private
+      */
+    var $ipcManager;
+
+    /**
      * @var     array   holds an array of the public functions
      * @access  public
     */
@@ -96,6 +108,7 @@
   {
     $this->so = CreateObject('sync.so_sync');
     $this->bo = CreateObject('sync.bo_sync');
+    $this->ipcManager = CreateObject('phpgwapi.ipc_manager');
     $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
     $this->datetime = CreateObject('phpgwapi.datetime');
     $this->isadmin = $GLOBALS['phpgw']->acl->check('run',1,'admin');
@@ -308,27 +321,37 @@
  /**
    * clear some tables of phpGW
    *
-   * this public function
-   * calls the Testcase-routine from testcase.inc.php and 
-   * displays the unfiltered output
-   *
    * @access public
   */
 
   function cleartables()
   {
+    $id = $GLOBALS['phpgw_info']['user']['account_id'];
+    
     // contacts 
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_comm;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_addr;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_note;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_org;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_org_person;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_others;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_person;",__LINE__,__FILE__);
+    $this->ipc = $this->ipcManager->getIPC('addressbook');
+    $idlist = $this->ipc->getIdList(-1);
+    foreach($idlist as $id)
+    {
+      echo "Lösche Adressbuch id: $id <br>";
+      $this->ipc->removeData($id);
+    }
+    
+    // old function clears whole table
+    /*
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_comm;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_addr;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_note;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_org;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_org_person;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_others;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_contact_person;",__LINE__,__FILE__);
+    */
+
 
     // notes 
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_notes;",__LINE__,__FILE__);
+    $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_notes WHERE note_owner = 
'$id';",__LINE__,__FILE__);
     
     // sync 
     $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_syncmapping;",__LINE__,__FILE__);
@@ -336,12 +359,24 @@
     $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_syncconflicts;",__LINE__,__FILE__);
     
     // todo
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_todo;",__LINE__,__FILE__);
+    $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_todo WHERE todo_owner = 
'$id';",__LINE__,__FILE__);
     
     // calendar
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal_extra;",__LINE__,__FILE__);
-    $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal_repeats;",__LINE__,__FILE__);
+    // contacts 
+    $this->ipc = $this->ipcManager->getIPC('calendar');
+    $idlist = $this->ipc->getIdList(-1);
+    foreach($idlist as $id)
+    {
+      echo "Lösche Kalender id: $id <br>";
+      $this->ipc->removeData($id);
+    }
+    
+    // old function clears whole table
+    /*
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal_extra;",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("TRUNCATE TABLE 
phpgw_cal_repeats;",__LINE__,__FILE__);
+    */
     
     echo 'Tabellen gelöscht';
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]