From: Michael M Slusarz Date: Wed, 28 Jul 2010 22:56:41 +0000 (-0600) Subject: Some H4 updates X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ca5ba13640752a349e51a3bf9f9e9e93d9659329;p=horde.git Some H4 updates --- diff --git a/horde/scripts/import_squirrelmail_file_prefs.php b/horde/scripts/import_squirrelmail_file_prefs.php index db75dd766..bd284f2df 100755 --- a/horde/scripts/import_squirrelmail_file_prefs.php +++ b/horde/scripts/import_squirrelmail_file_prefs.php @@ -53,13 +53,11 @@ foreach($files as $file) { // Set current user $user = substr(basename($file), 0, -5); - Horde_Auth::setAuth($user, array()); + $registry->setAuth($user, array()); $cli->message('Importing ' . $user . '\'s preferences'); // Reset user prefs - unset($prefs); $prefs = Horde_Prefs::factory($conf['prefs']['driver'], 'horde', $user, null, null, false); - unset($prefs_cache); $prefs_cache = array(); // Read pref file, one line at a time @@ -79,8 +77,7 @@ foreach($files as $file) { $value = substr($pref, $equalsAt + 1); /* this is to 'rescue' old-style highlighting rules. */ if (substr($key, 0, 9) == 'highlight') { - $key = 'highlight' . $highlight_num; - $highlight_num ++; + $key = 'highlight' . $highlight_num++; } if ($value != '') { diff --git a/horde/scripts/import_squirrelmail_sql_prefs.php b/horde/scripts/import_squirrelmail_sql_prefs.php index c6c3b4ace..8f489950a 100755 --- a/horde/scripts/import_squirrelmail_sql_prefs.php +++ b/horde/scripts/import_squirrelmail_sql_prefs.php @@ -31,15 +31,16 @@ require_once dirname(__FILE__) . '/import_squirrelmail_prefs.php'; // Connect to database. $db = DB::connect($dsn); -if (is_a($db, 'PEAR_Error')) { +if ($db instanceof PEAR_Error) { $cli->fatal($db->toString()); } // Loop through SquirrelMail address books. $handle = $db->query('SELECT user, prefkey, prefval FROM userprefs ORDER BY user'); -if (is_a($handle, 'PEAR_Error')) { +if ($handle instanceof PEAR_Error) { $cli->fatal($handle->toString()); } + $user = null; $prefs_cache = array(); while ($row = $handle->fetchRow(DB_FETCHMODE_ASSOC)) { @@ -54,13 +55,14 @@ while ($row = $handle->fetchRow(DB_FETCHMODE_ASSOC)) { $prefs_cache[$row['prefkey']] = $row['prefval']; } + importPrefs(); function importPrefs() { global $cli, $conf, $user, $prefs_cache; - Horde_Auth::setAuth($user, array()); + $GLOBALS['registry']->setAuth($user, array()); $cli->message('Importing ' . $user . '\'s preferences'); $prefs = Horde_Prefs::factory($conf['prefs']['driver'], 'horde', $user, null, null, false); savePrefs($user, null, $prefs_cache); diff --git a/horde/scripts/upgrades/migrate_user_categories.php b/horde/scripts/upgrades/migrate_user_categories.php index c5bb4a6d7..821986086 100755 --- a/horde/scripts/upgrades/migrate_user_categories.php +++ b/horde/scripts/upgrades/migrate_user_categories.php @@ -30,7 +30,7 @@ foreach ($users as $user) { echo 'Migrating prefs for ' . $cli->bold($user); // Set $user as the current user. - Horde_Auth::setAuth($user, array(), ''); + $registry->setAuth($user, array()); // Fetch current categories and colors. $colors = $cManager->colors();