fix IDE warnings and generate an install_id, if there is none

This commit is contained in:
Ralf Becker 2014-09-30 11:59:31 +00:00
parent 84821bef95
commit 25eae3cd06

View File

@ -302,8 +302,8 @@ class db_backup
/**
* Save the housekeeping configuration in the database and update the local variables.
*
* @param int $mincount Minimum number of backups to keep.
* @param boolean $backup_files include files in backup or not, default dont change!
* @param int $minCount Minimum number of backups to keep.
* @param boolean $backupFiles include files in backup or not, default dont change!
*/
function saveConfig($minCount,$backupFiles=null)
{
@ -341,7 +341,7 @@ class db_backup
* Backup all data in the form of a (compressed) csv file
*
* @param resource $f file opened with fopen for reading
* @param boolean $convert_to_system_charset=true convert the restored data to the selected system-charset
* @param boolean $convert_to_system_charset =true obsolet, it's now allways done
* @param string $filename ='' gives the file name which is used in case of a zip archive.
* @param boolean $protect_system_config =true should above system_config values be protected (NOT overwritten)
* @param int $insert_n_rows =10 how many rows to insert in one sql statement
@ -353,7 +353,7 @@ class db_backup
@set_time_limit(0);
ini_set('auto_detect_line_endings',true);
$convert_to_system_charset = true; // enforce now utf-8 as system charset restores of old backups
if (true) $convert_to_system_charset = true; // enforce now utf-8 as system charset restores of old backups
if ($protect_system_config)
{
@ -630,6 +630,18 @@ class db_backup
return lang('Restore failed');
}
}
// generate an install_id if we dont have one (it breaks egw_cache::flush() stalling the upgrade)
unset($GLOBALS['egw_info']['server']['install_id']);
if (!($GLOBALS['egw_info']['server']['install_id'] = egw_cache::get_system_config('install_id', false)))
{
$GLOBALS['egw_info']['server']['install_id'] = md5(microtime(true).$_SERVER['HTTP_HOST']);
$this->db->insert('egw_config', array(
'config_value' => $GLOBALS['egw_info']['server']['install_id'],
), array(
'config_name' => 'install_id',
'config_app' => 'phpgwapi',
), __LINE__, __FILE__);
}
// flush instance cache
egw_cache::flush(egw_cache::INSTANCE);