diff --git a/plugins/example/ContactSuggestions.php b/plugins/example/ContactSuggestions.php index 078b87ea2..1bd3e17aa 100644 --- a/plugins/example/ContactSuggestions.php +++ b/plugins/example/ContactSuggestions.php @@ -4,6 +4,8 @@ namespace Plugins\Example; class ContactSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions { +// use \MailSo\Log\Inherit; + public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20) : array { return array( diff --git a/plugins/example/index.php b/plugins/example/index.php index 2590bc191..761de22b4 100644 --- a/plugins/example/index.php +++ b/plugins/example/index.php @@ -11,6 +11,8 @@ use MailSo\Mime\Message as MimeMessage; class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin { +// use \MailSo\Log\Inherit; + const NAME = 'Example', AUTHOR = 'SnappyMail', @@ -453,7 +455,6 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin $this->Manager()->ReadLang(string $sLang, array &$aLang) : self $this->Manager()->IsEnabled() : bool $this->Manager()->Count() : int - $this->Manager()->SetLogger(\MailSo\Log\Logger $oLogger) : self $this->Manager()->WriteLog(string $sDesc, int $iType = \LOG_INFO) : void $this->Manager()->WriteException(string $sDesc, int $iType = \LOG_INFO) : void */ diff --git a/plugins/ldap-contacts-suggestions/LdapContactsSuggestions.php b/plugins/ldap-contacts-suggestions/LdapContactsSuggestions.php index 24ccf750f..d7eb3eb9a 100644 --- a/plugins/ldap-contacts-suggestions/LdapContactsSuggestions.php +++ b/plugins/ldap-contacts-suggestions/LdapContactsSuggestions.php @@ -1,7 +1,9 @@ -getEmailAddressDomainsLdapUri); if ($oCon) { - $this->oLogger->Write('ldap_connect: connected', \LOG_INFO, 'LDAP'); + $this->logWrite('ldap_connect: connected', \LOG_INFO, 'LDAP'); @\ldap_set_option($oCon, LDAP_OPT_PROTOCOL_VERSION, 3); @@ -142,7 +139,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges $sFilter .= (1 < count($aItems) ? '(|' : '').$sSubFilter.(1 < count($aItems) ? ')' : ''); $sFilter .= ')'; - $this->oLogger->Write('ldap_search: start: '.$sBaseDn.' / '.$sFilter, \LOG_INFO, 'LDAP'); + $this->logWrite('ldap_search: start: '.$sBaseDn.' / '.$sFilter, \LOG_INFO, 'LDAP'); $oS = @\ldap_search($oCon, $sBaseDn, $sFilter, $aItems, 0, 30, 30); if ($oS) { $aEntries = @\ldap_get_entries($oCon, $oS); @@ -245,23 +242,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges if ($this->oLogger) { $sError = $oCon ? @\ldap_error($oCon) : ''; $iErrno = $oCon ? @\ldap_errno($oCon) : 0; - - $this->oLogger->Write($sCmd.' error: '.$sError.' ('.$iErrno.')', - \LOG_WARNING, 'LDAP'); + $this->logWrite($sCmd.' error: '.$sError.' ('.$iErrno.')', \LOG_WARNING, 'LDAP'); } } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \LdapContactsSuggestions - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) { - $this->oLogger = $oLogger; - } - - return $this; - } } diff --git a/plugins/nextcloud/NextcloudContactsSuggestions.php b/plugins/nextcloud/NextcloudContactsSuggestions.php index 1807d24bd..34d1cbe49 100644 --- a/plugins/nextcloud/NextcloudContactsSuggestions.php +++ b/plugins/nextcloud/NextcloudContactsSuggestions.php @@ -2,10 +2,7 @@ class NextcloudContactsSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions { - /** - * @var \MailSo\Log\Logger - */ - private $oLogger = null; + use \MailSo\Log\Inherit; private bool $ignoreSystemAddressbook; @@ -75,16 +72,9 @@ class NextcloudContactsSuggestions implements \RainLoop\Providers\Suggestions\IS } catch (\Exception $oException) { - if ($this->oLogger) { - $this->oLogger->WriteException($oException); - } + $this->logException($oException); } return []; } - - public function SetLogger(\MailSo\Log\Logger $oLogger) - { - $this->oLogger = $oLogger; - } } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php index 7cadcc10d..bb1f2a6d8 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php @@ -4,6 +4,7 @@ namespace RainLoop\Providers\Suggestions; interface ISuggestions { +// use \MailSo\Log\Inherit; public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20) : array; // public function SetLogger(\MailSo\Log\Logger $oLogger) : void }