}
$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'));
}
$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;
}
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.
*/
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) {