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

Commit 12c04ce8 authored by Ronak Patel's avatar Ronak Patel
Browse files

throwable ccode

parent 343793f5
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -9,13 +9,17 @@ use OCA\EcloudAccounts\Service\BlackListService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use OCP\ILogger;

class UpdateBlacklistedDomains extends Command {
	private BlackListService $blackListService;
	private ILogger $logger;

	public function __construct(BlackListService $blackListService) {

	public function __construct(BlackListService $blackListService, ILogger $logger) {
		parent::__construct();
		$this->blackListService = $blackListService;
		$this->logger = $logger;
	}

	protected function configure() {
@@ -27,6 +31,7 @@ class UpdateBlacklistedDomains extends Command {
			$this->blackListService->updateBlacklistedDomains();
			$output->writeln('Updated blacklisted domains for creation.');
		} catch (\Throwable $th) {
			$this->logger->error('Error while updating blacklisted domains. ' . $th->getMessage());
			$output->writeln('Error while updating blacklisted domains.');
		}
		return 1;
+1 −4
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@ declare(strict_types=1);

namespace OCA\EcloudAccounts\Service;

require __DIR__ . '/../../vendor/autoload.php';

use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\ILogger;
@@ -68,7 +66,6 @@ class BlackListService {
		try {
			$currentFolder = $this->appData->getFolder($foldername);
		} catch (NotFoundException $e) {
			$this->logger->error('Folder '.$foldername.' not found!');
			$currentFolder = $this->appData->newFolder($foldername);
		}
		$filename = self::BLACKLISTED_DOMAINS_FILE_NAME;
@@ -92,7 +89,7 @@ class BlackListService {
			}
			return json_decode($blacklistedDomainsInJson, true);
		} catch (NotFoundException $e) {
			$this->logger->error('Blacklisted domains file '.$document.' not found!');
			$this->logger->warning('Blacklisted domains file '.$document.' not found!');
			return [];
		}