Don't crash with incompatible share providers on updates
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
@@ -75,7 +75,9 @@ use OCP\Notification\IManager as NotificationManager;
|
|||||||
use OCP\Share\IManager;
|
use OCP\Share\IManager;
|
||||||
use OCP\User\Events\UserDeletedEvent;
|
use OCP\User\Events\UserDeletedEvent;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
public const APP_ID = 'deck';
|
public const APP_ID = 'deck';
|
||||||
@@ -102,7 +104,16 @@ class Application extends App implements IBootstrap {
|
|||||||
$context->injectFn(Closure::fromCallable([$this, 'registerCollaborationResources']));
|
$context->injectFn(Closure::fromCallable([$this, 'registerCollaborationResources']));
|
||||||
|
|
||||||
$context->injectFn(function (IManager $shareManager) {
|
$context->injectFn(function (IManager $shareManager) {
|
||||||
|
try {
|
||||||
$shareManager->registerShareProvider(DeckShareProvider::class);
|
$shareManager->registerShareProvider(DeckShareProvider::class);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
if (!$e instanceof ContainerExceptionInterface) {
|
||||||
|
Server::get(LoggerInterface::class)->error(
|
||||||
|
$e->getMessage(),
|
||||||
|
['exception' => $e]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$context->injectFn(function (Listener $listener, IEventDispatcher $eventDispatcher) {
|
$context->injectFn(function (Listener $listener, IEventDispatcher $eventDispatcher) {
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ use OCP\AppFramework\Db\IMapperException;
|
|||||||
use OCP\AppFramework\Http\Response;
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
use OCP\Server;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class AttachmentService {
|
class AttachmentService {
|
||||||
private $attachmentMapper;
|
private $attachmentMapper;
|
||||||
@@ -94,7 +97,16 @@ class AttachmentService {
|
|||||||
* @throws \OCP\AppFramework\QueryException
|
* @throws \OCP\AppFramework\QueryException
|
||||||
*/
|
*/
|
||||||
public function registerAttachmentService($type, $class) {
|
public function registerAttachmentService($type, $class) {
|
||||||
|
try {
|
||||||
$this->services[$type] = $this->application->getContainer()->query($class);
|
$this->services[$type] = $this->application->getContainer()->query($class);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
if (!$e instanceof ContainerExceptionInterface) {
|
||||||
|
Server::get(LoggerInterface::class)->error(
|
||||||
|
$e->getMessage(),
|
||||||
|
['exception' => $e]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user