X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Finst_upgrade.php;h=5084954f1edb6228acca81a11ff3ad605cff77e5;hb=ade8fddea8e317ab91f9e57ca138f9f9f5cc7d8c;hp=ecfc5b899d821e2cbaa513d75fd31dac47f3dab2;hpb=676c52e955fba6ea4095816a44233404d73f90ce;p=fa-stable.git diff --git a/admin/inst_upgrade.php b/admin/inst_upgrade.php index ecfc5b89..5084954f 100644 --- a/admin/inst_upgrade.php +++ b/admin/inst_upgrade.php @@ -13,7 +13,7 @@ $page_security = 'SA_SOFTWAREUPGRADE'; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); -page(_("Software Upgrade")); +page(_($help_context = "Software Upgrade")); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/admin/db/company_db.inc"); @@ -29,10 +29,11 @@ include_once($path_to_root . "/includes/ui.inc"); // function check_table($pref, $table, $field=null, $properties=null) { - $fields = @db_query("SHOW COLUMNS FROM ".$pref.$table); - if (!$fields) + $tables = @db_query("SHOW TABLES LIKE '".$pref.$table."'"); + if (!db_num_rows($tables)) return 1; // no such table or error + $fields = @db_query("SHOW COLUMNS FROM ".$pref.$table); if (!isset($field)) return 0; // table exists @@ -101,10 +102,16 @@ function upgrade_step($index, $conn) if (!$inst->pre_check($pref, $force)) return false; $sql = $inst->sql; + error_log(sprintf(_("Database upgrade for company '%s' (%s:%s*) started..."), + $conn['name'], $conn['dbname'], $conn['tbpref'])); + if ($sql != '') $ret &= db_import($path_to_root.'/sql/'.$sql, $conn, $force); $ret &= $inst->install($pref, $force); + + error_log(_("Database upgrade finished.")); + } else if ($state!==true) { display_error(_("Upgrade cannot be done because database has been already partially upgraded. Please downgrade database to clean previous version or try forced upgrade.")); @@ -163,11 +170,12 @@ if (get_post('Upgrade')) $_SESSION["wa_current_user"]->prefs = new user_prefs($user); display_notification(_('All companies data has been successfully updated')); } + unset($_SESSION['SysPrefs']); // re-read system setup $Ajax->activate('_page_body'); } start_form(); -start_table($table_style); +start_table(TABLESTYLE); $th = array(_("Version"), _("Description"), _("Sql file"), _("Install"), _("Force upgrade")); table_header($th);