mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Move to Psr\Log\LoggerInterface
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
dea5040713
commit
b6829acbaa
13 changed files with 101 additions and 128 deletions
|
|
@ -31,9 +31,9 @@ use OCA\Talk\Room;
|
|||
use OCP\Activity\IManager;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Listener {
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ class Listener {
|
|||
/** @var ChatManager */
|
||||
protected $chatManager;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
|
|
@ -55,7 +55,7 @@ class Listener {
|
|||
public function __construct(IManager $activityManager,
|
||||
IUserSession $userSession,
|
||||
ChatManager $chatManager,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
ITimeFactory $timeFactory) {
|
||||
$this->activityManager = $activityManager;
|
||||
$this->userSession = $userSession;
|
||||
|
|
@ -151,7 +151,7 @@ class Listener {
|
|||
'duration' => $duration,
|
||||
]);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -160,9 +160,9 @@ class Listener {
|
|||
$event->setAffectedUser($userId);
|
||||
$this->activityManager->publish($event);
|
||||
} catch (\BadMethodCallException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ class Listener {
|
|||
'room' => $room->getId(),
|
||||
]);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -216,9 +216,9 @@ class Listener {
|
|||
->setAffectedUser($participant['userId']);
|
||||
$this->activityManager->publish($event);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
} catch (\BadMethodCallException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\BackgroundJob\TimedJob;
|
||||
use OCP\IConfig;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Notification\IManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CheckHostedSignalingServer extends TimedJob {
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class CheckHostedSignalingServer extends TimedJob {
|
|||
private $groupManager;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(ITimeFactory $timeFactory,
|
||||
|
|
@ -57,7 +57,7 @@ class CheckHostedSignalingServer extends TimedJob {
|
|||
IManager $notificationManager,
|
||||
IGroupManager $groupManager,
|
||||
IURLGenerator $urlGenerator,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->setInterval(3600);
|
||||
$this->hostedSignalingServerService = $hostedSignalingServerService;
|
||||
|
|
@ -148,7 +148,7 @@ class CheckHostedSignalingServer extends TimedJob {
|
|||
$this->config->setAppValue('spreed', 'hosted-signaling-server-account-last-checked', $this->time->getTime());
|
||||
|
||||
if (!is_null($notificationSubject)) {
|
||||
$this->logger->info('Hosted signaling server background job caused a notification: ' . $notificationSubject . ' ' . json_encode($notificationParameters), ['app' => 'spreed']);
|
||||
$this->logger->info('Hosted signaling server background job caused a notification: ' . $notificationSubject . ' ' . json_encode($notificationParameters));
|
||||
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace OCA\Talk\BackgroundJob;
|
|||
use OC\BackgroundJob\TimedJob;
|
||||
use OCA\Talk\Manager;
|
||||
use OCA\Talk\Room;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class RemoveEmptyRooms
|
||||
|
|
@ -38,13 +38,13 @@ class RemoveEmptyRooms extends TimedJob {
|
|||
/** @var Manager */
|
||||
protected $manager;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
protected $numDeletedRooms = 0;
|
||||
|
||||
public function __construct(Manager $manager,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
// Every 5 minutes
|
||||
$this->setInterval(60 * 5);
|
||||
|
||||
|
|
@ -58,7 +58,6 @@ class RemoveEmptyRooms extends TimedJob {
|
|||
if ($this->numDeletedRooms) {
|
||||
$this->logger->info('Deleted {numDeletedRooms} rooms because they were empty', [
|
||||
'numDeletedRooms' => $this->numDeletedRooms,
|
||||
'app' => 'spreed',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ use OCP\AppFramework\Db\DoesNotExistException;
|
|||
use OCP\Comments\IComment;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Executor {
|
||||
public const EVENT_APP_EXECUTE = self::class . '::execApp';
|
||||
|
|
@ -51,7 +51,7 @@ class Executor {
|
|||
/** @var CommandService */
|
||||
protected $commandService;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/** @var IL10N */
|
||||
|
|
@ -60,7 +60,7 @@ class Executor {
|
|||
public function __construct(IEventDispatcher $dispatcher,
|
||||
ShellExecutor $shellExecutor,
|
||||
CommandService $commandService,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IL10N $l) {
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->shellExecutor = $shellExecutor;
|
||||
|
|
@ -190,7 +190,7 @@ class Executor {
|
|||
$message->getActorType() === 'users' ? $message->getActorId() : ''
|
||||
);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return $this->l->t('An error occurred while running the command. Please ask an administrator to check the logs.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ use OCP\AppFramework\OCSController;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class HostedSignalingServerController extends OCSController {
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class HostedSignalingServerController extends OCSController {
|
|||
protected $l10n;
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var HostedSignalingServerService */
|
||||
private $hostedSignalingServerService;
|
||||
|
|
@ -57,7 +57,7 @@ class HostedSignalingServerController extends OCSController {
|
|||
IClientService $clientService,
|
||||
IL10N $l10n,
|
||||
IConfig $config,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
HostedSignalingServerService $hostedSignalingServerService) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->clientService = $clientService;
|
||||
|
|
@ -124,7 +124,7 @@ class HostedSignalingServerController extends OCSController {
|
|||
$this->config->setAppValue('spreed', 'signaling_mode', 'internal');
|
||||
$this->config->deleteAppValue('spreed', 'signaling_servers');
|
||||
|
||||
$this->logger->info('Deleted hosted signaling server account with ID ' . $accountId, ['app' => 'spreed']);
|
||||
$this->logger->info('Deleted hosted signaling server account with ID ' . $accountId);
|
||||
} catch (HostedSignalingServerAPIException $e) { // API or connection issues
|
||||
return new DataResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ use OCP\Files\IRootFolder;
|
|||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IInitialStateService;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Notification\IManager as INotificationManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PageController extends Controller {
|
||||
use TInitialState;
|
||||
|
|
@ -68,7 +68,7 @@ class PageController extends Controller {
|
|||
private $talkSession;
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
|
|
@ -88,7 +88,7 @@ class PageController extends Controller {
|
|||
TalkSession $session,
|
||||
IUserSession $userSession,
|
||||
?string $UserId,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
Manager $manager,
|
||||
IURLGenerator $url,
|
||||
INotificationManager $notificationManager,
|
||||
|
|
@ -196,7 +196,7 @@ class PageController extends Controller {
|
|||
$notification->setObject('call', $room->getToken());
|
||||
$this->notificationManager->markProcessed($notification);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
|
||||
if ($shouldFlush) {
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ use OCP\Files\IRootFolder;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SettingsController extends OCSController {
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class SettingsController extends OCSController {
|
|||
protected $rootFolder;
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var string|null */
|
||||
protected $userId;
|
||||
|
|
@ -52,7 +52,7 @@ class SettingsController extends OCSController {
|
|||
IRequest $request,
|
||||
IRootFolder $rootFolder,
|
||||
IConfig $config,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
?string $userId) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->rootFolder = $rootFolder;
|
||||
|
|
@ -92,7 +92,7 @@ class SettingsController extends OCSController {
|
|||
return true;
|
||||
} catch (NotPermittedException $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ use OCA\Talk\Room;
|
|||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Notification\IManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Listener {
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class Listener {
|
|||
protected $userSession;
|
||||
/** @var ITimeFactory */
|
||||
protected $timeFactory;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/** @var bool */
|
||||
|
|
@ -54,7 +54,7 @@ class Listener {
|
|||
IEventDispatcher $dispatcher,
|
||||
IUserSession $userSession,
|
||||
ITimeFactory $timeFactory,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
$this->notificationManager = $notificationManager;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->userSession = $userSession;
|
||||
|
|
@ -129,7 +129,7 @@ class Listener {
|
|||
'actorId' => $actor->getUID(),
|
||||
]);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
if ($shouldFlush) {
|
||||
$this->notificationManager->flush();
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ class Listener {
|
|||
$notification->setUser($participant['userId']);
|
||||
$this->notificationManager->notify($notification);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ class Listener {
|
|||
->setSubject('invitation');
|
||||
$this->notificationManager->markProcessed($notification);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ class Listener {
|
|||
])
|
||||
->setDateTime($dateTime);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
if ($shouldFlush) {
|
||||
$this->notificationManager->flush();
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ class Listener {
|
|||
$notification->setUser($userId);
|
||||
$this->notificationManager->notify($notification);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ class Listener {
|
|||
->setSubject('call');
|
||||
$this->notificationManager->markProcessed($notification);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'spreed']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ use OCP\AppFramework\Http;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class HostedSignalingServerService {
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ class HostedSignalingServerService {
|
|||
private $apiServerUrl;
|
||||
/** @var IClientService */
|
||||
private $clientService;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
|
@ -54,7 +54,7 @@ class HostedSignalingServerService {
|
|||
|
||||
public function __construct(IConfig $config,
|
||||
IClientService $clientService,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IL10N $l10n,
|
||||
SecureRandom $secureRandom) {
|
||||
$this->config = $config;
|
||||
|
|
@ -98,10 +98,7 @@ class HostedSignalingServerService {
|
|||
$response = $e->getResponse();
|
||||
|
||||
if ($response === null) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Failed to request hosted signaling server trial',
|
||||
]);
|
||||
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Failed to request trial because the trial server is unreachable. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -110,7 +107,7 @@ class HostedSignalingServerService {
|
|||
switch ($status) {
|
||||
case Http::STATUS_UNAUTHORIZED:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is a problem with the authentication of this instance. Maybe it is not reachable from the outside to verify it\'s URL.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -119,7 +116,7 @@ class HostedSignalingServerService {
|
|||
if ($body) {
|
||||
$parsedBody = json_decode($body, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -185,35 +182,31 @@ class HostedSignalingServerService {
|
|||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_TOO_MANY_REQUESTS:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Too many requests are send from your servers address. Please try again later.');
|
||||
throw new HostedSignalingServerInputException($message);
|
||||
case Http::STATUS_CONFLICT:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: already registered - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: already registered - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is already a trial registered for this Nextcloud instance.');
|
||||
throw new HostedSignalingServerInputException($message);
|
||||
case Http::STATUS_INTERNAL_SERVER_ERROR:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
default:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Failed to request trial because the trial server behaved wrongly. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Failed to request hosted signaling server trial',
|
||||
]);
|
||||
|
||||
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Failed to request trial because the trial server is unreachable. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -222,7 +215,7 @@ class HostedSignalingServerService {
|
|||
|
||||
if ($status !== Http::STATUS_CREATED) {
|
||||
$body = $response->getBody();
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -232,14 +225,14 @@ class HostedSignalingServerService {
|
|||
$data = json_decode($body, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
||||
if (!isset($data['account_id'])) {
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: no account ID transfered - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Requesting hosted signaling server trial failed: no account ID transfered - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -275,11 +268,7 @@ class HostedSignalingServerService {
|
|||
$response = $e->getResponse();
|
||||
|
||||
if ($response === null) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Trial requested but failed to get account information',
|
||||
]);
|
||||
|
||||
$this->logger->error('Trial requested but failed to get account information', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Trial requested but failed to get account information. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -289,7 +278,7 @@ class HostedSignalingServerService {
|
|||
switch ($status) {
|
||||
case Http::STATUS_UNAUTHORIZED:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is a problem with the authentication of this request. Maybe it is not reachable from the outside to verify it\'s URL.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -298,7 +287,7 @@ class HostedSignalingServerService {
|
|||
if ($body) {
|
||||
$parsedBody = json_decode($body, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -310,7 +299,7 @@ class HostedSignalingServerService {
|
|||
break;
|
||||
default:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Failed to fetch account information because the trial server behaved wrongly. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -326,35 +315,31 @@ class HostedSignalingServerService {
|
|||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_TOO_MANY_REQUESTS:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Too many requests are send from your servers address. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_NOT_FOUND:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is no such account registered.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_INTERNAL_SERVER_ERROR:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
default:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Failed to fetch account information because the trial server behaved wrongly. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Failed to request hosted signaling server trial',
|
||||
]);
|
||||
|
||||
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Failed to fetch account information because the trial server is unreachable. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -363,7 +348,7 @@ class HostedSignalingServerService {
|
|||
|
||||
if ($status !== Http::STATUS_OK) {
|
||||
$body = $response->getBody();
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
|
|
@ -374,7 +359,7 @@ class HostedSignalingServerService {
|
|||
$data = json_decode($body, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -404,7 +389,7 @@ class HostedSignalingServerService {
|
|||
|| (in_array($data['status'], ['error', 'blocked']) && !isset($data['reason']))
|
||||
|| !in_array($data['status'], ['error', 'blocked', 'pending', 'active', 'expired'])
|
||||
) {
|
||||
$this->logger->error('Getting the account information failed: response is missing mandatory field - data: ' . json_encode($data), ['app' => 'spreed']);
|
||||
$this->logger->error('Getting the account information failed: response is missing mandatory field - data: ' . json_encode($data));
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -437,11 +422,7 @@ class HostedSignalingServerService {
|
|||
$response = $e->getResponse();
|
||||
|
||||
if ($response === null) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Deleting the hosted signaling server account failed',
|
||||
]);
|
||||
|
||||
$this->logger->error('Deleting the hosted signaling server account failed', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Deleting the hosted signaling server account failed. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -451,7 +432,7 @@ class HostedSignalingServerService {
|
|||
switch ($status) {
|
||||
case Http::STATUS_UNAUTHORIZED:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is a problem with the authentication of this request. Maybe it is not reachable from the outside to verify it\'s URL.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -460,7 +441,7 @@ class HostedSignalingServerService {
|
|||
if ($body) {
|
||||
$parsedBody = json_decode($body, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -472,7 +453,7 @@ class HostedSignalingServerService {
|
|||
break;
|
||||
default:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Failed to delete the account because the trial server behaved wrongly. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
|
|
@ -488,35 +469,31 @@ class HostedSignalingServerService {
|
|||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_TOO_MANY_REQUESTS:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Too many requests are send from your servers address. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_NOT_FOUND:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('There is no such account registered.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
case Http::STATUS_INTERNAL_SERVER_ERROR:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
default:
|
||||
$body = $response->getBody()->getContents();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
$message = $this->l10n->t('Failed to delete the account because the trial server behaved wrongly. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Deleting the hosted signaling server account failed',
|
||||
]);
|
||||
|
||||
$this->logger->error('Deleting the hosted signaling server account failed', ['exception' => $e]);
|
||||
$message = $this->l10n->t('Failed to delete the account because the trial server is unreachable. Please check back later.');
|
||||
throw new HostedSignalingServerAPIException($message);
|
||||
}
|
||||
|
|
@ -525,7 +502,7 @@ class HostedSignalingServerService {
|
|||
|
||||
if ($status !== Http::STATUS_NO_CONTENT) {
|
||||
$body = $response->getBody();
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body, ['app' => 'spreed']);
|
||||
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
|
||||
|
||||
|
||||
$message = $this->l10n->t('Something unexpected happened.');
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ use OCA\Talk\Config;
|
|||
use OCA\Talk\Participant;
|
||||
use OCA\Talk\Room;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUrlGenerator;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class BackendNotifier {
|
||||
/** @var Config */
|
||||
private $config;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var IClientService */
|
||||
private $clientService;
|
||||
|
|
@ -48,7 +48,7 @@ class BackendNotifier {
|
|||
private $urlGenerator;
|
||||
|
||||
public function __construct(Config $config,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IClientService $clientService,
|
||||
ISecureRandom $secureRandom,
|
||||
Manager $signalingManager,
|
||||
|
|
@ -79,10 +79,7 @@ class BackendNotifier {
|
|||
try {
|
||||
$client->post($url, $params);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'app' => 'spreed',
|
||||
'message' => 'Failed to send message to signaling server',
|
||||
]);
|
||||
$this->logger->error('Failed to send message to signaling server', ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +138,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomInvited(Room $room, array $users): void {
|
||||
$this->logger->info('Now invited to ' . $room->getToken() . ': ' . print_r($users, true), ['app' => 'spreed']);
|
||||
$this->logger->info('Now invited to ' . $room->getToken() . ': ' . print_r($users, true));
|
||||
$userIds = [];
|
||||
foreach ($users as $user) {
|
||||
$userIds[] = $user['userId'];
|
||||
|
|
@ -166,7 +163,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomsDisinvited(Room $room, array $userIds): void {
|
||||
$this->logger->info('No longer invited to ' . $room->getToken() . ': ' . print_r($userIds, true), ['app' => 'spreed']);
|
||||
$this->logger->info('No longer invited to ' . $room->getToken() . ': ' . print_r($userIds, true));
|
||||
$this->backendRequest($room, [
|
||||
'type' => 'disinvite',
|
||||
'disinvite' => [
|
||||
|
|
@ -187,7 +184,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomSessionsRemoved(Room $room, array $sessionIds): void {
|
||||
$this->logger->info('Removed from ' . $room->getToken() . ': ' . print_r($sessionIds, true), ['app' => 'spreed']);
|
||||
$this->logger->info('Removed from ' . $room->getToken() . ': ' . print_r($sessionIds, true));
|
||||
$this->backendRequest($room, [
|
||||
'type' => 'disinvite',
|
||||
'disinvite' => [
|
||||
|
|
@ -207,7 +204,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomModified(Room $room): void {
|
||||
$this->logger->info('Room modified: ' . $room->getToken(), ['app' => 'spreed']);
|
||||
$this->logger->info('Room modified: ' . $room->getToken());
|
||||
$this->backendRequest($room, [
|
||||
'type' => 'update',
|
||||
'update' => [
|
||||
|
|
@ -225,7 +222,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomDeleted(Room $room, array $participants): void {
|
||||
$this->logger->info('Room deleted: ' . $room->getToken(), ['app' => 'spreed']);
|
||||
$this->logger->info('Room deleted: ' . $room->getToken());
|
||||
$userIds = array_keys($participants['users']);
|
||||
$this->backendRequest($room, [
|
||||
'type' => 'delete',
|
||||
|
|
@ -243,7 +240,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function participantsModified(Room $room, array $sessionIds): void {
|
||||
$this->logger->info('Room participants modified: ' . $room->getToken() . ' ' . print_r($sessionIds, true), ['app' => 'spreed']);
|
||||
$this->logger->info('Room participants modified: ' . $room->getToken() . ' ' . print_r($sessionIds, true));
|
||||
$changed = [];
|
||||
$users = [];
|
||||
$participants = $room->getParticipantsLegacy();
|
||||
|
|
@ -287,7 +284,7 @@ class BackendNotifier {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function roomInCallChanged(Room $room, int $flags, array $sessionIds): void {
|
||||
$this->logger->info('Room in-call status changed: ' . $room->getToken() . ' ' . $flags . ' ' . print_r($sessionIds, true), ['app' => 'spreed']);
|
||||
$this->logger->info('Room in-call status changed: ' . $room->getToken() . ' ' . $flags . ' ' . print_r($sessionIds, true));
|
||||
$changed = [];
|
||||
$users = [];
|
||||
$participants = $room->getParticipantsLegacy();
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\IConfig;
|
||||
use OCP\IGroup;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Notification\IManager;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class CheckHostedSignalingServerTest extends TestCase {
|
||||
|
|
@ -51,7 +51,7 @@ class CheckHostedSignalingServerTest extends TestCase {
|
|||
protected $groupManager;
|
||||
/** @var IURLGenerator|MockObject */
|
||||
protected $urlGenerator;
|
||||
/** @var ILogger|MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
protected $logger;
|
||||
|
||||
public function setUp(): void {
|
||||
|
|
@ -63,7 +63,7 @@ class CheckHostedSignalingServerTest extends TestCase {
|
|||
$this->notificationManager = $this->createMock(IManager::class);
|
||||
$this->groupManager = $this->createMock(IGroupManager::class);
|
||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
}
|
||||
|
||||
public function getBackgroundJob(): CheckHostedSignalingServer {
|
||||
|
|
@ -95,7 +95,7 @@ class CheckHostedSignalingServerTest extends TestCase {
|
|||
|
||||
$this->hostedSignalingServerService->expects($this->once())
|
||||
->method('fetchAccountInfo')
|
||||
->willReturn(["status" => "pending"]);
|
||||
->willReturn(['status' => 'pending']);
|
||||
|
||||
$this->invokePrivate($backgroundJob, 'run', ['']);
|
||||
}
|
||||
|
|
@ -103,10 +103,10 @@ class CheckHostedSignalingServerTest extends TestCase {
|
|||
public function testRunWithPendingToActiveChange() {
|
||||
$backgroundJob = $this->getBackgroundJob();
|
||||
$newStatus = [
|
||||
"status" => "active",
|
||||
"signaling" => [
|
||||
"url" => "signaling-url",
|
||||
"secret" => "signaling-secret",
|
||||
'status' => 'active',
|
||||
'signaling' => [
|
||||
'url' => 'signaling-url',
|
||||
'secret' => 'signaling-secret',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ use OCA\Talk\Service\CommandService;
|
|||
use OCP\Comments\IComment;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ExecutorTest extends TestCase {
|
||||
|
|
@ -47,7 +47,7 @@ class ExecutorTest extends TestCase {
|
|||
/** @var CommandService|MockObject */
|
||||
protected $commandService;
|
||||
|
||||
/** @var ILogger|MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
protected $logger;
|
||||
|
||||
/** @var IL10N|MockObject */
|
||||
|
|
@ -62,7 +62,7 @@ class ExecutorTest extends TestCase {
|
|||
$this->dispatcher = $this->createMock(IEventDispatcher::class);
|
||||
$this->shellExecutor = $this->createMock(ShellExecutor::class);
|
||||
$this->commandService = $this->createMock(CommandService::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->executor = new Executor(
|
||||
$this->dispatcher,
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Security\IHasher;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CustomBackendNotifier extends BackendNotifier {
|
||||
private $requests = [];
|
||||
|
|
@ -155,7 +155,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
private function recreateBackendNotifier() {
|
||||
$this->controller = new CustomBackendNotifier(
|
||||
$this->config,
|
||||
$this->createMock(ILogger::class),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->createMock(IClientService::class),
|
||||
$this->secureRandom,
|
||||
$this->signalingManager,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue