mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
copy felamimail preferences to new mail app, if they still exist there
This commit is contained in:
parent
cf519cb666
commit
f2ca4d2762
@ -27,4 +27,22 @@ if (!$GLOBALS['egw_setup']->db->affected_rows())
|
||||
}
|
||||
|
||||
// change common/default_app pref to mail, if it was felamimail
|
||||
preferences::change_preference('common', 'default_app', 'mail', 'felamimail');
|
||||
preferences::change_preference('common', 'default_app', 'mail', 'felamimail');
|
||||
|
||||
// copy felamimail preferences to new mail app, if they still exist there
|
||||
preferences::copy_preferences('felamimail', 'mail', array(
|
||||
'htmlOptions',
|
||||
'allowExternalIMGs',
|
||||
'message_forwarding',
|
||||
'composeOptions',
|
||||
'replyOptions',
|
||||
'disableRulerForSignatureSeparation',
|
||||
'insertSignatureAtTopOffMessage',
|
||||
'attachVCardAtCompose',
|
||||
'deleteOptions',
|
||||
'sendOptions',
|
||||
'trustServerUnseenInfo',
|
||||
'showAllFoldersInFolderPane',
|
||||
'prefaskformove',
|
||||
'saveAsOptions',
|
||||
));
|
@ -801,6 +801,48 @@ class preferences
|
||||
self::change_preference($app, $name, null, null, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy preferences from one app to an other
|
||||
*
|
||||
* @param string $from_app
|
||||
* @param string $to_app
|
||||
* @param array $names=null array of names to copy or null for all
|
||||
*/
|
||||
public static function copy_preferences($from_app, $to_app, array $names=null)
|
||||
{
|
||||
$db = isset($GLOBALS['egw_setup']->db) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
|
||||
|
||||
foreach($db->select(self::TABLE, '*', array('preference_app' => $from_app), __LINE__, __FILE__) as $row)
|
||||
{
|
||||
$prefs = self::unserialize($row['preference_value']);
|
||||
|
||||
if ($names)
|
||||
{
|
||||
$prefs = array_intersect_key($prefs, array_flip($names));
|
||||
}
|
||||
if (!$prefs) continue; // nothing to change, as nothing set
|
||||
|
||||
$row['preference_app'] = $to_app;
|
||||
unset($row['preference_value']);
|
||||
|
||||
if (($values = $this->db->select(self::TABLE, 'preference_value', $row, __LINE__, __FILE__)->fetchColumn()))
|
||||
{
|
||||
$prefs = array_merge($values, $prefs);
|
||||
}
|
||||
|
||||
$this->db->insert(self::TABLE, array(
|
||||
'preference_value' => json_encode($prefs)
|
||||
), $row, __LINE__, __FILE__);
|
||||
|
||||
// update instance-wide cache
|
||||
if (($cached = egw_cache::getInstance(__CLASS__, $row['prefences_owner'])))
|
||||
{
|
||||
$cached[$from_app] = $prefs;
|
||||
egw_cache::setInstance(__CLASS__, $row['preference_owner'], $cached);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the the preferences to the repository
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user