Changeset 7883

Show
Ignore:
Timestamp:
07/03/09 13:49:46 (1 year ago)
Author:
p_lindheimer
Message:

fix install issue adding 'if exists' to table creation, add check for settings in custom files and show error if there are since they will override these

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.6/iaxsettings/install.php

    r7848 r7883  
    2424 
    2525$sql = <<< END 
    26 CREATE TABLE `iaxsettings` ( 
     26CREATE TABLE IF NOT EXISTS `iaxsettings` ( 
    2727  `keyword` VARCHAR (50) NOT NULL default '', 
    2828  `data`    VARCHAR (255) NOT NULL default '', 
  • modules/branches/2.6/iaxsettings/module.xml

    r7853 r7883  
    22        <rawname>iaxsettings</rawname> 
    33        <name>IAX Settings</name> 
    4         <version>2.6.0beta1.0</version> 
     4        <version>2.6.0beta1.1</version> 
    55        <type>tool</type> 
    66        <category>System Administration</category> 
     
    1414        <license>AGPLv3</license> 
    1515        <changelog> 
     16                *2.6.0beta1.1* install script 'if not exists' missing, add check for custom file content 
    1617                *2.6.0beta1.0* lots of tweaks, fixed install.php error 
    1718        </changelog> 
  • modules/branches/2.6/iaxsettings/page.iaxsettings.php

    r7855 r7883  
    102102    $iax_settings = iaxsettings_get(); 
    103103} 
     104$error_displays = array_merge($error_displays,iaxsettings_check_custom_files()); 
     105 
    104106?> 
    105107 
     
    546548  return $error_display; 
    547549} 
    548 ?> 
     550 
     551function iaxsettings_check_custom_files() { 
     552  global $amp_conf; 
     553  $errors = array(); 
     554 
     555  $custom_files[] = $amp_conf['ASTETCDIR']."/iax_general_custom.conf"; 
     556  $custom_files[] = $amp_conf['ASTETCDIR']."/iax_custom.conf"; 
     557 
     558  foreach ($custom_files as $file) { 
     559    if (file_exists($file)) { 
     560      $sip_conf = parse_ini_file($file,true); 
     561      foreach ($sip_conf as $item) { 
     562        // If setting is an array, then it is a subsection 
     563        // 
     564        if (!is_array($item)) { 
     565          $msg =  sprintf(_("Settings in %s may override these, they should be removed"),"<b>$file</b>"); 
     566          $errors[] = array( 'js' => '', 'div' => $msg); 
     567          break; 
     568        } 
     569      } 
     570    } 
     571  } 
     572  return $errors; 
     573
     574 
     575 
     576?> 
  • modules/branches/2.6/sipsettings/install.php

    r7831 r7883  
    2424 
    2525$sql = <<< END 
    26 CREATE TABLE `sipsettings` ( 
     26CREATE TABLE IF NOT EXISTS `sipsettings` ( 
    2727  `keyword` VARCHAR (50) NOT NULL default '', 
    2828  `data`    VARCHAR (255) NOT NULL default '', 
  • modules/branches/2.6/sipsettings/module.xml

    r7852 r7883  
    22        <rawname>sipsettings</rawname> 
    33        <name>SIP Settings</name> 
    4         <version>2.6.0beta1.1</version> 
     4        <version>2.6.0beta1.2</version> 
    55        <type>tool</type> 
    66        <category>System Administration</category> 
     
    1414        <license>AGPLv3</license> 
    1515        <changelog> 
     16                *2.6.0beta1.2* install script 'if not exists' missing, check for custom file content 
    1617                *2.6.0beta1.1* misc bugs, typos 
    1718                *2.6.0beta1.0* lots of tweaks, fixed install.php error 
  • modules/branches/2.6/sipsettings/page.sipsettings.php

    r7872 r7883  
    135135    $sip_settings = sipsettings_get(); 
    136136} 
     137$error_displays = array_merge($error_displays,sipsettings_check_custom_files()); 
     138 
    137139?> 
    138140 
     
    938940  return $error_display; 
    939941} 
    940 ?> 
     942 
     943function sipsettings_check_custom_files() { 
     944  global $amp_conf; 
     945  $errors = array(); 
     946 
     947  $custom_files[] = $amp_conf['ASTETCDIR']."/sip_nat.conf"; 
     948  $custom_files[] = $amp_conf['ASTETCDIR']."/sip_general_custom.conf"; 
     949  $custom_files[] = $amp_conf['ASTETCDIR']."/sip_custom.conf"; 
     950 
     951  foreach ($custom_files as $file) { 
     952    if (file_exists($file)) { 
     953      $sip_conf = parse_ini_file($file,true); 
     954      foreach ($sip_conf as $item) { 
     955        // If setting is an array, then it is a subsection 
     956        // 
     957        if (!is_array($item)) { 
     958          $msg =  sprintf(_("Settings in %s may override these, they should be removed"),"<b>$file</b>"); 
     959          $errors[] = array( 'js' => '', 'div' => $msg); 
     960          break; 
     961        } 
     962      } 
     963    } 
     964  } 
     965  return $errors; 
     966
     967 
     968 
     969?>