From 39bd4f6318a64ce6fb085a3401c46b96d10a11a9 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Wed, 17 Oct 2001 18:42:18 +0000 Subject: [PATCH] check and increment app_id, or set random value if api version >= 0.9.13.015 --- setup/inc/class.setup.inc.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index af0eb276a3..24b1372846 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -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 . ","