Changeset 6386 for sandbox/2.4.1-3


Ignore:
Timestamp:
06/01/12 17:21:49 (12 years ago)
Author:
cristiano
Message:

Ticket #2768 - Migração dos contatos dinamicos para novo padrão

Location:
sandbox/2.4.1-3/expressoMail1_2/setup
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.1-3/expressoMail1_2/setup/setup.inc.php

    r5988 r6386  
    1313$setup_info['expressoMail1_2']['name'] = 'expressoMail1_2'; 
    1414$setup_info['expressoMail1_2']['title'] = 'Expresso Mail'; 
    15 $setup_info['expressoMail1_2']['version'] = '2.4.6'; 
    16 $setup_info['expressoMail1_2']['app_order'] = 2; 
    17 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_expressomail_contacts'; 
     15$setup_info['expressoMail1_2']['version'] = '2.4.7'; 
     16$setup_info['expressoMail1_2']['app_order'] = 2 
    1817$setup_info['expressoMail1_2']['tables'][] = 'phpgw_certificados'; 
    1918 
     
    2221$setup_info['expressoMail1_2']['tables'][] = 'expressomail_message_followupflag'; 
    2322$setup_info['expressoMail1_2']['tables'][] = 'expressomail_followupflag'; 
     23$setup_info['expressoMail1_2']['tables'][] = 'expressomail_dynamic_contact'; 
    2424 
    2525 
  • sandbox/2.4.1-3/expressoMail1_2/setup/tables_current.inc.php

    r5981 r6386  
    1212                'phpgw_expressomail_contacts' => array( 
    1313                        'fd' => array( 
    14                                 'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
    15                                 'data' => array( 'type' => 'text') 
     14                                'id' => array('type' => 'auto','nullable' => False), 
     15                                'owner' => array('type' => 'int','precision' => '16','nullable' => False), 
     16                                'name' => array('type' => 'varchar','precision' => '100','nullable' => true), 
     17                                'mail' => array('type' => 'varchar','precision' => '100','nullable' => False), 
     18                                'timestamp' => array('type' => 'int','precision' => '16','nullable' => False), 
    1619                        ), 
    17                         'pk' => array('id_owner'), 
     20                        'pk' => array('id'), 
    1821                        'fk' => array(), 
    1922                        'ix' => array(), 
    2023                        'uc' => array() 
    2124                ), 
     25                 
    2226        'phpgw_certificados' => array( 
    2327            'fd' => array( 
  • sandbox/2.4.1-3/expressoMail1_2/setup/tables_update.inc.php

    r6185 r6386  
    263263            return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
    264264        } 
     265 
     266        $test[] = '2.4.6'; 
     267        function expressoMail1_2_upgrade2_4_6() { 
     268                $oProc = $GLOBALS['phpgw_setup']->oProc; 
     269 
     270                //Criando nova tabela de contatos dinamicos 
     271                $oProc->CreateTable('expressomail_dynamic_contact',array( 
     272                        'fd' => array( 
     273                                'id' => array('type' => 'auto','nullable' => False), 
     274                                'owner' => array('type' => 'int','precision' => '16','nullable' => False), 
     275                                'name' => array('type' => 'varchar','precision' => '100','nullable' => true), 
     276                                'mail' => array('type' => 'varchar','precision' => '100','nullable' => False), 
     277                                'timestamp' => array('type' => 'int','precision' => '16','nullable' => False), 
     278                        ), 
     279                        'pk' => array('id'), 
     280                        'fk' => array(), 
     281                        'ix' => array(), 
     282                        'uc' => array() 
     283                        ) 
     284                ); 
     285 
     286                //Migra dados antigos para nova tabela 
     287                $oProc->query('SELECT * FROM phpgw_expressomail_contacts'); 
     288                $return = array(); 
     289        while($oProc->next_record()) 
     290                $return[$oProc->f('id_owner')] = $oProc->f('data'); 
     291 
     292        foreach ($return as $owner => &$value) { 
     293                $contacts = unserialize($value); 
     294                foreach ($contacts as &$contact) { 
     295                        $info = explode('#', $contact['email']); 
     296                        $oProc->query("INSERT INTO expressomail_dynamic_contact (owner, name ,mail , timestamp) values ('".$owner."', '".$info[0]."', '".$info[1]."', '".$contact['timestamp']."');"); 
     297                } 
     298        } 
     299        //////////////////////////////////////////////////////////// 
     300 
     301        //Deleta tabela antiga 
     302                $oProc->DropTable('phpgw_expressomail_contacts'); 
     303         
     304 
     305                $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.7'; 
     306            return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
     307        } 
    265308         
    266309?> 
Note: See TracChangeset for help on using the changeset viewer.