Ignore:
Timestamp:
11/03/11 13:24:14 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo ExpressoAdmin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/setup/tables_update.inc.php

    r4306 r5133  
    99        * option) any later version.                                               * 
    1010        \**************************************************************************/     
    11         // Since Expresso 1.2 using ExpressoAdmin 1.261 
     11        $test[] = '1.2'; 
     12        function expressoAdmin1_2_upgrade1_2() 
     13        { 
     14                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.21'; 
     15                return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
     16        } 
     17         
     18        $test[] = '1.21'; 
     19        function expressoAdmin1_2_upgrade1_21() 
     20        { 
     21                $oProc = $GLOBALS['phpgw_setup']->oProc; 
     22 
     23                $oProc->CreateTable( 
     24                        'phpgw_expressoadmin_samba', array( 
     25                                'fd' => array( 
     26                                        'samba_domain_name' => array( 'type' => 'varchar', 'precision' => 50), 
     27                                        'samba_domain_sid' => array( 'type' => 'varchar', 'precision' => 100) 
     28                                ), 
     29                                'pk' => array('samba_domain_name'), 
     30                                'fk' => array(), 
     31                                'ix' => array(), 
     32                                'uc' => array() 
     33                        ) 
     34                ); 
     35                 
     36                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.240'; 
     37                return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
     38        } 
     39 
     40        $test[] = '1.240'; 
     41        function expressoAdmin1_2_upgrade1_240() 
     42        { 
     43                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.250'; 
     44                return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
     45        } 
     46         
     47        $test[] = '1.250'; 
     48        function expressoAdmin1_2_upgrade1_250() 
     49        { 
     50                $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','appinfo'); 
     51                $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','groupinfo'); 
     52                $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','msg'); 
     53                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.261'; 
     54                return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
     55        } 
     56         
    1257        $test[] = '1.261'; 
    1358        function expressoAdmin1_2_upgrade1_261() 
     
    4489        { 
    4590                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.0.005'; 
     91                //$GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop groupinfo"); 
     92                //$GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop appinfo"); 
     93                //$GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop msg");/ 
     94         
    4695                return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
    4796        } 
    4897        $test[] = '2.0.005'; 
    49         function expressoAdmin1_2_upgrade2_0_005() 
    50         { 
    51                 $GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop groupinfo"); 
    52                 $GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop appinfo"); 
    53                 $GLOBALS['phpgw_setup']->db->query("alter table phpgw_expressoadmin_log drop msg");              
    54                 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.1.000'; 
    55                 return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
    56         } 
    57         $test[] = '2.1.000'; 
    58         function expressoAdmin1_2_upgrade2_1_000() 
    59         { 
    60                 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.2.000'; 
    61                 return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
    62         } 
    63         $test[] = '2.2.000'; 
    64         function expressoAdmin1_2_upgrade2_2_000() 
    65         { 
    66                 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.2.1'; 
    67                 return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 
    68         } 
    69         $test[] = '2.2.1';  
    70         function expressoAdmin1_2_upgrade2_2_1()  
     98        function expressoAdmin1_2_upgrade2_0_005() { 
     99                $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.0.006'; 
     100                $GLOBALS['phpgw_setup']->db->query(" 
     101 
     102                    DROP SEQUENCE IF EXISTS seq_phpgw_expressoadmin_configuration; 
     103                    CREATE SEQUENCE seq_phpgw_expressoadmin_configuration 
     104                      INCREMENT 1 
     105                      MINVALUE 1 
     106                      MAXVALUE 9223372036854775807 
     107                      START 93 
     108                      CACHE 1; 
     109                    ALTER TABLE seq_phpgw_expressoadmin_configuration OWNER TO ".$GLOBALS['phpgw_domain']['default']['db_user']."; 
     110 
     111 
     112                    DROP TABLE IF EXISTS phpgw_expressoadmin_configuration; 
     113                    CREATE TABLE phpgw_expressoadmin_configuration 
     114                    ( 
     115                      id integer NOT NULL DEFAULT nextval(('seq_phpgw_expressoadmin_configuration'::text)::regclass), 
     116                      email_user character varying(100), 
     117                      configuration_type character varying(30) NOT NULL, 
     118                      email_max_recipient integer DEFAULT 0, 
     119                      email_user_type character varying(1), 
     120                      email_quota integer, 
     121                      email_recipient character varying(50), 
     122                      CONSTRAINT phpgw_expressoadmin_configuration_pkey PRIMARY KEY (id) 
     123                    ) 
     124                    WITH ( 
     125                      OIDS=TRUE 
     126                    ); 
     127 
     128                    DROP INDEX IF EXISTS configuration_type_indice; 
     129                    CREATE INDEX configuration_type_indice 
     130                      ON phpgw_expressoadmin_configuration 
     131                      USING btree 
     132                      (configuration_type); 
     133                    ALTER TABLE phpgw_expressoadmin_configuration CLUSTER ON configuration_type_indice; 
     134 
     135                    DROP INDEX IF EXISTS email_user_indice; 
     136                    CREATE INDEX email_user_indice 
     137                      ON phpgw_expressoadmin_configuration 
     138                      USING btree 
     139                      (email_user); 
     140                    ALTER TABLE phpgw_expressoadmin_configuration CLUSTER ON email_user_indice; 
     141 
     142                    DROP TABLE IF EXISTS phpgw_expressoadmin_acls; 
     143                    CREATE TABLE phpgw_expressoadmin_acls 
     144                    ( 
     145                      manager_lid character varying(50) NOT NULL, 
     146                      context character varying(255) NOT NULL, 
     147                      acl_name character varying(255) NOT NULL 
     148                    ) 
     149                    WITH ( 
     150                      OIDS=TRUE 
     151                    ); 
     152                    ALTER TABLE phpgw_expressoadmin_acls OWNER TO ".$GLOBALS['phpgw_domain']['default']['db_user']."; 
     153 
     154 
     155                    DROP INDEX IF EXISTS manager_lid_indice; 
     156                    CREATE INDEX manager_lid_indice 
     157                      ON phpgw_expressoadmin_acls 
     158                      USING btree 
     159                      (manager_lid); 
     160                    ALTER TABLE phpgw_expressoadmin_acls CLUSTER ON manager_lid_indice; 
     161 
     162 
     163                "); 
     164 
     165                 $GLOBALS['phpgw_setup']->db->query("SELECT * FROM phpgw_expressoadmin"); 
     166                 $results = array(); 
     167 
     168                function safeBitCheck($number,$comparison) 
     169        { 
     170                    $binNumber = base_convert($number,10,2); 
     171                    $binComparison = strrev(base_convert($comparison,10,2)); 
     172                            $str = strlen($binNumber); 
     173 
     174                    if ( ($str <= strlen($binComparison)) && ($binComparison{$str-1}==="1") ) 
     175                            return '1'; 
     176                    else 
     177                            return '0'; 
     178        } 
     179 
     180                function make_array_acl($acl) 
     181        { 
     182 
     183                        $array_acl_tmp = array(); 
     184                        $tmp = array(           "acl_add_users", 
     185                                                                "acl_edit_users", 
     186                                                                "acl_delete_users", 
     187                                                                "acl_EMPTY1", 
     188                                                                "acl_add_groups", 
     189                                                                "acl_edit_groups", 
     190                                                                "acl_delete_groups", 
     191                                                                "acl_change_users_password", 
     192                                                                "acl_add_maillists", 
     193                                                                "acl_edit_maillists", 
     194                                                                "acl_delete_maillists", 
     195                                                                "acl_EMPTY2", 
     196                                                                "acl_create_sectors", 
     197                                                                "acl_edit_sectors", 
     198                                                                "acl_delete_sectors", 
     199                                                                "acl_edit_sambausers_attributes", 
     200                                                                "acl_view_global_sessions", 
     201                                                                "acl_view_logs", 
     202                                                                "acl_change_users_quote", 
     203                                                                "acl_set_user_default_password", 
     204                                                                "acl_create_computers", 
     205                                                                "acl_edit_computers", 
     206                                                                "acl_delete_computers", 
     207                                                                "acl_rename_users", 
     208                                                                "acl_edit_sambadomains", 
     209                                                                "acl_view_users", 
     210                                                                "acl_edit_email_groups", 
     211                                                                "acl_empty_user_inbox", 
     212                                                                "acl_manipulate_corporative_information", 
     213                                                                "acl_edit_users_picture", 
     214                                                                "acl_edit_scl_email_lists", 
     215                                                                "acl_edit_users_phonenumber", 
     216                                                                "acl_add_institutional_accounts", 
     217                                                                "acl_edit_institutional_accounts", 
     218                                                                "acl_remove_institutional_accounts", 
     219                                                                "acl_add_shared_accounts", 
     220                                                                "acl_edit_shared_accounts", 
     221                                                                "acl_delete_shared_accounts", 
     222                                                                "acl_edit_shared_accounts_acl", 
     223                                                                "acl_edit_shared_accounts_quote", 
     224                                                                "acl_empty_shared_accounts_inbox" 
     225                                                                ); 
     226 
     227                        foreach ($tmp as $index => $right) 
     228        { 
     229                                $bin = ''; 
     230                                for ($i=0; $i<$index; $i++) 
     231                                { 
     232                                        $bin .= '0'; 
     233                                } 
     234                                $bin = '1' . $bin; 
     235 
     236                                $array_acl[$right] = safeBitCheck(bindec($bin), $acl); 
     237        } 
     238                        return $array_acl; 
     239                } 
     240 
     241                 while($GLOBALS['phpgw_setup']->db->next_record()) 
     242                     array_push($results, $GLOBALS['phpgw_setup']->db->row()); 
     243 
     244                 foreach ($results as $result) 
     245                 { 
     246                    $manager_info = make_array_acl($result['acl']); 
     247 
     248 
     249                   foreach ($manager_info as $info => $value) 
     250                    { 
     251                        $acl  = strstr($info, 'acl_'); 
     252 
     253                        if ($acl !== false) 
    71254        {  
    72             $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.2.2';  
     255 
     256                                $fields = array( 
     257                                                'manager_lid' => $result['manager_lid'], 
     258                                                'context' =>    $result['context'], 
     259                                                'acl_name' => $info, 
     260                                               ); 
     261 
     262 
     263                                $GLOBALS['phpgw_setup']->db->insert('phpgw_expressoadmin_acls', $fields); 
     264                            
     265                        } 
     266 
     267                    } 
     268 
     269                 } 
     270 
    73271            return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];  
    74272        }  
Note: See TracChangeset for help on using the changeset viewer.