forked from extern/egroupware
check and increment app_id, or set random value if api version >= 0.9.13.015
This commit is contained in:
parent
09602fec0c
commit
39bd4f6318
@ -223,6 +223,10 @@
|
||||
else
|
||||
{
|
||||
$appstbl = 'phpgw_applications';
|
||||
if($this->amorethanb($setup_info['phpgwapi']['currentver'],'0.9.13.014'))
|
||||
{
|
||||
$use_appid = True;
|
||||
}
|
||||
}
|
||||
|
||||
if($DEBUG)
|
||||
@ -237,9 +241,26 @@
|
||||
{
|
||||
$tables = implode(',',$setup_info[$appname]['tables']);
|
||||
}
|
||||
if($use_appid)
|
||||
{
|
||||
$this->db->query("SELECT MAX(app_id) FROM $appstbl");
|
||||
$this->db->next_record();
|
||||
if($this->db->f(0))
|
||||
{
|
||||
$app_id = ($this->db->f(0) + 1) . ',';
|
||||
$app_idstr = 'app_id,';
|
||||
}
|
||||
else
|
||||
{
|
||||
srand(100000);
|
||||
$app_id = rand(1,100000) . ',';
|
||||
$app_idstr = 'app_id,';
|
||||
}
|
||||
}
|
||||
$this->db->query("INSERT INTO $appstbl "
|
||||
. "(app_name,app_title,app_enabled,app_order,app_tables,app_version) "
|
||||
. "($app_idstr app_name,app_title,app_enabled,app_order,app_tables,app_version) "
|
||||
. "VALUES ("
|
||||
. $app_id
|
||||
. "'" . $setup_info[$appname]['name'] . "',"
|
||||
. "'" . $setup_info[$appname]['title'] . "',"
|
||||
. $enable . ","
|
||||
|
Loading…
Reference in New Issue
Block a user