Add more logging for #907

This commit is contained in:
the-djmaze 2023-02-07 14:50:06 +01:00
parent f2ca5f6a30
commit 636ffe5fbb

View file

@ -36,7 +36,7 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
$oActions = \RainLoop\Api::Actions(); $oActions = \RainLoop\Api::Actions();
$oAccount = $oActions->getAccountFromToken(); $oAccount = $oActions->getAccountFromToken();
if (!$oAccount) { if (!$oAccount) {
\error_log('No Account'); $this->Logger()->Write('No Account');
return; return;
} }
$oSettingsLocal = $oActions->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $oActions->SettingsProvider(true)->Load($oAccount);
@ -114,8 +114,9 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
foreach ($found as $role => $folders) { foreach ($found as $role => $folders) {
if (isset($folders[0])) { if (isset($folders[0])) {
// Set the first as default // Set the first as default
// \error_log("Set role {$role}"); $aFolder = &$aResponse['Result']['@Collection'][$folders[0]];
$aResponse['Result']['@Collection'][$folders[0]]['role'] = $role; $this->Logger()->Write("Set {$role} mailbox to {$aFolder['fullName']}");
$aFolder['role'] = $role;
} else if ($this->Config()->Get('plugin', 'autocreate_system_folders', false)) { } else if ($this->Config()->Get('plugin', 'autocreate_system_folders', false)) {
try try
{ {
@ -136,7 +137,7 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
} }
} }
*/ */
// \error_log("Create mailbox {$sFolderNameToCreate}"); $this->Logger()->Write("Create {$role} mailbox {$sFolderNameToCreate}");
$aFolder = $oActions->MailClient()->FolderCreate( $aFolder = $oActions->MailClient()->FolderCreate(
$sFolderNameToCreate, $sFolderNameToCreate,
$sParent, $sParent,
@ -150,6 +151,8 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
{ {
$this->Logger()->WriteException($oException); $this->Logger()->WriteException($oException);
} }
} else {
$this->Logger()->Write("Mailbox for {$role} not created");
} }
} }
} }