fix bug reported on devel-list:

egw_cache::get_provider(Instance) no provider found (error instanciating provider egw_cache_files: egw_cache_files::__construct() server/temp_dir
--> made egw_cache::get_config_value public, so egw_cache_files can use it and for regular egw sessions read install_id and temp_dir together with system_charset, before calling config::read()
This commit is contained in:
Ralf Becker 2011-08-29 05:58:54 +00:00
parent edab2bd248
commit ae5cde8259
3 changed files with 11 additions and 22 deletions

View File

@ -117,14 +117,17 @@ class egw extends egw_minimal
}
exit;
}
// Set the DB's client charset if a system-charset is set
$system_charset = $GLOBALS['egw_info']['server']['system_charset'] = $this->db->select(config::TABLE,'config_value',array(
// Set the DB's client charset if a system-charset is set and some other values needed by egw_cache (used in config::read)
foreach($GLOBALS['egw_info']['server']['system_charset'] = $this->db->select(config::TABLE,'config_name,config_value',array(
'config_app' => 'phpgwapi',
'config_name' => 'system_charset',
),__LINE__,__FILE__)->fetchColumn();
if ($system_charset)
'config_name' => array('system_charset','install_id','temp_dir'),
),__LINE__,__FILE__) as $row)
{
$this->db->Link_ID->SetCharSet($system_charset);
$GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value'];
}
if ($GLOBALS['egw_info']['server']['system_charset'])
{
$this->db->Link_ID->SetCharSet($GLOBALS['egw_info']['server']['system_charset']);
}
// load up the $GLOBALS['egw_info']['server'] array
$GLOBALS['egw_info']['server'] += config::read('phpgwapi');

View File

@ -452,7 +452,7 @@ class egw_cache
* @param boolean $throw=true throw an exception, if we can't retriev the value
* @return string|boolean string with config or false if not found and !$throw
*/
static protected function get_system_config($name,$throw=true)
static public function get_system_config($name,$throw=true)
{
if(!isset($GLOBALS['egw_info']['server'][$name]))
{

View File

@ -45,21 +45,7 @@ class egw_cache_files implements egw_cache_provider
}
else
{
if(!isset($GLOBALS['egw_info']['server']['temp_dir']))
{
if (isset($GLOBALS['egw_setup']) && isset($GLOBALS['egw_setup']->db))
{
$GLOBALS['egw_info']['server']['temp_dir'] = $GLOBALS['egw_setup']->db->select(config::TABLE,'config_value',array(
'config_app' => 'phpgwapi',
'config_name' => 'temp_dir',
),__LINE__,__FILE__)->fetchColumn();
}
if (!$GLOBALS['egw_info']['server']['temp_dir'])
{
throw new Exception (__METHOD__."() server/temp_dir is NOT set!");
}
}
$this->base_path = $GLOBALS['egw_info']['server']['temp_dir'].'/egw_cache';
$this->base_path = egw_cache::get_system_config('temp_dir').'/egw_cache';
}
if (!isset($this->base_path) || !file_exists($this->base_path) && !mkdir($this->base_path,0700,true))
{