try to catch exeptions on ->no mail-accounts available at all<-

This commit is contained in:
Klaus Leithoff 2014-02-14 12:20:25 +00:00
parent fb311f3ebf
commit 4bbda170bd
2 changed files with 22 additions and 8 deletions

View File

@ -243,7 +243,14 @@ class mail_bo
error_log(__METHOD__.__LINE__." Loading the Profile for ProfileID ".$_profileID.' failed for icServer; '.$e->getMessage().' Trigger new instance for Default-Profile '.$newprofileID.'. called from:'.function_backtrace());
if ($newprofileID)
{
self::$instances[$newprofileID] = new mail_bo('utf-8',false,$newprofileID);
try
{
self::$instances[$newprofileID] = new mail_bo('utf-8',false,$newprofileID);
}
catch (Exception $e)
{
throw new egw_exception(__METHOD__." failed to instanciate mail_bo for $newprofileID with error:".$e->getMessage());;
}
$_profileID = $newprofileID;
}
}
@ -323,11 +330,18 @@ class mail_bo
$this->sessionData = array();
$this->forcePrefReload();
}
$this->profileID = self::validateProfileID($_profileID);
$this->accountid = $GLOBALS['egw_info']['user']['account_id'];
try
{
$this->profileID = self::validateProfileID($_profileID);
$this->accountid = $GLOBALS['egw_info']['user']['account_id'];
//error_log(__METHOD__.__LINE__." ProfileID ".$this->profileID.' called from:'.function_backtrace());
$acc = emailadmin_account::read($this->profileID);
//error_log(__METHOD__.__LINE__." ProfileID ".$this->profileID.' called from:'.function_backtrace());
$acc = emailadmin_account::read($this->profileID);
}
catch (Exception $e)
{
throw new egw_exception(__METHOD__." failed to instanciate mail_bo for $_profileID / ".$this->profileID." with error:".$e->getMessage());;
}
//error_log(__METHOD__.__LINE__.array2string($acc->imapServer()));
$this->icServer = ($_oldImapServerObject?$acc->oldImapServer():$acc->imapServer());
$this->ogServer = $acc->smtpServer();

View File

@ -2588,7 +2588,7 @@ unset($query['actions']);
*/
function vfsSaveAttachment($ids,$path)
{
error_log(__METHOD__.__LINE__.'("'.array2string($ids).'","'.$path."\")');");
//error_log(__METHOD__.__LINE__.'("'.array2string($ids).'","'.$path."\")');");
if (is_array($ids) && !egw_vfs::is_writable($path) || !is_array($ids) && !egw_vfs::is_writable(dirname($path)))
{
@ -2603,8 +2603,8 @@ unset($query['actions']);
$mailbox = $hA['folder'];
//error_log(__METHOD__.__LINE__.array2string($hA));
$this->mail_bo->reopen($mailbox);
$attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail);
$attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail,false);
//error_log(__METHOD__.__LINE__.array2string($attachment));
if (!($fp = egw_vfs::fopen($file=$path.($name ? '/'.$name : ''),'wb')) ||
!fwrite($fp,$attachment['attachment']))
{