projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changes in hotkeys system for tas support.
[fa-stable.git]
/
admin
/
inst_upgrade.php
diff --git
a/admin/inst_upgrade.php
b/admin/inst_upgrade.php
index d0cb4b1a35fd81a4ef362a2a556a26d865d5786b..49c97bbd2a98047b5fd50d47fba6e93de4264fb8 100644
(file)
--- 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");
$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");
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)
{
//
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
return 1; // no such table or error
+ $fields = @db_query("SHOW COLUMNS FROM ".$pref.$table);
if (!isset($field))
return 0; // table exists
if (!isset($field))
return 0; // table exists
@@
-89,22
+90,27
@@
function upgrade_step($index, $conn)
global $path_to_root, $installers;
$inst = $installers[$index];
global $path_to_root, $installers;
$inst = $installers[$index];
- $sql = $inst->sql;
$pref = $conn['tbpref'];
$ret = true;
$force = get_post('force_'.$index);
if ($force || get_post('install_'.$index))
{
$pref = $conn['tbpref'];
$ret = true;
$force = get_post('force_'.$index);
if ($force || get_post('install_'.$index))
{
- if (!$inst->installed($pref) || $force)
+ $state = $inst->installed($pref);
+ if (!$state || $force)
{
{
- if (!$inst->pre_check($pref)) return false;
+ if (!$inst->pre_check($pref, $force)) return false;
+ $sql = $inst->sql;
if ($sql != '')
$ret &= db_import($path_to_root.'/sql/'.$sql, $conn, $force);
$ret &= $inst->install($pref, $force);
if ($sql != '')
$ret &= db_import($path_to_root.'/sql/'.$sql, $conn, $force);
$ret &= $inst->install($pref, $force);
- }
+ } 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."));
+ $ret = false;
+ }
}
return $ret;
}
}
return $ret;
}
@@
-158,16
+164,18
@@
if (get_post('Upgrade'))
$_SESSION["wa_current_user"]->prefs = new user_prefs($user);
display_notification(_('All companies data has been successfully updated'));
}
$_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();
$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);
$k = 0; //row colour counter
$th = array(_("Version"), _("Description"), _("Sql file"), _("Install"),
_("Force upgrade"));
table_header($th);
$k = 0; //row colour counter
+$partial = 0;
foreach($installers as $i => $inst)
{
alt_table_row_color($k);
foreach($installers as $i => $inst)
{
alt_table_row_color($k);
@@
-178,14
+186,27
@@
foreach($installers as $i => $inst)
// this is checked only for first (site admin) company,
// but in fact we should always upgrade all data sets after
// source upgrade.
// this is checked only for first (site admin) company,
// but in fact we should always upgrade all data sets after
// source upgrade.
- if ($inst->installed(TB_PREF))
+ $check = $inst->installed(TB_PREF);
+ if ($check === true)
label_cell(_("Installed"));
label_cell(_("Installed"));
- else
- check_cells(null,'install_'.$i, 0);
+ else
+ if (!$check)
+ check_cells(null,'install_'.$i, 0);
+ else {
+ label_cell("<span class=redfg>"
+ . sprintf(_("Partially installed (%s)"), $check) . "</span>");
+ $partial++;
+ }
+
check_cells(null,'force_'.$i, 0);
end_row();
}
end_table(1);
check_cells(null,'force_'.$i, 0);
end_row();
}
end_table(1);
+if ($partial!=0) {
+ display_note(_("Database upgrades marked as partially installed cannot be installed automatically.
+You have to clean database manually to enable them, or try to perform forced upgrade."));
+ br();
+}
submit_center('Upgrade', _('Upgrade system'), true, _('Save database and perform upgrade'), 'process');
end_form();
submit_center('Upgrade', _('Upgrade system'), true, _('Save database and perform upgrade'), 'process');
end_form();