Changeset 9423

Show
Ignore:
Timestamp:
03/28/10 06:32:41 (3 years ago)
Author:
mbrevda
Message:

dont run final sql array if its blank, update from 2.6 sytle tables if they exist

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/fax/install.php

    r9137 r9423  
    5050  } 
    5151} 
     52 
     53//check for 2.6-style tables 
     54$sql='describe fax_incoming'; 
     55$fields=$db->getAssoc($sql); 
     56if(array_key_exists('faxdestination',$fields)){ 
     57  out(_('Migrating fax_incoming table...')); 
     58  $sql='alter table fax_incoming  
     59        change faxdetection detection varchar(20) default NULL,  
     60        change faxdetectionwait detectionwait varchar(5) default NULL, 
     61        change faxdestination destination varchar(50) default NULL, 
     62        add legacy_email varchar(50) default NULL, 
     63        drop faxenabled, 
     64        modify extension varchar(50)'; 
     65  $q=$db->query($sql); 
     66  if(DB::IsError($q)){ 
     67    out(_('WARINING: fax_incoming table may still be using the 2.6 schema!')); 
     68  } else { 
     69    out(_('Sucsessfuly migraded fax_incoming table!')); 
     70  } 
     71} 
     72unset($sql); 
     73 
    5274/* migrate simu_fax from core to fax module, including in miscdests module in case it is being used as a destination. 
    5375   this migration is a bit "messy" but assures that any simu_fax settings or destinations being used in the dialplan 
     
    94116if(!$set['force_detection']){$sql[]='REPLACE INTO fax_details (`key`, `value`) VALUES ("force_detection","no")';} 
    95117  
    96 foreach ($sql as $statement){ 
    97   $check = $db->query($statement); 
    98   if (DB::IsError($check)){ 
    99     die_freepbx( "Can not execute $statement : " . $check->getMessage() .  "\n"); 
    100   } 
    101 
    102  
     118if($sql){ 
     119  foreach ($sql as $statement){ 
     120    $check = $db->query($statement); 
     121    if (DB::IsError($check)){ 
     122      die_freepbx( "Can not execute $statement : " . $check->getMessage() .  "\n"); 
     123    } 
     124  } 
     125
    103126/* 
    104127incoming columns: