mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
"using exceptins (instead of depricated egw_db::hold_on_error attribute) to deal with not set up eGW"
This commit is contained in:
parent
9ba17c163c
commit
ff16b360f0
@ -84,25 +84,20 @@ class egw extends egw_minimal
|
||||
// check if eGW is already setup, if not redirect to setup/
|
||||
try {
|
||||
$this->db->connect();
|
||||
if (!($num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle()))
|
||||
{
|
||||
$phpgw_config = $this->db->select('phpgw_config','COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle();
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
//echo "<pre>Connection to DB failed (".$e->getMessage().")!\n".$e->getTraceAsString();
|
||||
}
|
||||
$buff = $this->db->Halt_On_Error;
|
||||
$this->db->Halt_On_Error = "report";
|
||||
$retval=false;
|
||||
if (is_object($this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__))) {
|
||||
$retval = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle();
|
||||
} else {
|
||||
#echo config::TABLE. " does not exist";
|
||||
}
|
||||
if ($e || !$retval)
|
||||
if ($e || !$num_config)
|
||||
{
|
||||
$setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/');
|
||||
$setup_dir = str_replace(array('home/index.php','index.php'),'setup/',$_SERVER['PHP_SELF']);
|
||||
|
||||
// we check for the old table too, to not scare updating users ;-)
|
||||
if (!$e && is_object($this->db->select('phpgw_config','COUNT(config_name)',false,__LINE__,__FILE__)) &&
|
||||
$this->db->select('phpgw_config','COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle())
|
||||
if ($phpgw_config)
|
||||
{
|
||||
throw new Exception('<center><b>Fatal Error:</b> You need to <a href="' . $setup_dir .
|
||||
'">update eGroupWare</a> before you can continue using it.</center>',999);
|
||||
@ -114,7 +109,6 @@ class egw extends egw_minimal
|
||||
}
|
||||
exit;
|
||||
}
|
||||
$this->db->Halt_On_Error = $buff;
|
||||
// Set the DB's client charset if a system-charset is set
|
||||
$system_charset = $this->db->select(config::TABLE,'config_value',array(
|
||||
'config_app' => 'phpgwapi',
|
||||
|
Loading…
Reference in New Issue
Block a user