phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.54,1.55 tables_cu


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.54,1.55 tables_current.inc.php,1.43,1.44 tables_update.inc.php,1.68,1.69
Date: Thu, 01 May 2003 05:19:36 -0400

Update of /cvsroot/phpgroupware/phpgwapi/setup
In directory subversions:/tmp/cvs-serv19448

Modified Files:
        setup.inc.php tables_current.inc.php tables_update.inc.php 
Log Message:
reworked preferences (ported from .16 incl. fixes):
- not set user-prefs use the default value, default values have been used only 
for new accounts before
- preference-table has new column preference_app
- preferences got automaticaly quoted now, eg. its save to use single and 
double quotes as well as backslashs


Index: setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/setup/setup.inc.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -r1.54 -r1.55
*** setup.inc.php       27 Apr 2003 23:18:37 -0000      1.54
--- setup.inc.php       1 May 2003 09:19:33 -0000       1.55
***************
*** 14,18 ****
        /* Basic information about this app */
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
!       $setup_info['phpgwapi']['version']   = '0.9.15.010';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.23';
        $setup_info['phpgwapi']['enable']    = 3;
--- 14,18 ----
        /* Basic information about this app */
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
!       $setup_info['phpgwapi']['version']   = '0.9.15.011';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.23';
        $setup_info['phpgwapi']['enable']    = 3;

Index: tables_current.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/setup/tables_current.inc.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** tables_current.inc.php      27 Apr 2003 23:18:37 -0000      1.43
--- tables_current.inc.php      1 May 2003 09:19:33 -0000       1.44
***************
*** 73,80 ****
                'phpgw_preferences' => array(
                        'fd' => array(
!                               'preference_owner' => array('type' => 'int', 
'precision' => 4, 'nullable' => false),
!                               'preference_value' => array('type' => 'text')
                        ),
!                       'pk' => array('preference_owner'),
                        'fk' => array(),
                        'ix' => array(),
--- 73,81 ----
                'phpgw_preferences' => array(
                        'fd' => array(
!                               'preference_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
!                               'preference_app' => array('type' => 
'varchar','precision' => '25','nullable' => False),
!                               'preference_value' => array('type' => 
'text','nullable' => False)
                        ),
!                       'pk' => array('preference_owner','preference_app'),
                        'fk' => array(),
                        'ix' => array(),

Index: tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/setup/tables_update.inc.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -r1.68 -r1.69
*** tables_update.inc.php       27 Apr 2003 23:18:37 -0000      1.68
--- tables_update.inc.php       1 May 2003 09:19:33 -0000       1.69
***************
*** 106,110 ****
                // as 0.9.15.xxx are already used in HEAD
                
!               // 0.9.15.001-10 are already included in 0.9.14.502
                
                $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.010';
--- 106,110 ----
                // as 0.9.15.xxx are already used in HEAD
                
!               // 0.9.15.001-9 are already included in 0.9.14.502
                
                $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.010';
***************
*** 112,115 ****
--- 112,127 ----
        }
        
+       $test[] = '0.9.14.503';
+       function phpgwapi_upgrade0_9_14_503()
+       {
+               // 0.9.14.5xx are the development-versions of the 0.9.16 
release (based on the 0.9.14 api)
+               // as 0.9.15.xxx are already used in HEAD
+               
+               // 0.9.15.001-11 are already included in 0.9.14.503
+               
+               $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011';
+               return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+       }
+ 
        $test[] = '0.9.15.001';
        function phpgwapi_upgrade0_9_15_001()
***************
*** 293,296 ****
--- 305,351 ----
        }
  
+       $test[] = '0.9.15.010';
+       function phpgwapi_upgrade0_9_15_010()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_preferences','old_preferences');
+ 
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_preferences',array(
+                       'fd' => array(
+                               'preference_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'preference_app' => array('type' => 
'varchar','precision' => '25','nullable' => False),
+                               'preference_value' => array('type' => 
'text','nullable' => False)
+                       ),
+                       'pk' => array('preference_owner','preference_app'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+               $db2 = $GLOBALS['phpgw_setup']->db;     // we need a 2. 
result-set
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
old_preferences");
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $owner = 
intval($GLOBALS['phpgw_setup']->oProc->f('preference_owner'));
+                       $prefs = 
unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value'));
+                       
+                       if (is_array($prefs))
+                       {
+                               foreach ($prefs as $app => $pref)
+                               {
+                                       if (!empty($app) && count($pref))
+                                       {
+                                               $app = addslashes($app);
+                                               $pref = serialize($pref);
+                                               $db2->query("INSERT INTO 
phpgw_preferences".
+                                                       " 
(preference_owner,preference_app,preference_value)".
+                                                       " VALUES 
($owner,'$app','$pref')");
+                                       }
+                               }
+                       }
+               }
+               $GLOBALS['phpgw_setup']->oProc->DropTable('old_preferences');
+ 
+               $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011';
+               return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+       }
  
  ?>





reply via email to

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