Fixed multipart email structure.
[fa-stable.git] / admin / inst_upgrade.php
index 5084954f1edb6228acca81a11ff3ad605cff77e5..bd9e1b4ba4f6a610b639e52944ed548177a06e91 100644 (file)
@@ -69,7 +69,7 @@ function get_installers()
                while(false !== ($fname = readdir($datadir)))
                { // check all php files but index.php
                        if (!is_dir($patchdir . $fname) && ($fname != 'index.php')
-                               && stristr($fname, '.php') != false)
+                               && stristr($fname, '.php') != false && $fname[0] != '.')
                        {
                                unset($install);
                                include_once($patchdir . $fname);
@@ -121,26 +121,16 @@ function upgrade_step($index, $conn)
        return $ret;
 }
 
-function db_open($conn)
-{
-       $db = mysql_connect($conn["host"] ,$conn["dbuser"], $conn["dbpassword"]);
-       if (!$db)
-               return false;
-       if (!mysql_select_db($conn["dbname"], $db))
-               return false;
-       return $db;
-}
-
 $installers = get_installers();
 
 if (get_post('Upgrade')) 
 {
 
        $ret = true;
-       foreach ($db_connections as $conn) 
+       foreach ($db_connections as $comp => $conn) 
        {
        // connect to database
-               if (!($db = db_open($conn))) 
+               if (!(set_global_connection($comp))) 
                {
                        display_error(_("Cannot connect to database for company")
                                ." '".$conn['name']."'");
@@ -162,6 +152,7 @@ if (get_post('Upgrade'))
 //             db_close($conn); ?
                if (!$ret) break;
        }
+       set_global_connection();
        if($ret)
        {       // re-read the prefs
                global $path_to_root;
@@ -171,6 +162,7 @@ if (get_post('Upgrade'))
                display_notification(_('All companies data has been successfully updated'));
        }       
        unset($_SESSION['SysPrefs']); // re-read system setup
+       $_SESSION['SysPrefs'] = new sys_prefs();
        $Ajax->activate('_page_body');
 }