From b9cb241948808c27ecf4ab3a0f5907bb7e98acf4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 3 Apr 2004 13:03:01 +0000 Subject: [PATCH] killed error-message in droptable and moderniced the code a bit ;-) --- phpgwapi/inc/class.setup_process.inc.php | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/phpgwapi/inc/class.setup_process.inc.php b/phpgwapi/inc/class.setup_process.inc.php index 4475b58107..fe3ebfee3d 100644 --- a/phpgwapi/inc/class.setup_process.inc.php +++ b/phpgwapi/inc/class.setup_process.inc.php @@ -244,32 +244,40 @@ /* The following is built so below we won't try to drop a table that isn't there. */ $tablenames = $GLOBALS['phpgw_setup']->db->table_names(); - while(list($key,$val) = @each($tablenames)) + if (!is_array($setup_info) || !is_array($tablenames)) { - $tables[] = $val['table_name']; + return $setup_info; // nothing to do + } + $tables = array(); + foreach($tablenames as $data) + { + $tables[] = $data['table_name']; } - @reset($setup_info); - while(list($key,$null) = @each($setup_info)) + if (!is_array($setup_info)) { - if($setup_info[$key]['tables']) + return $setup_info; + } + foreach($setup_info as $app_name => $data) + { + if(is_array($data['tables'])) { - while(list($a,$table) = @each($setup_info[$key]['tables'])) + foreach($data['tables'] as $table) { //echo $table; if(in_array($table,$tables)) { - if($DEBUG){ echo '
process->droptables(): Dropping :'. $setup_info[$key]['name'] . ' table: ' . $table; } + if($DEBUG){ echo '
process->droptables(): Dropping :'. $app_name . ' table: ' . $table; } $GLOBALS['phpgw_setup']->oProc->DropTable($table); // Update the array values for return below - $setup_info[$key]['status'] = 'U'; + $setup_info[$app_name]['status'] = 'U'; } } } } /* Done, return current status */ - return ($setup_info); + return $setup_info; } /*!