From: Maxence Lange Date: Tue, 20 Jun 2017 11:50:52 +0000 (-0100) Subject: verify that circles is installed X-Git-Tag: v12.0.1RC1~16^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7464996c567851668a9df484c3d396e7bfa98ec2;p=nextcloud-server.git verify that circles is installed Signed-off-by: Maxence Lange --- diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index bd57d80dab0..d0651edf89a 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -450,7 +450,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { - if (!\OCP\App::isEnabled('circles')) { + if (!\OCP\App::isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled')); } diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 57d51ebac6a..1b9dffaa2c6 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -472,7 +472,7 @@ class ShareesAPIController extends OCSController { $shareTypes[] = Share::SHARE_TYPE_EMAIL; } - if (\OCP\App::isEnabled('circles')) { + if (\OCP\App::isEnabledForUser('circles') && class_exists('\OCA\Circles\ShareByCircleProvider')) { $shareTypes[] = Share::SHARE_TYPE_CIRCLE; } diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index ddd8177250b..aedad6a32a7 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -51,9 +51,10 @@ class ProviderFactory implements IProviderFactory { private $federatedProvider = null; /** @var ShareByMailProvider */ private $shareByMailProvider; - /** @var \OCA\Circles\ShareByCircleProvider; - * ShareByCircleProvider */ - private $shareByCircleProvider; + /** @var \OCA\Circles\ShareByCircleProvider */ + private $shareByCircleProvider = null; + /** @var bool */ + private $circlesAreNotAvailable = false; /** * IProviderFactory constructor. @@ -179,11 +180,16 @@ class ProviderFactory implements IProviderFactory { */ protected function getShareByCircleProvider() { - $appManager = $this->serverContainer->getAppManager(); - if (!$appManager->isEnabledForUser('circles')) { + if ($this->circlesAreNotAvailable) { return null; } + if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || + !class_exists('\OCA\Circles\ShareByCircleProvider') + ) { + $this->circlesAreNotAvailable = true; + return null; + } if ($this->shareByCircleProvider === null) {