Changeset 3975

Show
Ignore:
Timestamp:
05/08/07 10:34:22 (6 years ago)
Author:
diego_iastrubni
Message:

Merged revisions 3960-3965 via svnmerge from
https://diego_iastrubni@svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.2

........

r3960 | diego_iastrubni | 2007-05-06 12:53:21 +0300 (Sun, 06 May 2007) | 2 lines


SUBSTRING is not supported in sqlite3 - do the need to trim down the strings in php. this one is marked as done.

........

r3961 | diego_iastrubni | 2007-05-06 13:27:35 +0300 (Sun, 06 May 2007) | 5 lines


Another merge for sqlite3 support (ticket:1727), as far as I can tell, the code is fully working now.


I added a few comments in the code which will help in the future, and some todo points. Again, as far as I can tell freePBX is fully functional after
this patch.

........

r3962 | diego_iastrubni | 2007-05-06 13:36:13 +0300 (Sun, 06 May 2007) | 2 lines


consistant code - first sqlite3, then others. remove duplicated line.

........

r3963 | diego_iastrubni | 2007-05-06 13:46:22 +0300 (Sun, 06 May 2007) | 4 lines


this patch is called "open or die".


The syntax of all teh "open die" commands has been unified, and the scripts now tell you why they failed.

........

r3965 | gregmac | 2007-05-07 19:02:20 +0300 (Mon, 07 May 2007) | 2 lines


Change php5-only syntax to work in php4

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk

    • Property svnmerge-integrated changed from /freepbx/branches/2.2:1-3724,3726-3727,3729-3732,3734-3735,3737-3738,3740-3741,3743-3745,3747,3752-3753,3755-3793,3797-3958,3966,3968,3971,3973 to /freepbx/branches/2.2:1-3724,3726-3727,3729-3732,3734-3735,3737-3738,3740-3741,3743-3745,3747,3752-3753,3755-3793,3797-3958,3960-3966,3968
  • freepbx/trunk/amp_conf/bin/retrieve_iax_conf_from_mysql.pl

    r3920 r3975  
    9696} 
    9797 
    98 open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf (!$)\n"; 
    99 open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg (!$)\n"; 
     98open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf ($!)\n"; 
     99open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg ($!)\n"; 
    100100 
    101101print EXTEN $warning_banner; 
  • freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl

    r3920 r3975  
    6464  $zaplabel="Zap \%c"; 
    6565  $lastlabelnum=0; 
    66   open ZAPATA, "<$conffile" || die "Cannot open config file: $zapataconf\n"; 
     66  open( ZAPATA, "<$conffile" ) or die "Cannot open config file: $zapataconf ($!)\n"; 
    6767  while( $line = <ZAPATA> ) { 
    6868    next if $line =~ /^(\s)*$/; 
     
    199199} 
    200200 
    201 open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf (!$)\n"; 
     201open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n"; 
    202202print EXTEN $warning_banner; 
    203203 
  • freepbx/trunk/amp_conf/bin/retrieve_parse_amportal_conf.pl

    r3859 r3975  
    1616  ); 
    1717   
    18   open(AMPCONF, $filename) or die "Cannot open $filename"; 
     18  open(AMPCONF, $filename) or die "Cannot open $filename ($!)"; 
    1919   
    2020  while (<AMPCONF>) 
  • freepbx/trunk/amp_conf/bin/retrieve_queues_conf_from_mysql.pl

    r3920 r3975  
    8888} 
    8989 
    90 open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf (!$)\n"; 
     90open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf ($!)\n"; 
    9191print EXTEN $warning_banner; 
    9292 
  • freepbx/trunk/amp_conf/bin/retrieve_zap_conf_from_mysql.pl

    r3920 r3975  
    9393} 
    9494 
    95 open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf (!$)\n"; 
     95open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf ($!)\n"; 
    9696print EXTEN $warning_banner; 
    9797 
  • freepbx/trunk/amp_conf/htdocs/admin/modules/core/functions.inc.php

    r3974 r3975  
    16361636  global $amp_conf; 
    16371637   
    1638   if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")
     1638  if ($amp_conf["AMPDBENGINE"] == "sqlite3"
    16391639  { 
    1640     // TODO: sqlite work arround - diego  
     1640    // TODO: sqlite work arround - diego 
     1641    // TODO: WILL NOT WORK, need to remove the usage of SUBSTRING 
    16411642    // need to reorder the trunks in PHP code 
    16421643    $sqlstr  = "SELECT t.variable, t.value, d.value state FROM `globals` t "; 
     
    18771878//get outbound routes for a given trunk 
    18781879function core_trunks_gettrunkroutes($trunknum) { 
    1879   $results = sql("SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll"); 
    1880    
     1880  global $amp_conf; 
     1881 
     1882  if ($amp_conf["AMPDBENGINE"] == "sqlite3") 
     1883    $sql_code = "SELECT DISTINCT              context, priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%') ORDER BY context"; 
     1884  else 
     1885    $sql_code = "SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%') ORDER BY context"; 
     1886 
     1887  $results = sql( $sql_code, "getAll" ); 
     1888 
    18811889  foreach ($results as $row) { 
    1882     $routes[$row[0]] = $row[1]; 
     1890    // original code was: 
     1891    //  $routes[$row[0]] = $row[1]; 
     1892    // but substring is not supported in sqlite3. 
     1893    // how about we remove the 2nd part of the "if"? and use the same code on all DB's? 
     1894 
     1895    $t = ($amp_conf["AMPDBENGINE"] == "sqlite3") ? substr( $row[0], 7 ) : $row[0]; 
     1896    $r = $row[1]; 
     1897    $routes[ $r ] = $t; 
     1898 
    18831899  } 
    18841900  // array(routename=>priority) 
     
    19051921  global $amp_conf; 
    19061922   
    1907   if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") ) 
     1923  if ($amp_conf["AMPDBENGINE"] == "sqlite3")  
    19081924  { 
    1909     // TODO: sqlite work arround - diego 
     1925    // SUBSTRING is not supported under sqlite3, we need to filter 
     1926    // this in php. I am not sure why "6" and not "7" 
     1927    // but I don't really care -> it works :) 
    19101928    $results = sql("SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ","getAll"); 
     1929    foreach( array_keys($results) as $idx ) 
     1930    { 
     1931       $results[$idx][0] = substr( $results[$idx][0], 6); 
     1932    } 
    19111933  } 
    19121934  else 
     
    20522074  } 
    20532075   
    2054   $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context "; 
     2076  if ( $amp_conf["AMPDBENGINE"] == "sqlite3") 
     2077    $sql = "SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context "; 
     2078  else 
     2079    $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context "; 
     2080 
    20552081        // we SUBSTRING() to remove "outrt-" 
    20562082        $routepriority = $db->getAll($sql); 
     
    20582084                die($routepriority->getMessage()); 
    20592085        } 
     2086 
     2087  // TODO: strip the context on the sqlite3 backend 
     2088  // not sure where does it effects, since this is working on my setup... 
     2089  // welcome to funky town 
    20602090        return ($routepriority); 
    2061    
    20622091} 
    20632092