Removed sparse parameter in write_customer()
[fa-stable.git] / admin / inst_upgrade.php
index 5fc66fc810378507edcc72488c4b74e01670a546..183221e1ada5c451ee715e3af6ad346261432296 100644 (file)
@@ -50,7 +50,7 @@ if (get_post('Upgrade'))
 $i = find_submit('Clear');
 if ($i != -1)
 {
-  unlink($path_to_root.'/tmp/upgrade.'.$i.'.log');
+  unlink(VARLOG_PATH.'/upgrade.'.$i.'.log');
   $Ajax->activate('_page_body');
 }
 if (get_post('_select_comp_update'))
@@ -63,6 +63,7 @@ start_form();
 $th = array(_("Company"), _("Table set"), _("Current version"), _("Last log"), _('Upgrade'));
 start_table(TABLESTYLE);
 table_header($th);
+$k = 0; //row colour counter
 
 $uptodate = true;
 foreach($site_status as $i => $comp)
@@ -76,7 +77,7 @@ foreach($site_status as $i => $comp)
 
        label_cell($comp['version'], 'align=center' .($status ? '':' class=redfg')/*, 'class='.( $status ? 'ok' : 'error')*/);
 
-       $log = $path_to_root.'/tmp/upgrade.'.$i.'.log';
+       $log = VARLOG_PATH.'/upgrade.'.$i.'.log';
        if (file_exists($log))
        {
                label_cell(viewer_link(_('View log'), "admin/view/view_upgrade_log.php?id=$i", null, $i, 'log.png')
@@ -85,7 +86,6 @@ foreach($site_status as $i => $comp)
        } else
                label_cell('-', 'align=center');
 
-
        if (!$status)
        {
                label_cell(radio(null, 'select_comp', $i, null, true), 'align=center');
@@ -102,8 +102,14 @@ div_start('upgrade_args');
 if (get_post('select_comp') !== '')
 {
        $patch = @$installers[$site_status[get_post('select_comp')]['version']];
-       if ($patch)
-               $patch->show_params(get_post('select_comp'));
+       if ($patch) {
+               if (!set_global_connection(get_post('select_comp'))) // create page in target database context
+                       display_error(_("Cannot connect to company database for database restore."));
+               else {
+                       $patch->show_params(get_post('select_comp'));
+                       set_global_connection(); // switch back
+               }
+       }
 }
 div_end();