make sure possible instance is unset before recreating the entry; correct condition on InstanceCreation when icServerObject is passed; unset cachedObjects for Instance

This commit is contained in:
Klaus Leithoff 2013-08-26 14:27:46 +00:00
parent bacf0c0330
commit d5d6f4daf9

View File

@ -195,8 +195,10 @@ class felamimail_bo
public static function getInstance($_restoreSession=true, $_profileID=0, $_validate=true, $_icServerObject=null)
{
//special case; we get the desired object passed as we need it for the occasion.
if (!is_null($_icServerObject)&&!isset(self::$instances[$_profileID]) || $_restoreSession===false)
if (!is_null($_icServerObject)&&(!isset(self::$instances[$_profileID]) || $_restoreSession===false))
{
self::unsetInstance($_profileID); //make sure we reconstruct it
emailadmin_bo::unsetCachedObjects($_profileID);
self::$instances[$_profileID] = new felamimail_bo('utf-8',$_restoreSession,$_profileID,$_icServerObject);
//error_log(__METHOD__.__LINE__.array2string(self::$instances[$_profileID]->mailPreferences->getIncomingServer($_profileID)));
return self::$instances[$_profileID];