Changeset 4996

Show
Ignore:
Timestamp:
09/04/07 21:19:43 (1 year ago)
Author:
p_lindheimer
Message:

Merged revisions 4133-4134,4136-4139,4141-4145,4147,4151-4152,4156-4169,4172,4175,4177-4178,4181-4199,4201-4218,4220-4221,4223-4228,4230-4237,4239-4248,4250-4256,4259-4261,4265-4268,4270-4271,4274-4276,4278-4280,4283-4288,4290-4292,4294-4298,4300-4306,4310-4321,4323-4327,4329-4334,4340-4342,4344-4347,4350,4360-4362,4365,4373,4375-4376,4380,4382,4385,4387,4390-4393,4396,4399,4401-4403,4406,4408,4420,4422-4423,4426-4427,4431,4433-4434,4436-4438,4440-4441,4447,4454,4457,4461,4464-4467,4473-4476,4481,4483-4510,4512-4513,4515-4524,4526-4527,4537-4550,4552-4560,4562-4590,4592-4593,4595-4598,4600-4603,4605,4607-4608,4610-4612,4614,4616-4617,4621-4622,4626-4627,4629-4632,4635,4638-4660,4663-4666,4670,4675-4676,4678-4680,4683-4685,4689,4692,4694-4695,4697-4698,4702,4706,4712-4716,4718-4722,4724-4725,4727-4730,4732-4741,4751-4757,4762-4763,4769-4770,4780-4851,4854-4864,4866-4868,4871-4873,4876-4878,4880-4881,4885,4888-4891,4894,4896-4899,4901-4915,4921-4926,4928-4942,4946,4948-4958,4960-4961,4963-4971,4973,4975-4977,4980-4983,4985-4989,4991-4995 via svnmerge from
https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.3

........

r4994 | diego_iastrubni | 2007-09-04 01:41:18 -0700 (Tue, 04 Sep 2007) | 6 lines


SQLite3 support:

  • db_connect: load the sqlite3 module if not already loaded
  • functions.inc.php: when dieing because of SQL errors do tell the SQL error (will affect also MySQL setups, but on a positive way)
  • retrieve_conf,install_amp: remove deprecated code for sqlite2 support. it was announced and db_connect does not support it, so this is a bug fix.

........

r4995 | p_lindheimer | 2007-09-04 20:44:16 -0700 (Tue, 04 Sep 2007) | 1 line


declare db as global in fatal and make sure db connection is open before logging errors to notificaion table

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk

    • Property svnmerge-integrated changed from /freepbx/branches/2.2:1-2983 /freepbx/branches/2.3:1-4129,4131,4133-4134,4136-4992 to /freepbx/branches/2.2:1-2983 /freepbx/branches/2.3:1-4129,4131,4133-4134,4136-4995
  • freepbx/trunk/amp_conf/bin/freepbx-cron-scheduler.php

    r4993 r4996  
    2525 
    2626function fatal($text, $extended_text="", $type="FATAL") { 
     27        global $db; 
     28 
    2729        echo "[$type] ".$text." ".$extended_text."\n"; 
    2830 
    29         $nt = notifications::create($db); 
    30         $nt->add_critical('cron_manager', $type, $text, $extended_text); 
     31        if(!DB::isError($db)) { 
     32                $nt = notifications::create($db); 
     33                $nt->add_critical('cron_manager', $type, $text, $extended_text); 
     34        } 
    3135 
    3236        exit(1); 
  • freepbx/trunk/amp_conf/bin/retrieve_conf

    r4993 r4996  
    3737 
    3838function fatal($text, $extended_text="", $type="FATAL") { 
     39        global $db; 
     40 
    3941        echo "[$type] ".$text." ".$extended_text."\n"; 
    4042 
    41         $nt = notifications::create($db); 
    42         $nt->add_critical('retrieve_conf', $type, $text, $extended_text); 
     43        if(!DB::isError($db)) { 
     44                $nt = notifications::create($db); 
     45                $nt->add_critical('retrieve_conf', $type, $text, $extended_text); 
     46        } 
    4347 
    4448        exit(1); 
     
    235239         
    236240        case "sqlite": 
    237                 require_once('DB/sqlite.php'); 
    238          
    239                 if (!isset($amp_conf["AMPDBFILE"])) 
    240                         fatal(_("AMPDBFILE not setup properly"),sprintf(_("You must setup properly AMPDBFILE in %s "), $amportalconf)); 
    241          
    242                 if (isset($amp_conf["AMPDBFILE"]) == "") 
    243                         fatal(_("AMPDBFILE not setup properly"),sprintf(_("AMPDBFILE in %s cannot be blank"), $amportalconf)); 
    244          
    245                 $DSN = array ( 
    246                         "database" => $amp_conf["AMPDBFILE"], 
    247                         "mode" => 0666 
    248                 ); 
    249          
    250                 $db = new DB_sqlite(); 
    251                 $db->connect( $DSN ); 
     241                die_freepbx("SQLite2 support is deprecated. Please use sqlite3 only."); 
    252242                break; 
    253243         
     
    258248                if (isset($amp_conf["AMPDBFILE"]) == "") 
    259249                        fatal("AMPDBFILE in $amportalconf cannot be blank"); 
     250 
     251                /* on centos this extension is not loaded by default */ 
     252                if (! extension_loaded('sqlite3.so') ) 
     253                        dl('sqlite3.so'); 
     254 
     255                if (! @require_once('DB/sqlite3.php') ) 
     256                { 
     257                        die_freepbx("Your PHP installation has no PEAR/SQLite3 support. Please install php-sqlite3 and php-pear."); 
     258                } 
    260259 
    261260                require_once('DB/sqlite3.php'); 
  • freepbx/trunk/amp_conf/htdocs/admin/common/db_connect.php

    r4993 r4996  
    4343                        die_freepbx("AMPDBFILE in /etc/amportal.conf cannot be blank"); 
    4444 
    45                 require_once('DB/sqlite3.php'); 
     45                /* on centos this extension is not loaded by default */ 
     46                if (! extension_loaded('sqlite3.so') ) 
     47                        dl('sqlite3.so'); 
     48 
     49                if (! @require_once('DB/sqlite3.php') ) 
     50                { 
     51                        die_freepbx("Your PHP installation has no PEAR/SQLite3 support. Please install php-sqlite3 and php-pear."); 
     52                } 
     53 
    4654                $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666"; 
    4755                $db = DB::connect($datasource); 
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r4993 r4996  
    668668        $results = $db->$type($sql,$fetchmode); 
    669669        if(DB::IsError($results)) { 
    670                 die_freepbx($results->getDebugInfo()); 
     670                die_freepbx($results->getDebugInfo() . "SQL - <br> $sql" ); 
    671671        } 
    672672        return $results; 
  • freepbx/trunk/install_amp

    r4993 r4996  
    905905         
    906906        case "sqlite": 
    907                 if (! @ include('DB/sqlite.php')) 
    908                 { 
    909                         out("FAILED"); 
    910                         fatal( "Your PHP installation lacks SQLite support" ); 
    911                 } 
    912          
    913                 if (!isset($amp_conf["AMPDBFILE"])) 
    914                         die("You must setup properly AMPDBFILE in ".AMP_CONF); 
    915          
    916                 if (isset($amp_conf["AMPDBFILE"]) == "") 
    917                         die("AMPDBFILE in ".AMP_CONF." cannot be blank"); 
    918          
    919                 $DSN = array ( 
    920                         "database" => $amp_conf["AMPDBFILE"], 
    921                         "mode" => 0666 
    922                 ); 
    923          
    924                 $db = new DB_sqlite(); 
    925                 $db->connect( $DSN ); 
     907                die_freepbx("SQLite2 support is deprecated. Please use sqlite3 only."); 
    926908                break; 
    927909         
     
    933915                        die("AMPDBFILE in /etc/amportal.conf cannot be blank"); 
    934916 
    935                 require_once('DB/sqlite3.php'); 
     917                /* on centos this extension is not loaded by default */ 
     918                if (! extension_loaded('sqlite3.so') ) 
     919                        dl('sqlite3.so'); 
     920 
     921                if (! @require_once('DB/sqlite3.php') ) 
     922                { 
     923                        out("FAILED"); 
     924                        fatal( "Your PHP installation has no PEAR/SQLite3 support. Please install php-sqlite3 and php-pear."); 
     925                } 
     926 
    936927                $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666"; 
    937928                $db = DB::connect($datasource);