From 91642e86831e090615fa1e25058e692b33a0768d Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 23 May 2006 21:15:34 +0000 Subject: bug fixed: many errors reported if your database contains something else than PhpWebGallery tables. git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1319 68402e56-0260-453c-a942-63ccdbb3a9ee --- upgrade.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/upgrade.php b/upgrade.php index ae553dc3e..c2a68a920 100644 --- a/upgrade.php +++ b/upgrade.php @@ -81,10 +81,10 @@ SHOW TABLES while ($row = mysql_fetch_row($result)) { - array_push( - $tables, - preg_replace('/^'.PREFIX_TABLE.'/', '', $row[0]) - ); + if (preg_match('/^'.PREFIX_TABLE.'/', $row[0])) + { + array_push($tables, $row[0]); + } } return $tables; @@ -102,7 +102,7 @@ function get_columns_of($tables) foreach ($tables as $table) { $query = ' -DESC '.PREFIX_TABLE.$table.' +DESC '.$table.' ;'; $result = mysql_query($query); @@ -161,10 +161,10 @@ if (!isset($_GET['version'])) $tables = get_tables(); $columns_of = get_columns_of($tables); - if (!in_array('param', $columns_of['config'])) + if (!in_array('param', $columns_of[PREFIX_TABLE.'config'])) { // we're in branch 1.3, important upgrade, isn't it? - if (in_array('user_category', $tables)) + if (in_array(PREFIX_TABLE.'user_category', $tables)) { $current_release = '1.3.1'; } @@ -173,11 +173,11 @@ if (!isset($_GET['version'])) $current_release = '1.3.0'; } } - else if (!in_array('user_cache', $tables)) + else if (!in_array(PREFIX_TABLE.'user_cache', $tables)) { $current_release = '1.4.0'; } - else if (!in_array('tags', $tables)) + else if (!in_array(PREFIX_TABLE.'tags', $tables)) { $current_release = '1.5.0'; } @@ -302,4 +302,4 @@ UPDATE '.USER_CACHE_TABLE.' // +-----------------------------------------------------------------------+ $template->pparse('upgrade'); -?> \ No newline at end of file +?> -- cgit v1.2.3