Changeset 3975
- 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:
- freepbx/trunk (modified) (1 prop)
- freepbx/trunk/amp_conf/bin/retrieve_iax_conf_from_mysql.pl (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl (modified) (2 diffs)
- freepbx/trunk/amp_conf/bin/retrieve_parse_amportal_conf.pl (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/retrieve_queues_conf_from_mysql.pl (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/retrieve_zap_conf_from_mysql.pl (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/modules/core/functions.inc.php (modified) (5 diffs)
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 96 96 } 97 97 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";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"; 100 100 101 101 print EXTEN $warning_banner; freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl
r3920 r3975 64 64 $zaplabel="Zap \%c"; 65 65 $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"; 67 67 while( $line = <ZAPATA> ) { 68 68 next if $line =~ /^(\s)*$/; … … 199 199 } 200 200 201 open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ( !$)\n";201 open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n"; 202 202 print EXTEN $warning_banner; 203 203 freepbx/trunk/amp_conf/bin/retrieve_parse_amportal_conf.pl
r3859 r3975 16 16 ); 17 17 18 open(AMPCONF, $filename) or die "Cannot open $filename ";18 open(AMPCONF, $filename) or die "Cannot open $filename ($!)"; 19 19 20 20 while (<AMPCONF>) freepbx/trunk/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
r3920 r3975 88 88 } 89 89 90 open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf ( !$)\n";90 open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf ($!)\n"; 91 91 print EXTEN $warning_banner; 92 92 freepbx/trunk/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
r3920 r3975 93 93 } 94 94 95 open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf ( !$)\n";95 open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf ($!)\n"; 96 96 print EXTEN $warning_banner; 97 97 freepbx/trunk/amp_conf/htdocs/admin/modules/core/functions.inc.php
r3974 r3975 1636 1636 global $amp_conf; 1637 1637 1638 if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3"))1638 if ($amp_conf["AMPDBENGINE"] == "sqlite3") 1639 1639 { 1640 // TODO: sqlite work arround - diego 1640 // TODO: sqlite work arround - diego 1641 // TODO: WILL NOT WORK, need to remove the usage of SUBSTRING 1641 1642 // need to reorder the trunks in PHP code 1642 1643 $sqlstr = "SELECT t.variable, t.value, d.value state FROM `globals` t "; … … 1877 1878 //get outbound routes for a given trunk 1878 1879 function 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 1881 1889 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 1883 1899 } 1884 1900 // array(routename=>priority) … … 1905 1921 global $amp_conf; 1906 1922 1907 if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") )1923 if ($amp_conf["AMPDBENGINE"] == "sqlite3") 1908 1924 { 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 :) 1910 1928 $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 } 1911 1933 } 1912 1934 else … … 2052 2074 } 2053 2075 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 2055 2081 // we SUBSTRING() to remove "outrt-" 2056 2082 $routepriority = $db->getAll($sql); … … 2058 2084 die($routepriority->getMessage()); 2059 2085 } 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 2060 2090 return ($routepriority); 2061 2062 2091 } 2063 2092
Download in other formats:
