// 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
$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 != '') {
// 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)) {
$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);
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();