Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 980432b7 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

Update to Psr\Log\LoggerInterface as OCP\ILogger is depricated

parent a1bff4a1
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ namespace OCA\EcloudAccounts\Command;
use Exception;
use OCA\EcloudAccounts\AppInfo\Application;
use OCA\EcloudAccounts\Service\UserService;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
@@ -18,9 +18,9 @@ class MapActiveAttributetoLDAP extends Command {
	private OutputInterface $commandOutput;
	private IUserManager $userManager;
	private $userService;
	private $logger;
	private LoggerInterface $logger;

	public function __construct(IUserManager $userManager, ILogger $logger, UserService $userService) {
	public function __construct(IUserManager $userManager, LoggerInterface $logger, UserService $userService) {
		$this->userManager = $userManager;
		$this->userService = $userService;
		$this->logger = $logger;
@@ -42,7 +42,7 @@ class MapActiveAttributetoLDAP extends Command {
				try {
					$this->userService->mapActiveAttributesInLDAP($username, $isEnabled);
				} catch (Exception $e) {
					$this->logger->logException('Failed to update LDAP attributes for user: ' . $username, ['exception' => $e]);
					$this->logger->error('Failed to update LDAP attributes for user: ' . $username, ['exception' => $e]);
				}
			}
		});
+8 −8
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Files\IAppData;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
@@ -53,7 +53,7 @@ class AccountController extends Controller {
	private const HCAPTCHA_DOMAINS = ['https://hcaptcha.com', 'https://*.hcaptcha.com'];
	private const BLACKLISTED_USERNAMES_FILE_NAME = 'blacklisted_usernames';
	
	private ILogger $logger;
	private LoggerInterface $logger;
	public function __construct(
		$AppName,
		IRequest $request,
@@ -66,7 +66,7 @@ class AccountController extends Controller {
		IURLGenerator $urlGenerator,
		ISession $session,
		IConfig $config,
		ILogger $logger,
		LoggerInterface $logger,
		IInitialState $initialState,
		IAppData $appData,
	) {
@@ -199,7 +199,7 @@ class AccountController extends Controller {
				$ipAddress = $this->request->getRemoteAddress();
				$this->userService->addUsernameToCommonDataStore($username, $ipAddress, $recoveryEmail);
			} catch (\Throwable $e) {
				$this->logger->logException($e, ['app' => Application::APP_ID]);
				$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
			}
			$this->userService->setAccountDataLocally($username, $userEmail);
			$this->userService->createHMEAlias($username, $userEmail);
@@ -222,15 +222,15 @@ class AccountController extends Controller {
			$response->setData(['success' => true]);

		} catch (LDAPUserCreationException | Error $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID]);
			$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
			$response->setData(['message' => 'A server-side error occurred while processing your request! Please try again later.', 'success' => false]);
			$response->setStatus(500);
		} catch (RecoveryEmailValidationException $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID]);
			$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
			$response->setData(['message' => $e->getMessage(), 'success' => false]);
			$response->setStatus(400);
		} catch (Exception $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID]);
			$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
			$response->setData(['message' => 'An error occurred while creating your account!', 'success' => false]);
			$response->setStatus(500);
		}
@@ -330,7 +330,7 @@ class AccountController extends Controller {
				$response->setData(['message' => 'Username is already taken.', 'field' => 'username', 'success' => false]);
			}
		} catch (Exception $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID ]);
			$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
			$response->setStatus(500);
		}

+3 −3
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ use Exception;
use OCA\EcloudAccounts\Service\ShopAccountService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\IUserSession;

@@ -16,10 +16,10 @@ class ShopAccountController extends Controller {
	private ShopAccountService $shopAccountService;
	private IUserSession $userSession;

	private ILogger $logger;
	private LoggerInterface $logger;


	public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, ILogger $logger) {
	public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, LoggerInterface $logger) {
		parent::__construct($appName, $request);
		$this->shopAccountService = $shopAccountService;
		$this->userSession = $userSession;
+3 −3
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use OCA\EcloudAccounts\Service\UserService;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\L10N\IFactory;

@@ -20,11 +20,11 @@ class UserController extends ApiController {

	private $mailUsageMapper;

	private $logger;
	private LoggerInterface $logger;

	private $config;
	protected $l10nFactory;
	public function __construct($appName, IRequest $request, ILogger $logger, IConfig $config, UserService $userService, MailUsageMapper $mailUsageMapper, IFactory $l10nFactory) {
	public function __construct($appName, IRequest $request, LoggerInterface $logger, IConfig $config, UserService $userService, MailUsageMapper $mailUsageMapper, IFactory $l10nFactory) {
		parent::__construct($appName, $request);
		$this->userService = $userService;
		$this->mailUsageMapper = $mailUsageMapper;
+4 −4
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ use OCA\EcloudAccounts\Service\SSOService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\QueuedJob;
use OCP\ILogger;
use Psr\Log\LoggerInterface;

// This class retry 2FA state sync with SSO provider.
// It is called from TwoFactorStateChangedListerner when it faced exception on its try.
@@ -24,9 +24,9 @@ class TwoFactorStateChangeJob extends QueuedJob {

	private SSOService $ssoService;
	private IJobList $jobList;
	private ILogger $logger;
	private LoggerInterface $logger;

	public function __construct(ITimeFactory $time, IJobList $jobList, SSOService $ssoService, ILogger $logger) {
	public function __construct(ITimeFactory $time, IJobList $jobList, SSOService $ssoService, LoggerInterface $logger) {
		parent::__construct($time);

		$this->jobList = $jobList;
@@ -45,7 +45,7 @@ class TwoFactorStateChangeJob extends QueuedJob {
			$this->ssoService->handle2FAStateChange($enabled, $username);
		} catch (Exception $e) {
			if ($tryCount > 2) {
				$this->logger->logException($e, ['app' => Application::APP_ID]);
				$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => Application::APP_ID]);
				return;
			}

Loading