getLogger() has been removed
See https://github.com/nextcloud/server/pull/47978
A potential solution has been implemented by https://github.com/ONLYOFFICE/onlyoffice-nextcloud/pull/1056, it seems to be \OCP\Log\logger('user_external')
Solves #270
As a quick test I changed line 74 in IMAP.php to read \OCP\Log\logger('user_external')->error( and it resolved the particular error i was experiencing on login. I'm guessing the error class initiator is used all over this package. If I get the time i'll try and go hunt them down and clean them up.
Using server Nextcloud 31.0.6 with "External user authentication" 3.4.0 from NC repository (does not offer more recent update). This error message is still ocurring and it does not allow to authenticate IMAP users:
Exception Call to undefined method OC\Server::getLogger() in file '/srv/www/apps/user_external/lib/IMAP.php' line 125
Replace all occurrences of OC\Server::getLogger() by \OCP\Log\logger('user_external') in /srv/www/apps/user_external/lib/IMAP.php
Replace all occurrences of
OC\Server::getLogger()by\OCP\Log\logger('user_external')in/srv/www/apps/user_external/lib/IMAP.php
Since I've tried this, non-email users can't login ( ERROR: IMAP Login failed via curl: Login denied ). How do I make normal users be able to login again with own username&password?
At last I've applied changes from bugfix commit
As of july 16th 3.5.9 version of this extension~app was released, but as of august 31th Nextcloud server 31.0.8 still has version 3.4.0 of External user authentication.
As of july 16th 3.5.9 version of this extension~app was released, but as of august 31th Nextcloud server 31.0.8 still has version 3.4.0 of External user authentication.
Where did you see the release version 3.5.9? Here the last "release" was from 2021 and since than only taged version exist in the repository. It seems that this app is not maintained well any more. Sorry, if I am mistaken. There are no code changes since last year. Maybe it is not necessary but as an admin I am reluctant to use this app even though I really would like to.
Work for me:
diff -ur user_external/lib/IMAP.php.orig user_external/lib/IMAP.php
--- user_external/lib/IMAP.php.orig
+++ user_external/lib/IMAP.php
@@ -8,6 +8,7 @@
* See the COPYING-README file.
*/
namespace OCA\UserExternal;
+use Psr\Log\LoggerInterface;
/**
* User authentication against an IMAP mail server
@@ -71,7 +72,7 @@
$uid = $pieces[0];
}
} else {
- \OC::$server->getLogger()->error(
+ \OC::$server->get(LoggerInterface::class)->error(
'ERROR: User has a wrong domain! Expecting: '.$this->domain,
['app' => 'user_external']
);
@@ -111,7 +112,7 @@
$errorcode === 28) {
# This is not defined in PHP-8.x
# 28: CURLE_OPERATION_TIMEDOUT
- \OC::$server->getLogger()->error(
+ \OC::$server->get(LoggerInterface::class)->error(
'ERROR: Could not connect to imap server via curl: ' . curl_strerror($errorcode),
['app' => 'user_external']
);
@@ -122,12 +123,12 @@
# 9: CURLE_REMOTE_ACCESS_DENIED
# 67: CURLE_LOGIN_DENIED
# 94: CURLE_AUTH_ERROR)
- \OC::$server->getLogger()->error(
+ \OC::$server->get(LoggerInterface::class)->error(
'ERROR: IMAP Login failed via curl: ' . curl_strerror($errorcode),
['app' => 'user_external']
);
} else {
- \OC::$server->getLogger()->error(
+ \OC::$server->get(LoggerInterface::class)->error(
'ERROR: IMAP server returned an error: ' . $errorcode . ' / ' . curl_strerror($errorcode),
['app' => 'user_external']
);
Files:
user_external/lib/BasicAuth.php
user_external/lib/FTP.php
user_external/lib/SMB.php
user_external/lib/SSH.php
user_external/lib/WebDavAuth.php
need the same fix, but I'm using IMAP backend only.
Fixed in https://github.com/nextcloud/user_external/commit/51feb76b47ab72d0746f43943c893257afa2ec8f.