From db5ab31ee42bb8f5a8ef58bd5b035b154b2bb4cb Mon Sep 17 00:00:00 2001 From: Jonas Sulzer Date: Thu, 27 Dec 2018 13:02:49 +0100 Subject: [PATCH] change deprecated logging method Signed-off-by: Jonas Sulzer --- lib/ftp.php | 6 +++--- lib/imap.php | 2 +- lib/smb.php | 12 ++++++------ lib/webdavauth.php | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ftp.php b/lib/ftp.php index 1652b82..ce9ae19 100644 --- a/lib/ftp.php +++ b/lib/ftp.php @@ -46,9 +46,9 @@ class OC_User_FTP extends \OCA\user_external\Base{ */ public function checkPassword($uid, $password) { if (false === array_search($this->protocol, stream_get_wrappers())) { - OCP\Util::writeLog( - 'user_external', - 'ERROR: Stream wrapper not available: ' . $this->protocol, OCP\Util::ERROR + OC::$server->getLogger()->error( + 'ERROR: Stream wrapper not available: ' . $this->protocol, + ['app' => 'user_external'] ); return false; } diff --git a/lib/imap.php b/lib/imap.php index c162400..a236290 100644 --- a/lib/imap.php +++ b/lib/imap.php @@ -42,7 +42,7 @@ class OC_User_IMAP extends \OCA\user_external\Base { */ public function checkPassword($uid, $password) { if (!function_exists('imap_open')) { - OCP\Util::writeLog('user_external', 'ERROR: PHP imap extension is not installed', OCP\Util::ERROR); + OC::$server->getLogger()->error('ERROR: PHP imap extension is not installed', ['app' => 'user_external']); return false; } diff --git a/lib/smb.php b/lib/smb.php index 7d16d18..d0da14f 100644 --- a/lib/smb.php +++ b/lib/smb.php @@ -42,9 +42,9 @@ class OC_User_SMB extends \OCA\user_external\Base{ $command = self::SMBCLIENT.' '.escapeshellarg('//' . $this->host . '/dummy').' -U'.$uidEscaped.'%'.$password; $lastline = exec($command, $output, $retval); if ($retval === 127) { - OCP\Util::writeLog( - 'user_external', 'ERROR: smbclient executable missing', - OCP\Util::ERROR + OC::$server->getLogger()->error( + 'ERROR: smbclient executable missing', + ['app' => 'user_external'] ); return false; } else if (strpos($lastline, self::LOGINERROR) !== false) { @@ -55,9 +55,9 @@ class OC_User_SMB extends \OCA\user_external\Base{ goto login; } else if ($retval !== 0) { //some other error - OCP\Util::writeLog( - 'user_external', 'ERROR: smbclient error: ' . trim($lastline), - OCP\Util::ERROR + OC::$server->getLogger()->error( + 'ERROR: smbclient error: ' . trim($lastline), + ['app' => 'user_external'] ); return false; } else { diff --git a/lib/webdavauth.php b/lib/webdavauth.php index a77adfe..747f9ac 100644 --- a/lib/webdavauth.php +++ b/lib/webdavauth.php @@ -28,14 +28,14 @@ class WebDavAuth extends Base { public function checkPassword($uid, $password) { $arr = explode('://', $this->webDavAuthUrl, 2); if( ! isset($arr) OR count($arr) !== 2) { - \OCP\Util::writeLog('OC_USER_WEBDAVAUTH', 'Invalid Url: "'.$this->webDavAuthUrl.'" ', 3); + OC::$server->getLogger()->error('ERROR: Invalid WebdavUrl: "'.$this->webDavAuthUrl.'" ', ['app' => 'user_external']); return false; } list($protocol, $path) = $arr; $url= $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path; $headers = get_headers($url); if($headers === false) { - \OCP\Util::writeLog('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', 3); + OC::$server->getLogger()->error('ERROR: Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', ['app' => 'user_external']); return false; }