cleanup2 according to Apmuthu's list.
[fa-stable.git] / admin / inst_upgrade.php
index e948d89823b6f0e4fd4d74391a6711fbec79724e..16eee5a7a06ceaaf5c49bcc9dbecf25945650407 100644 (file)
@@ -52,17 +52,13 @@ function get_installers()
 //
 //     Apply one differential data set.
 //
-function upgrade_step($index, $company, $conn
+function upgrade_step($inst, $company, $conn, $force
 {
-       global $path_to_root, $installers;
+       global $path_to_root;
 
-       $inst = $installers[$index];
        $pref = $conn['tbpref'];
        $ret = true;
 
-       $force = get_post('force_'.$index);
-       if ($force || get_post('install_'.$index)) 
-       {
                $state = $inst->installed($pref);
                if (!$state || $force) 
                {
@@ -86,7 +82,6 @@ function upgrade_step($index, $company, $conn)
                                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;
 }
 
@@ -110,7 +105,11 @@ if (get_post('Upgrade'))
        // apply all upgrade data
                foreach ($installers as $i => $inst) 
                {
-                       $ret = upgrade_step($i, $comp, $conn);
+
+                       $force = get_post('force_'.$i);
+                       if ($force || get_post('install_'.$i)) 
+                               $ret = upgrade_step($installers[$i], $comp, $conn, $force);
+
                        if (!$ret)
                        {
                                display_error(
@@ -180,4 +179,3 @@ end_form();
 
 end_page();
 
-?>
\ No newline at end of file