phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [20872] Clean?\194?\160up?\194?\160locations, ?\194?\


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [20872] Clean?\194?\160up?\194?\160locations, ?\194?\160custom?\194? \160fields?\194?\160and?\194?\160ACL on uninstall
Date: Sat, 21 Nov 2009 11:01:47 +0000

Revision: 20872
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20872
Author:   sigurdne
Date:     2009-11-21 11:01:46 +0000 (Sat, 21 Nov 2009)
Log Message:
-----------
Clean?\194?\160up?\194?\160locations,?\194?\160custom?\194?\160fields?\194?\160and?\194?\160ACL
 on uninstall

Modified Paths:
--------------
    people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php      
2009-11-21 10:43:36 UTC (rev 20871)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php      
2009-11-21 11:01:46 UTC (rev 20872)
@@ -530,6 +530,28 @@
                        $appname = $this->db->db_addslashes($appname);
                        $setup_info =& $GLOBALS['setup_info'];
 
+                       // Clean up locations, custom fields and ACL
+                       $this->db->query("SELECT app_id FROM phpgw_applications 
WHERE app_name = '{$appname}'");
+                       $this->db->next_record();
+                       $app_id = $this->db->f('app_id');
+
+                       $this->db->query("SELECT location_id FROM 
phpgw_locations WHERE app_id = {$app_id}");
+
+                       $locations = array();
+                       while ($this->db->next_record())
+                       {
+                               $locations[] = $this->db->f('location_id');
+                       }
+
+                       if(count($locations))
+                       {
+                               $this->db->query('DELETE FROM phpgw_cust_choice 
WHERE location_id IN ('. implode (',',$locations) . ')');
+                               $this->db->query('DELETE FROM 
phpgw_cust_attribute WHERE location_id IN ('. implode (',',$locations). ')');
+                               $this->db->query('DELETE FROM phpgw_acl  WHERE 
location_id IN ('. implode (',',$locations) . ')');
+                       }
+
+                       $this->db->query("DELETE FROM phpgw_locations WHERE 
app_id = {$app_id}");
+
                        //echo 'DELETING application: ' . $appname;
                        $this->db->query("DELETE FROM phpgw_applications WHERE 
app_name='{$appname}'",__LINE__,__FILE__);
                        $this->clear_session_cache();





reply via email to

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