Changeset 6528 for trunk/expressoMail1_2/setup/tables_update.inc.php
- Timestamp:
- 06/15/12 17:00:17 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/sandbox/2.4.1-3 merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/expressoMail1_2/setup/tables_update.inc.php
r6255 r6528 267 267 return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 268 268 } 269 269 270 $test[] = '2.4.7'; 271 function expressoMail1_2_upgrade2_4_7() { 272 $oProc = $GLOBALS['phpgw_setup']->oProc; 273 274 //Criando nova tabela de contatos dinamicos 275 $oProc->CreateTable('expressomail_dynamic_contact',array( 276 'fd' => array( 277 'id' => array('type' => 'auto','nullable' => False), 278 'owner' => array('type' => 'int','precision' => '16','nullable' => False), 279 'name' => array('type' => 'varchar','precision' => '100','nullable' => true), 280 'mail' => array('type' => 'varchar','precision' => '100','nullable' => False), 281 'number_of_messages' => array('type' => 'int','precision' => '16','nullable' => False), 282 'timestamp' => array('type' => 'int','precision' => '16','nullable' => False), 283 ), 284 'pk' => array('id'), 285 'fk' => array(), 286 'ix' => array(), 287 'uc' => array() 288 ) 289 ); 290 291 /* Cria um indice unico para um owner e mail para nao ocorrer duplicidade em e-mails para um mesmo owner */ 292 $oProc->query("ALTER TABLE expressomail_dynamic_contact ADD CONSTRAINT owner_mail UNIQUE (owner, mail)"); 293 294 //Migra dados antigos para nova tabela 295 $oProc->query('SELECT * FROM phpgw_expressomail_contacts'); 296 $return = array(); 297 while($oProc->next_record()) 298 $return[$oProc->f('id_owner')] = $oProc->f('data'); 299 300 foreach ($return as $owner => &$value) { 301 $contacts = unserialize($value); 302 foreach ($contacts as &$contact) { 303 $info = explode('#', $contact['email']); 304 $oProc->query("INSERT INTO expressomail_dynamic_contact (owner, name ,mail , number_of_messages ,timestamp) values ('".$owner."', '".$info[0]."', '".$info[1]."', 1, '".$contact['timestamp']."');"); 305 } 306 } 307 308 //Deleta tabela antiga 309 $oProc->DropTable('phpgw_expressomail_contacts'); 310 311 /* Remove a restricao de quantidade de contatos recentes */ 312 $oProc->query("DELETE FROM phpgw_config WHERE config_app = 'expressoMail1_2' AND config_name = 'expressoMail_Number_of_dynamic_contacts'"); 313 314 $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.8'; 315 return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 316 } 270 317 ?>
Note: See TracChangeset
for help on using the changeset viewer.