mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
Merge pull request #48790 from nextcloud/refactor/apps/constructor-property-promotion
This commit is contained in:
commit
070adc1131
591 changed files with 2832 additions and 6670 deletions
|
|
@ -16,11 +16,9 @@ use OCP\Federation\ICloudFederationProviderManager;
|
|||
*/
|
||||
class Config {
|
||||
|
||||
/** @var ICloudFederationProviderManager */
|
||||
private $cloudFederationProviderManager;
|
||||
|
||||
public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
|
||||
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
|
||||
public function __construct(
|
||||
private ICloudFederationProviderManager $cloudFederationProviderManager,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,10 +25,6 @@ class Result extends BaseResult {
|
|||
* @deprecated 20.0.0
|
||||
*/
|
||||
public $authorId;
|
||||
/**
|
||||
* @deprecated 20.0.0
|
||||
*/
|
||||
public string $authorName;
|
||||
/**
|
||||
* @deprecated 20.0.0
|
||||
*/
|
||||
|
|
@ -45,7 +41,10 @@ class Result extends BaseResult {
|
|||
public function __construct(
|
||||
string $search,
|
||||
IComment $comment,
|
||||
string $authorName,
|
||||
/**
|
||||
* @deprecated 20.0.0
|
||||
*/
|
||||
public string $authorName,
|
||||
string $path,
|
||||
) {
|
||||
parent::__construct(
|
||||
|
|
@ -56,7 +55,6 @@ class Result extends BaseResult {
|
|||
|
||||
$this->comment = $this->getRelevantMessagePart($comment->getMessage(), $search);
|
||||
$this->authorId = $comment->getActorId();
|
||||
$this->authorName = $authorName;
|
||||
$this->fileName = basename($path);
|
||||
$this->path = $this->getVisiblePath($path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,16 +27,6 @@ use function is_array;
|
|||
*/
|
||||
class PluginManager {
|
||||
|
||||
/**
|
||||
* @var ServerContainer
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @var IAppManager
|
||||
*/
|
||||
private $appManager;
|
||||
|
||||
/**
|
||||
* App plugins
|
||||
*
|
||||
|
|
@ -74,9 +64,10 @@ class PluginManager {
|
|||
* @param ServerContainer $container server container for resolving plugin classes
|
||||
* @param IAppManager $appManager app manager to loading apps and their info
|
||||
*/
|
||||
public function __construct(ServerContainer $container, IAppManager $appManager) {
|
||||
$this->container = $container;
|
||||
$this->appManager = $appManager;
|
||||
public function __construct(
|
||||
private ServerContainer $container,
|
||||
private IAppManager $appManager,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,20 +16,16 @@ use Sabre\Uri;
|
|||
|
||||
class AvatarHome implements ICollection {
|
||||
|
||||
/** @var array */
|
||||
private $principalInfo;
|
||||
/** @var IAvatarManager */
|
||||
private $avatarManager;
|
||||
|
||||
/**
|
||||
* AvatarHome constructor.
|
||||
*
|
||||
* @param array $principalInfo
|
||||
* @param IAvatarManager $avatarManager
|
||||
*/
|
||||
public function __construct($principalInfo, IAvatarManager $avatarManager) {
|
||||
$this->principalInfo = $principalInfo;
|
||||
$this->avatarManager = $avatarManager;
|
||||
public function __construct(
|
||||
private $principalInfo,
|
||||
private IAvatarManager $avatarManager,
|
||||
) {
|
||||
}
|
||||
|
||||
public function createFile($name, $data = null) {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ use OCP\IAvatar;
|
|||
use Sabre\DAV\File;
|
||||
|
||||
class AvatarNode extends File {
|
||||
private $ext;
|
||||
private $size;
|
||||
private $avatar;
|
||||
|
||||
/**
|
||||
* AvatarNode constructor.
|
||||
*
|
||||
|
|
@ -22,10 +18,11 @@ class AvatarNode extends File {
|
|||
* @param string $ext
|
||||
* @param IAvatar $avatar
|
||||
*/
|
||||
public function __construct($size, $ext, $avatar) {
|
||||
$this->size = $size;
|
||||
$this->ext = $ext;
|
||||
$this->avatar = $avatar;
|
||||
public function __construct(
|
||||
private $size,
|
||||
private $ext,
|
||||
private $avatar,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,10 +69,6 @@ class AvatarNode extends File {
|
|||
}
|
||||
|
||||
public function getLastModified() {
|
||||
$timestamp = $this->avatar->getFile($this->size)->getMTime();
|
||||
if (!empty($timestamp)) {
|
||||
return (int)$timestamp;
|
||||
}
|
||||
return $timestamp;
|
||||
return $this->avatar->getFile($this->size)->getMTime();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,33 +22,20 @@ use Psr\Log\LoggerInterface;
|
|||
*/
|
||||
class BuildReminderIndexBackgroundJob extends QueuedJob {
|
||||
|
||||
/** @var IDBConnection */
|
||||
private $db;
|
||||
|
||||
/** @var ReminderService */
|
||||
private $reminderService;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var IJobList */
|
||||
private $jobList;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
/**
|
||||
* BuildReminderIndexBackgroundJob constructor.
|
||||
*/
|
||||
public function __construct(IDBConnection $db,
|
||||
ReminderService $reminderService,
|
||||
LoggerInterface $logger,
|
||||
IJobList $jobList,
|
||||
ITimeFactory $timeFactory) {
|
||||
public function __construct(
|
||||
private IDBConnection $db,
|
||||
private ReminderService $reminderService,
|
||||
private LoggerInterface $logger,
|
||||
private IJobList $jobList,
|
||||
ITimeFactory $timeFactory,
|
||||
) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->db = $db;
|
||||
$this->reminderService = $reminderService;
|
||||
$this->logger = $logger;
|
||||
$this->jobList = $jobList;
|
||||
$this->timeFactory = $timeFactory;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,11 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\BackgroundJob\TimedJob;
|
||||
|
||||
class CalendarRetentionJob extends TimedJob {
|
||||
/** @var RetentionService */
|
||||
private $service;
|
||||
|
||||
public function __construct(ITimeFactory $time,
|
||||
RetentionService $service) {
|
||||
public function __construct(
|
||||
ITimeFactory $time,
|
||||
private RetentionService $service,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->service = $service;
|
||||
|
||||
// Run four times a day
|
||||
$this->setInterval(6 * 60 * 60);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\BackgroundJob\TimedJob;
|
||||
|
||||
class CleanupDirectLinksJob extends TimedJob {
|
||||
/** @var DirectMapper */
|
||||
private $mapper;
|
||||
|
||||
public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) {
|
||||
public function __construct(
|
||||
ITimeFactory $timeFactory,
|
||||
private DirectMapper $mapper,
|
||||
) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->mapper = $mapper;
|
||||
|
||||
// Run once a day at off-peak time
|
||||
$this->setInterval(24 * 60 * 60);
|
||||
|
|
|
|||
|
|
@ -14,12 +14,11 @@ use OCP\IDBConnection;
|
|||
|
||||
class CleanupInvitationTokenJob extends TimedJob {
|
||||
|
||||
/** @var IDBConnection */
|
||||
private $db;
|
||||
|
||||
public function __construct(IDBConnection $db, ITimeFactory $time) {
|
||||
public function __construct(
|
||||
private IDBConnection $db,
|
||||
ITimeFactory $time,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->db = $db;
|
||||
|
||||
// Run once a day at off-peak time
|
||||
$this->setInterval(24 * 60 * 60);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\DAV\BackgroundJob;
|
||||
|
||||
use OC\User\NoUserException;
|
||||
use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException;
|
||||
use OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException;
|
||||
use OCA\DAV\CalDAV\Reminder\ReminderService;
|
||||
|
|
@ -17,18 +18,12 @@ use OCP\IConfig;
|
|||
|
||||
class EventReminderJob extends TimedJob {
|
||||
|
||||
/** @var ReminderService */
|
||||
private $reminderService;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct(ITimeFactory $time,
|
||||
ReminderService $reminderService,
|
||||
IConfig $config) {
|
||||
public function __construct(
|
||||
ITimeFactory $time,
|
||||
private ReminderService $reminderService,
|
||||
private IConfig $config,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->reminderService = $reminderService;
|
||||
$this->config = $config;
|
||||
|
||||
// Run every 5 minutes
|
||||
$this->setInterval(5 * 60);
|
||||
|
|
@ -38,7 +33,7 @@ class EventReminderJob extends TimedJob {
|
|||
/**
|
||||
* @throws ProviderNotAvailableException
|
||||
* @throws NotificationTypeDoesNotExistException
|
||||
* @throws \OC\User\NoUserException
|
||||
* @throws NoUserException
|
||||
*/
|
||||
public function run($argument):void {
|
||||
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
|
||||
|
|
|
|||
|
|
@ -15,19 +15,12 @@ use OCP\IConfig;
|
|||
|
||||
class GenerateBirthdayCalendarBackgroundJob extends QueuedJob {
|
||||
|
||||
/** @var BirthdayService */
|
||||
private $birthdayService;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
public function __construct(ITimeFactory $time,
|
||||
BirthdayService $birthdayService,
|
||||
IConfig $config) {
|
||||
public function __construct(
|
||||
ITimeFactory $time,
|
||||
private BirthdayService $birthdayService,
|
||||
private IConfig $config,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
|
||||
$this->birthdayService = $birthdayService;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function run($argument) {
|
||||
|
|
|
|||
|
|
@ -18,17 +18,14 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
class PruneOutdatedSyncTokensJob extends TimedJob {
|
||||
|
||||
private IConfig $config;
|
||||
private LoggerInterface $logger;
|
||||
private CardDavBackend $cardDavBackend;
|
||||
private CalDavBackend $calDavBackend;
|
||||
|
||||
public function __construct(ITimeFactory $timeFactory, CalDavBackend $calDavBackend, CardDavBackend $cardDavBackend, IConfig $config, LoggerInterface $logger) {
|
||||
public function __construct(
|
||||
ITimeFactory $timeFactory,
|
||||
private CalDavBackend $calDavBackend,
|
||||
private CardDavBackend $cardDavBackend,
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($timeFactory);
|
||||
$this->calDavBackend = $calDavBackend;
|
||||
$this->cardDavBackend = $cardDavBackend;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
$this->setInterval(60 * 60 * 24); // One day
|
||||
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@ use OCP\IUserManager;
|
|||
|
||||
class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
||||
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
|
||||
/** @var IJobList */
|
||||
private $jobList;
|
||||
|
||||
/**
|
||||
* RegisterRegenerateBirthdayCalendars constructor.
|
||||
*
|
||||
|
|
@ -29,12 +23,12 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|||
* @param IUserManager $userManager
|
||||
* @param IJobList $jobList
|
||||
*/
|
||||
public function __construct(ITimeFactory $time,
|
||||
IUserManager $userManager,
|
||||
IJobList $jobList) {
|
||||
public function __construct(
|
||||
ITimeFactory $time,
|
||||
private IUserManager $userManager,
|
||||
private IJobList $jobList,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->userManager = $userManager;
|
||||
$this->jobList = $jobList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,15 +19,13 @@ use OCP\Files\NotFoundException;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UploadCleanup extends TimedJob {
|
||||
private IRootFolder $rootFolder;
|
||||
private IJobList $jobList;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobList $jobList, LoggerInterface $logger) {
|
||||
public function __construct(
|
||||
ITimeFactory $time,
|
||||
private IRootFolder $rootFolder,
|
||||
private IJobList $jobList,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->jobList = $jobList;
|
||||
$this->logger = $logger;
|
||||
|
||||
// Run once a day
|
||||
$this->setInterval(60 * 60 * 24);
|
||||
|
|
|
|||
|
|
@ -17,15 +17,10 @@ use Sabre\HTTP\RequestInterface;
|
|||
use Sabre\HTTP\ResponseInterface;
|
||||
|
||||
class BulkUploadPlugin extends ServerPlugin {
|
||||
private Folder $userFolder;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(
|
||||
Folder $userFolder,
|
||||
LoggerInterface $logger,
|
||||
private Folder $userFolder,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
$this->userFolder = $userFolder;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,27 +25,13 @@ use Sabre\VObject\Reader;
|
|||
*/
|
||||
class Backend {
|
||||
|
||||
/** @var IActivityManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/** @var IUserSession */
|
||||
protected $userSession;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
public function __construct(IActivityManager $activityManager, IGroupManager $groupManager, IUserSession $userSession, IAppManager $appManager, IUserManager $userManager) {
|
||||
$this->activityManager = $activityManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->userManager = $userManager;
|
||||
public function __construct(
|
||||
protected IActivityManager $activityManager,
|
||||
protected IGroupManager $groupManager,
|
||||
protected IUserSession $userSession,
|
||||
protected IAppManager $appManager,
|
||||
protected IUserManager $userManager,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,15 +11,10 @@ use OCP\IURLGenerator;
|
|||
|
||||
class Calendar implements IFilter {
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $url;
|
||||
|
||||
public function __construct(IL10N $l, IURLGenerator $url) {
|
||||
$this->l = $l;
|
||||
$this->url = $url;
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
protected IURLGenerator $url,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,15 +11,10 @@ use OCP\IURLGenerator;
|
|||
|
||||
class Todo implements IFilter {
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $url;
|
||||
|
||||
public function __construct(IL10N $l, IURLGenerator $url) {
|
||||
$this->l = $l;
|
||||
$this->url = $url;
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
protected IURLGenerator $url,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,27 +15,19 @@ use OCP\IURLGenerator;
|
|||
use OCP\IUserManager;
|
||||
|
||||
abstract class Base implements IProvider {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/** @var string[] */
|
||||
protected $groupDisplayNames = [];
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param IURLGenerator $url
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IGroupManager $groupManager, IURLGenerator $urlGenerator) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->url = $urlGenerator;
|
||||
public function __construct(
|
||||
protected IUserManager $userManager,
|
||||
protected IGroupManager $groupManager,
|
||||
protected IURLGenerator $url,
|
||||
) {
|
||||
}
|
||||
|
||||
protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
|
||||
|
|
|
|||
|
|
@ -28,18 +28,9 @@ class Calendar extends Base {
|
|||
public const SUBJECT_UNSHARE_USER = 'calendar_user_unshare';
|
||||
public const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare';
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IEventMerger */
|
||||
protected $eventMerger;
|
||||
|
||||
/**
|
||||
* @param IFactory $languageFactory
|
||||
* @param IURLGenerator $url
|
||||
|
|
@ -48,11 +39,15 @@ class Calendar extends Base {
|
|||
* @param IGroupManager $groupManager
|
||||
* @param IEventMerger $eventMerger
|
||||
*/
|
||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, IEventMerger $eventMerger) {
|
||||
public function __construct(
|
||||
protected IFactory $languageFactory,
|
||||
IURLGenerator $url,
|
||||
protected IManager $activityManager,
|
||||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
protected IEventMerger $eventMerger,
|
||||
) {
|
||||
parent::__construct($userManager, $groupManager, $url);
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->eventMerger = $eventMerger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,21 +25,9 @@ class Event extends Base {
|
|||
public const SUBJECT_OBJECT_RESTORE = 'object_restore';
|
||||
public const SUBJECT_OBJECT_DELETE = 'object_delete';
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IEventMerger */
|
||||
protected $eventMerger;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/**
|
||||
* @param IFactory $languageFactory
|
||||
* @param IURLGenerator $url
|
||||
|
|
@ -49,12 +37,16 @@ class Event extends Base {
|
|||
* @param IEventMerger $eventMerger
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IGroupManager $groupManager, IEventMerger $eventMerger, IAppManager $appManager) {
|
||||
public function __construct(
|
||||
protected IFactory $languageFactory,
|
||||
IURLGenerator $url,
|
||||
protected IManager $activityManager,
|
||||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
protected IEventMerger $eventMerger,
|
||||
protected IAppManager $appManager,
|
||||
) {
|
||||
parent::__construct($userManager, $groupManager, $url);
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->eventMerger = $eventMerger;
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ use OCP\Activity\ActivitySettings;
|
|||
use OCP\IL10N;
|
||||
|
||||
abstract class CalDAVSetting extends ActivitySettings {
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/**
|
||||
* @param IL10N $l
|
||||
*/
|
||||
public function __construct(IL10N $l) {
|
||||
$this->l = $l;
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getGroupIdentifier() {
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ use Sabre\VObject\Component\VCalendar;
|
|||
use Sabre\VObject\Reader;
|
||||
|
||||
class AppCalendar extends ExternalCalendar {
|
||||
protected string $principal;
|
||||
protected ICalendar $calendar;
|
||||
|
||||
public function __construct(string $appId, ICalendar $calendar, string $principal) {
|
||||
public function __construct(
|
||||
string $appId,
|
||||
ICalendar $calendar,
|
||||
protected string $principal,
|
||||
) {
|
||||
parent::__construct($appId, $calendar->getUri());
|
||||
$this->principal = $principal;
|
||||
$this->calendar = $calendar;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,10 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
/* Plugin for wrapping application generated calendars registered in nextcloud core (OCP\Calendar\ICalendarProvider) */
|
||||
class AppCalendarPlugin implements ICalendarProvider {
|
||||
protected IManager $manager;
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
public function __construct(IManager $manager, LoggerInterface $logger) {
|
||||
$this->manager = $manager;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
protected IManager $manager,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getAppID(): string {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,11 @@ use Sabre\VObject\Component\VCalendar;
|
|||
use Sabre\VObject\Property\ICalendar\DateTime;
|
||||
|
||||
class CalendarObject implements ICalendarObject, IACL {
|
||||
private VCalendar $vobject;
|
||||
private AppCalendar $calendar;
|
||||
private ICalendar|ICreateFromString $backend;
|
||||
|
||||
public function __construct(AppCalendar $calendar, ICalendar $backend, VCalendar $vobject) {
|
||||
$this->backend = $backend;
|
||||
$this->calendar = $calendar;
|
||||
$this->vobject = $vobject;
|
||||
public function __construct(
|
||||
private AppCalendar $calendar,
|
||||
private ICalendar|ICreateFromString $backend,
|
||||
private VCalendar $vobject,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getOwner() {
|
||||
|
|
|
|||
|
|
@ -23,24 +23,11 @@ use Sabre\HTTP\ResponseInterface;
|
|||
class EnablePlugin extends ServerPlugin {
|
||||
public const NS_Nextcloud = 'http://nextcloud.com/ns';
|
||||
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var BirthdayService
|
||||
*/
|
||||
protected $birthdayService;
|
||||
|
||||
/**
|
||||
* @var Server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/** @var IUser */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* PublishPlugin constructor.
|
||||
*
|
||||
|
|
@ -48,10 +35,11 @@ class EnablePlugin extends ServerPlugin {
|
|||
* @param BirthdayService $birthdayService
|
||||
* @param IUser $user
|
||||
*/
|
||||
public function __construct(IConfig $config, BirthdayService $birthdayService, IUser $user) {
|
||||
$this->config = $config;
|
||||
$this->birthdayService = $birthdayService;
|
||||
$this->user = $user;
|
||||
public function __construct(
|
||||
protected IConfig $config,
|
||||
protected BirthdayService $birthdayService,
|
||||
private IUser $user,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,28 +32,17 @@ class BirthdayService {
|
|||
public const BIRTHDAY_CALENDAR_URI = 'contact_birthdays';
|
||||
public const EXCLUDE_FROM_BIRTHDAY_CALENDAR_PROPERTY_NAME = 'X-NC-EXCLUDE-FROM-BIRTHDAY-CALENDAR';
|
||||
|
||||
private GroupPrincipalBackend $principalBackend;
|
||||
private CalDavBackend $calDavBackEnd;
|
||||
private CardDavBackend $cardDavBackEnd;
|
||||
private IConfig $config;
|
||||
private IDBConnection $dbConnection;
|
||||
private IL10N $l10n;
|
||||
|
||||
/**
|
||||
* BirthdayService constructor.
|
||||
*/
|
||||
public function __construct(CalDavBackend $calDavBackEnd,
|
||||
CardDavBackend $cardDavBackEnd,
|
||||
GroupPrincipalBackend $principalBackend,
|
||||
IConfig $config,
|
||||
IDBConnection $dbConnection,
|
||||
IL10N $l10n) {
|
||||
$this->calDavBackEnd = $calDavBackEnd;
|
||||
$this->cardDavBackEnd = $cardDavBackEnd;
|
||||
$this->principalBackend = $principalBackend;
|
||||
$this->config = $config;
|
||||
$this->dbConnection = $dbConnection;
|
||||
$this->l10n = $l10n;
|
||||
public function __construct(
|
||||
private CalDavBackend $calDavBackEnd,
|
||||
private CardDavBackend $cardDavBackEnd,
|
||||
private GroupPrincipalBackend $principalBackend,
|
||||
private IConfig $config,
|
||||
private IDBConnection $dbConnection,
|
||||
private IL10N $l10n,
|
||||
) {
|
||||
}
|
||||
|
||||
public function onCardChanged(int $addressBookId,
|
||||
|
|
|
|||
|
|
@ -12,19 +12,12 @@ use OCP\Calendar\ICalendar;
|
|||
use OCP\Constants;
|
||||
|
||||
class CachedSubscriptionImpl implements ICalendar {
|
||||
private CalDavBackend $backend;
|
||||
private CachedSubscription $calendar;
|
||||
/** @var array<string, mixed> */
|
||||
private array $calendarInfo;
|
||||
|
||||
public function __construct(
|
||||
CachedSubscription $calendar,
|
||||
array $calendarInfo,
|
||||
CalDavBackend $backend,
|
||||
private CachedSubscription $calendar,
|
||||
/** @var array<string, mixed> */
|
||||
private array $calendarInfo,
|
||||
private CalDavBackend $backend,
|
||||
) {
|
||||
$this->calendar = $calendar;
|
||||
$this->calendarInfo = $calendarInfo;
|
||||
$this->backend = $backend;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,12 +31,16 @@ use Sabre\DAV\PropPatch;
|
|||
* @property CalDavBackend $caldavBackend
|
||||
*/
|
||||
class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable, IMoveTarget {
|
||||
private IConfig $config;
|
||||
protected IL10N $l10n;
|
||||
private bool $useTrashbin = true;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n, IConfig $config, LoggerInterface $logger) {
|
||||
public function __construct(
|
||||
BackendInterface $caldavBackend,
|
||||
$calendarInfo,
|
||||
IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
// Convert deletion date to ISO8601 string
|
||||
if (isset($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])) {
|
||||
$calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT] = (new DateTimeImmutable())
|
||||
|
|
@ -53,10 +57,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
|
|||
$this->calendarInfo['{DAV:}displayname'] === CalDavBackend::PERSONAL_CALENDAR_NAME) {
|
||||
$this->calendarInfo['{DAV:}displayname'] = $l10n->t('Personal');
|
||||
}
|
||||
|
||||
$this->config = $config;
|
||||
$this->l10n = $l10n;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ use OCA\DAV\AppInfo\PluginManager;
|
|||
use OCA\DAV\CalDAV\Integration\ExternalCalendar;
|
||||
use OCA\DAV\CalDAV\Integration\ICalendarProvider;
|
||||
use OCA\DAV\CalDAV\Trashbin\TrashbinHome;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Sabre\CalDAV\Backend\BackendInterface;
|
||||
use Sabre\CalDAV\Backend\NotificationSupport;
|
||||
|
|
@ -25,23 +27,20 @@ use Sabre\DAV\MkCol;
|
|||
|
||||
class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||
|
||||
/** @var \OCP\IL10N */
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var \OCP\IConfig */
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var PluginManager */
|
||||
private $pluginManager;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
private ?array $cachedChildren = null;
|
||||
|
||||
public function __construct(
|
||||
BackendInterface $caldavBackend,
|
||||
array $principalInfo,
|
||||
LoggerInterface $logger,
|
||||
private LoggerInterface $logger,
|
||||
private bool $returnCachedSubscriptions,
|
||||
) {
|
||||
parent::__construct($caldavBackend, $principalInfo);
|
||||
|
|
@ -51,7 +50,6 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
\OC::$server,
|
||||
\OC::$server->getAppManager()
|
||||
);
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,17 +25,12 @@ use Sabre\VObject\Reader;
|
|||
use function Sabre\Uri\split as uriSplit;
|
||||
|
||||
class CalendarImpl implements ICreateFromString, IHandleImipMessage {
|
||||
private CalDavBackend $backend;
|
||||
private Calendar $calendar;
|
||||
/** @var array<string, mixed> */
|
||||
private array $calendarInfo;
|
||||
|
||||
public function __construct(Calendar $calendar,
|
||||
array $calendarInfo,
|
||||
CalDavBackend $backend) {
|
||||
$this->calendar = $calendar;
|
||||
$this->calendarInfo = $calendarInfo;
|
||||
$this->backend = $backend;
|
||||
public function __construct(
|
||||
private Calendar $calendar,
|
||||
/** @var array<string, mixed> */
|
||||
private array $calendarInfo,
|
||||
private CalDavBackend $backend,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,18 +12,6 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
class CalendarManager {
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $backend;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* CalendarManager constructor.
|
||||
*
|
||||
|
|
@ -31,11 +19,12 @@ class CalendarManager {
|
|||
* @param IL10N $l10n
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(CalDavBackend $backend, IL10N $l10n, IConfig $config, LoggerInterface $logger) {
|
||||
$this->backend = $backend;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private CalDavBackend $backend,
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ use Sabre\VObject\Reader;
|
|||
|
||||
class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l10n;
|
||||
|
||||
/**
|
||||
* CalendarObject constructor.
|
||||
*
|
||||
|
|
@ -24,16 +21,17 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
|||
* @param array $calendarInfo
|
||||
* @param array $objectData
|
||||
*/
|
||||
public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
|
||||
public function __construct(
|
||||
CalDavBackend $caldavBackend,
|
||||
protected IL10N $l10n,
|
||||
array $calendarInfo,
|
||||
array $objectData) {
|
||||
array $objectData,
|
||||
) {
|
||||
parent::__construct($caldavBackend, $calendarInfo, $objectData);
|
||||
|
||||
if ($this->isShared()) {
|
||||
unset($this->objectData['size']);
|
||||
}
|
||||
|
||||
$this->l10n = $l10n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,23 +15,12 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
class CalendarProvider implements ICalendarProvider {
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $calDavBackend;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(CalDavBackend $calDavBackend, IL10N $l10n, IConfig $config, LoggerInterface $logger) {
|
||||
$this->calDavBackend = $calDavBackend;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private CalDavBackend $calDavBackend,
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCalendars(string $principalUri, array $calendarUris = []): array {
|
||||
|
|
|
|||
|
|
@ -12,18 +12,15 @@ use Sabre\CalDAV\Backend;
|
|||
use Sabre\DAVACL\PrincipalBackend;
|
||||
|
||||
class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private array $returnCachedSubscriptions = [];
|
||||
|
||||
public function __construct(
|
||||
PrincipalBackend\BackendInterface $principalBackend,
|
||||
Backend\BackendInterface $caldavBackend,
|
||||
$principalPrefix,
|
||||
LoggerInterface $logger,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($principalBackend, $caldavBackend, $principalPrefix);
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function getChildForPrincipal(array $principal) {
|
||||
|
|
|
|||
|
|
@ -18,18 +18,16 @@ use Sabre\VObject\Property\ICalendar\Duration;
|
|||
* @package OCA\DAV\CalDAV\ICSExportPlugin
|
||||
*/
|
||||
class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
|
||||
private IConfig $config;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var string */
|
||||
private const DEFAULT_REFRESH_INTERVAL = 'PT4H';
|
||||
|
||||
/**
|
||||
* ICSExportPlugin constructor.
|
||||
*/
|
||||
public function __construct(IConfig $config, LoggerInterface $logger) {
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,21 +32,16 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
*/
|
||||
private const DELIMITER = '--';
|
||||
|
||||
/** @var string */
|
||||
private $appId;
|
||||
|
||||
/** @var string */
|
||||
private $calendarUri;
|
||||
|
||||
/**
|
||||
* ExternalCalendar constructor.
|
||||
*
|
||||
* @param string $appId
|
||||
* @param string $calendarUri
|
||||
*/
|
||||
public function __construct(string $appId, string $calendarUri) {
|
||||
$this->appId = $appId;
|
||||
$this->calendarUri = $calendarUri;
|
||||
public function __construct(
|
||||
private string $appId,
|
||||
private string $calendarUri,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ use Sabre\CalDAV\Plugin as CalDAVPlugin;
|
|||
*/
|
||||
class Outbox extends \Sabre\CalDAV\Schedule\Outbox {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var null|bool */
|
||||
private $disableFreeBusy = null;
|
||||
|
||||
|
|
@ -27,9 +24,11 @@ class Outbox extends \Sabre\CalDAV\Schedule\Outbox {
|
|||
* @param IConfig $config
|
||||
* @param string $principalUri
|
||||
*/
|
||||
public function __construct(IConfig $config, string $principalUri) {
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
string $principalUri,
|
||||
) {
|
||||
parent::__construct($principalUri);
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,18 +14,6 @@ use Sabre\DAV\Collection;
|
|||
|
||||
class PublicCalendarRoot extends Collection {
|
||||
|
||||
/** @var CalDavBackend */
|
||||
protected $caldavBackend;
|
||||
|
||||
/** @var \OCP\IL10N */
|
||||
protected $l10n;
|
||||
|
||||
/** @var \OCP\IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* PublicCalendarRoot constructor.
|
||||
*
|
||||
|
|
@ -33,12 +21,12 @@ class PublicCalendarRoot extends Collection {
|
|||
* @param IL10N $l10n
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
|
||||
IConfig $config, LoggerInterface $logger) {
|
||||
$this->caldavBackend = $caldavBackend;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
protected CalDavBackend $caldavBackend,
|
||||
protected IL10N $l10n,
|
||||
protected IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,29 +28,22 @@ class PublishPlugin extends ServerPlugin {
|
|||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Config instance to get instance secret.
|
||||
*
|
||||
* @var IConfig
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* URL Generator for absolute URLs.
|
||||
*
|
||||
* @var IURLGenerator
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
|
||||
/**
|
||||
* PublishPlugin constructor.
|
||||
*
|
||||
* @param IConfig $config
|
||||
* @param IURLGenerator $urlGenerator
|
||||
*/
|
||||
public function __construct(IConfig $config, IURLGenerator $urlGenerator) {
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(
|
||||
/**
|
||||
* Config instance to get instance secret.
|
||||
*/
|
||||
protected IConfig $config,
|
||||
/**
|
||||
* URL Generator for absolute URLs.
|
||||
*/
|
||||
protected IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,23 +10,14 @@ use Sabre\Xml\XmlSerializable;
|
|||
|
||||
class Publisher implements XmlSerializable {
|
||||
|
||||
/**
|
||||
* @var string $publishUrl
|
||||
*/
|
||||
protected $publishUrl;
|
||||
|
||||
/**
|
||||
* @var boolean $isPublished
|
||||
*/
|
||||
protected $isPublished;
|
||||
|
||||
/**
|
||||
* @param string $publishUrl
|
||||
* @param boolean $isPublished
|
||||
*/
|
||||
public function __construct($publishUrl, $isPublished) {
|
||||
$this->publishUrl = $publishUrl;
|
||||
$this->isPublished = $isPublished;
|
||||
public function __construct(
|
||||
protected $publishUrl,
|
||||
protected $isPublished,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,31 +29,18 @@ abstract class AbstractProvider implements INotificationProvider {
|
|||
/** @var string */
|
||||
public const NOTIFICATION_TYPE = '';
|
||||
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/** @var L10NFactory */
|
||||
protected $l10nFactory;
|
||||
|
||||
/** @var IL10N[] */
|
||||
private $l10ns;
|
||||
|
||||
/** @var string */
|
||||
private $fallbackLanguage;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $urlGenerator;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
public function __construct(LoggerInterface $logger,
|
||||
L10NFactory $l10nFactory,
|
||||
IURLGenerator $urlGenerator,
|
||||
IConfig $config) {
|
||||
$this->logger = $logger;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
protected LoggerInterface $logger,
|
||||
protected L10NFactory $l10nFactory,
|
||||
protected IURLGenerator $urlGenerator,
|
||||
protected IConfig $config,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,15 +33,14 @@ class EmailProvider extends AbstractProvider {
|
|||
/** @var string */
|
||||
public const NOTIFICATION_TYPE = 'EMAIL';
|
||||
|
||||
private IMailer $mailer;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IMailer $mailer,
|
||||
public function __construct(
|
||||
IConfig $config,
|
||||
private IMailer $mailer,
|
||||
LoggerInterface $logger,
|
||||
L10NFactory $l10nFactory,
|
||||
IURLGenerator $urlGenerator) {
|
||||
IURLGenerator $urlGenerator,
|
||||
) {
|
||||
parent::__construct($logger, $l10nFactory, $urlGenerator, $config);
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,21 +30,15 @@ class PushProvider extends AbstractProvider {
|
|||
/** @var string */
|
||||
public const NOTIFICATION_TYPE = 'DISPLAY';
|
||||
|
||||
/** @var IManager */
|
||||
private $manager;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IManager $manager,
|
||||
public function __construct(
|
||||
IConfig $config,
|
||||
private IManager $manager,
|
||||
LoggerInterface $logger,
|
||||
L10NFactory $l10nFactory,
|
||||
IURLGenerator $urlGenerator,
|
||||
ITimeFactory $timeFactory) {
|
||||
private ITimeFactory $timeFactory,
|
||||
) {
|
||||
parent::__construct($logger, $l10nFactory, $urlGenerator, $config);
|
||||
$this->manager = $manager;
|
||||
$this->timeFactory = $timeFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
namespace OCA\DAV\CalDAV\Reminder;
|
||||
|
||||
use OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException;
|
||||
use OCP\AppFramework\QueryException;
|
||||
|
||||
/**
|
||||
* Class NotificationProviderManager
|
||||
|
|
@ -53,7 +54,7 @@ class NotificationProviderManager {
|
|||
* Registers a new provider
|
||||
*
|
||||
* @param string $providerClassName
|
||||
* @throws \OCP\AppFramework\QueryException
|
||||
* @throws QueryException
|
||||
*/
|
||||
public function registerProvider(string $providerClassName):void {
|
||||
$provider = \OC::$server->query($providerClassName);
|
||||
|
|
|
|||
|
|
@ -26,31 +26,21 @@ use OCP\Notification\UnknownNotificationException;
|
|||
*/
|
||||
class Notifier implements INotifier {
|
||||
|
||||
/** @var IFactory */
|
||||
private $l10nFactory;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
/**
|
||||
* Notifier constructor.
|
||||
*
|
||||
* @param IFactory $factory
|
||||
* @param IFactory $l10nFactory
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param ITimeFactory $timeFactory
|
||||
*/
|
||||
public function __construct(IFactory $factory,
|
||||
IURLGenerator $urlGenerator,
|
||||
ITimeFactory $timeFactory) {
|
||||
$this->l10nFactory = $factory;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->timeFactory = $timeFactory;
|
||||
public function __construct(
|
||||
private IFactory $l10nFactory,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private ITimeFactory $timeFactory,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,33 +32,6 @@ use function strcasecmp;
|
|||
|
||||
class ReminderService {
|
||||
|
||||
/** @var Backend */
|
||||
private $backend;
|
||||
|
||||
/** @var NotificationProviderManager */
|
||||
private $notificationProviderManager;
|
||||
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $caldavBackend;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var Principal */
|
||||
private $principalConnector;
|
||||
|
||||
public const REMINDER_TYPE_EMAIL = 'EMAIL';
|
||||
public const REMINDER_TYPE_DISPLAY = 'DISPLAY';
|
||||
public const REMINDER_TYPE_AUDIO = 'AUDIO';
|
||||
|
|
@ -74,24 +47,17 @@ class ReminderService {
|
|||
self::REMINDER_TYPE_AUDIO
|
||||
];
|
||||
|
||||
public function __construct(Backend $backend,
|
||||
NotificationProviderManager $notificationProviderManager,
|
||||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
CalDavBackend $caldavBackend,
|
||||
ITimeFactory $timeFactory,
|
||||
IConfig $config,
|
||||
LoggerInterface $logger,
|
||||
Principal $principalConnector) {
|
||||
$this->backend = $backend;
|
||||
$this->notificationProviderManager = $notificationProviderManager;
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->caldavBackend = $caldavBackend;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
$this->principalConnector = $principalConnector;
|
||||
public function __construct(
|
||||
private Backend $backend,
|
||||
private NotificationProviderManager $notificationProviderManager,
|
||||
private IUserManager $userManager,
|
||||
private IGroupManager $groupManager,
|
||||
private CalDavBackend $caldavBackend,
|
||||
private ITimeFactory $timeFactory,
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
private Principal $principalConnector,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,17 +25,6 @@ use function array_values;
|
|||
|
||||
abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||
|
||||
/** @var IDBConnection */
|
||||
private $db;
|
||||
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var ProxyMapper */
|
||||
private $proxyMapper;
|
||||
|
||||
|
|
@ -51,27 +40,21 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
/** @var string */
|
||||
private $dbForeignKeyName;
|
||||
|
||||
/** @var string */
|
||||
private $cuType;
|
||||
|
||||
public function __construct(IDBConnection $dbConnection,
|
||||
IUserSession $userSession,
|
||||
IGroupManager $groupManager,
|
||||
LoggerInterface $logger,
|
||||
public function __construct(
|
||||
private IDBConnection $db,
|
||||
private IUserSession $userSession,
|
||||
private IGroupManager $groupManager,
|
||||
private LoggerInterface $logger,
|
||||
ProxyMapper $proxyMapper,
|
||||
string $principalPrefix,
|
||||
string $dbPrefix,
|
||||
string $cuType) {
|
||||
$this->db = $dbConnection;
|
||||
$this->userSession = $userSession;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->logger = $logger;
|
||||
private string $cuType,
|
||||
) {
|
||||
$this->proxyMapper = $proxyMapper;
|
||||
$this->principalPrefix = $principalPrefix;
|
||||
$this->dbTableName = 'calendar_' . $dbPrefix . 's';
|
||||
$this->dbMetaDataTableName = $this->dbTableName . '_md';
|
||||
$this->dbForeignKeyName = $dbPrefix . '_id';
|
||||
$this->cuType = $cuType;
|
||||
}
|
||||
|
||||
use PrincipalProxyTrait;
|
||||
|
|
|
|||
|
|
@ -17,21 +17,11 @@ class RetentionService {
|
|||
public const RETENTION_CONFIG_KEY = 'calendarRetentionObligation';
|
||||
private const DEFAULT_RETENTION_SECONDS = 30 * 24 * 60 * 60;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
private $time;
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $calDavBackend;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
ITimeFactory $time,
|
||||
CalDavBackend $calDavBackend) {
|
||||
$this->config = $config;
|
||||
$this->time = $time;
|
||||
$this->calDavBackend = $calDavBackend;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private ITimeFactory $time,
|
||||
private CalDavBackend $calDavBackend,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getDuration(): int {
|
||||
|
|
|
|||
|
|
@ -45,41 +45,25 @@ use Sabre\VObject\Reader;
|
|||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class IMipPlugin extends SabreIMipPlugin {
|
||||
private IUserSession $userSession;
|
||||
private IConfig $config;
|
||||
private IMailer $mailer;
|
||||
private LoggerInterface $logger;
|
||||
private ITimeFactory $timeFactory;
|
||||
private Defaults $defaults;
|
||||
private ?VCalendar $vCalendar = null;
|
||||
private IMipService $imipService;
|
||||
public const MAX_DATE = '2038-01-01';
|
||||
public const METHOD_REQUEST = 'request';
|
||||
public const METHOD_REPLY = 'reply';
|
||||
public const METHOD_CANCEL = 'cancel';
|
||||
public const IMIP_INDENT = 15; // Enough for the length of all body bullet items, in all languages
|
||||
private EventComparisonService $eventComparisonService;
|
||||
private IMailManager $mailManager;
|
||||
public const IMIP_INDENT = 15;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IMailer $mailer,
|
||||
LoggerInterface $logger,
|
||||
ITimeFactory $timeFactory,
|
||||
Defaults $defaults,
|
||||
IUserSession $userSession,
|
||||
IMipService $imipService,
|
||||
EventComparisonService $eventComparisonService,
|
||||
IMailManager $mailManager) {
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private IMailer $mailer,
|
||||
private LoggerInterface $logger,
|
||||
private ITimeFactory $timeFactory,
|
||||
private Defaults $defaults,
|
||||
private IUserSession $userSession,
|
||||
private IMipService $imipService,
|
||||
private EventComparisonService $eventComparisonService,
|
||||
private IMailManager $mailManager,
|
||||
) {
|
||||
parent::__construct('');
|
||||
$this->userSession = $userSession;
|
||||
$this->config = $config;
|
||||
$this->mailer = $mailer;
|
||||
$this->logger = $logger;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->defaults = $defaults;
|
||||
$this->imipService = $imipService;
|
||||
$this->eventComparisonService = $eventComparisonService;
|
||||
$this->mailManager = $mailManager;
|
||||
}
|
||||
|
||||
public function initialize(DAV\Server $server): void {
|
||||
|
|
|
|||
|
|
@ -41,11 +41,6 @@ use function Sabre\Uri\split;
|
|||
|
||||
class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
|
||||
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/** @var ITip\Message[] */
|
||||
private $schedulingResponses = [];
|
||||
|
||||
|
|
@ -54,16 +49,15 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
|
|||
|
||||
public const CALENDAR_USER_TYPE = '{' . self::NS_CALDAV . '}calendar-user-type';
|
||||
public const SCHEDULE_DEFAULT_CALENDAR_URL = '{' . Plugin::NS_CALDAV . '}schedule-default-calendar-URL';
|
||||
private LoggerInterface $logger;
|
||||
private DefaultCalendarValidator $defaultCalendarValidator;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config, LoggerInterface $logger, DefaultCalendarValidator $defaultCalendarValidator) {
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
$this->defaultCalendarValidator = $defaultCalendarValidator;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private LoggerInterface $logger,
|
||||
private DefaultCalendarValidator $defaultCalendarValidator,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,24 +25,16 @@ use function explode;
|
|||
class RateLimitingPlugin extends ServerPlugin {
|
||||
|
||||
private Limiter $limiter;
|
||||
private IUserManager $userManager;
|
||||
private CalDavBackend $calDavBackend;
|
||||
private IAppConfig $config;
|
||||
private LoggerInterface $logger;
|
||||
private ?string $userId;
|
||||
|
||||
public function __construct(Limiter $limiter,
|
||||
IUserManager $userManager,
|
||||
CalDavBackend $calDavBackend,
|
||||
LoggerInterface $logger,
|
||||
IAppConfig $config,
|
||||
?string $userId) {
|
||||
public function __construct(
|
||||
Limiter $limiter,
|
||||
private IUserManager $userManager,
|
||||
private CalDavBackend $calDavBackend,
|
||||
private LoggerInterface $logger,
|
||||
private IAppConfig $config,
|
||||
private ?string $userId,
|
||||
) {
|
||||
$this->limiter = $limiter;
|
||||
$this->userManager = $userManager;
|
||||
$this->calDavBackend = $calDavBackend;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function initialize(DAV\Server $server): void {
|
||||
|
|
|
|||
|
|
@ -18,26 +18,13 @@ use Sabre\DAVACL\IACL;
|
|||
class DeletedCalendarObject implements IACL, ICalendarObject, IRestorable {
|
||||
use ACLTrait;
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var mixed[] */
|
||||
private $objectData;
|
||||
|
||||
/** @var string */
|
||||
private $principalUri;
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $calDavBackend;
|
||||
|
||||
public function __construct(string $name,
|
||||
array $objectData,
|
||||
string $principalUri,
|
||||
CalDavBackend $calDavBackend) {
|
||||
$this->name = $name;
|
||||
$this->objectData = $objectData;
|
||||
$this->calDavBackend = $calDavBackend;
|
||||
$this->principalUri = $principalUri;
|
||||
public function __construct(
|
||||
private string $name,
|
||||
/** @var mixed[] */
|
||||
private array $objectData,
|
||||
private string $principalUri,
|
||||
private CalDavBackend $calDavBackend,
|
||||
) {
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
|
|
|
|||
|
|
@ -25,16 +25,11 @@ class DeletedCalendarObjectsCollection implements ICalendarObjectContainer, IACL
|
|||
|
||||
public const NAME = 'objects';
|
||||
|
||||
/** @var CalDavBackend */
|
||||
protected $caldavBackend;
|
||||
|
||||
/** @var mixed[] */
|
||||
private $principalInfo;
|
||||
|
||||
public function __construct(CalDavBackend $caldavBackend,
|
||||
array $principalInfo) {
|
||||
$this->caldavBackend = $caldavBackend;
|
||||
$this->principalInfo = $principalInfo;
|
||||
public function __construct(
|
||||
protected CalDavBackend $caldavBackend,
|
||||
/** @var mixed[] */
|
||||
private array $principalInfo,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,16 +32,14 @@ class Plugin extends ServerPlugin {
|
|||
/** @var bool */
|
||||
private $disableTrashbin;
|
||||
|
||||
/** @var RetentionService */
|
||||
private $retentionService;
|
||||
|
||||
/** @var Server */
|
||||
private $server;
|
||||
|
||||
public function __construct(IRequest $request,
|
||||
RetentionService $retentionService) {
|
||||
public function __construct(
|
||||
IRequest $request,
|
||||
private RetentionService $retentionService,
|
||||
) {
|
||||
$this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1';
|
||||
$this->retentionService = $retentionService;
|
||||
}
|
||||
|
||||
public function initialize(Server $server): void {
|
||||
|
|
|
|||
|
|
@ -26,16 +26,10 @@ class TrashbinHome implements IACL, ICollection, IProperties {
|
|||
|
||||
public const NAME = 'trashbin';
|
||||
|
||||
/** @var CalDavBackend */
|
||||
private $caldavBackend;
|
||||
|
||||
/** @var array */
|
||||
private $principalInfo;
|
||||
|
||||
public function __construct(CalDavBackend $caldavBackend,
|
||||
array $principalInfo) {
|
||||
$this->caldavBackend = $caldavBackend;
|
||||
$this->principalInfo = $principalInfo;
|
||||
public function __construct(
|
||||
private CalDavBackend $caldavBackend,
|
||||
private array $principalInfo,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getOwner(): string {
|
||||
|
|
|
|||
|
|
@ -9,10 +9,9 @@ use OCP\Capabilities\ICapability;
|
|||
use OCP\IConfig;
|
||||
|
||||
class Capabilities implements ICapability {
|
||||
private IConfig $config;
|
||||
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,31 +22,13 @@ use Sabre\VObject\Reader;
|
|||
|
||||
class Backend {
|
||||
|
||||
/** @var IActivityManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/** @var IUserSession */
|
||||
protected $userSession;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
public function __construct(IActivityManager $activityManager,
|
||||
IGroupManager $groupManager,
|
||||
IUserSession $userSession,
|
||||
IAppManager $appManager,
|
||||
IUserManager $userManager) {
|
||||
$this->activityManager = $activityManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->userManager = $userManager;
|
||||
public function __construct(
|
||||
protected IActivityManager $activityManager,
|
||||
protected IGroupManager $groupManager,
|
||||
protected IUserSession $userSession,
|
||||
protected IAppManager $appManager,
|
||||
protected IUserManager $userManager,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,15 +11,10 @@ use OCP\IURLGenerator;
|
|||
|
||||
class Filter implements IFilter {
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $url;
|
||||
|
||||
public function __construct(IL10N $l, IURLGenerator $url) {
|
||||
$this->l = $l;
|
||||
$this->url = $url;
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
protected IURLGenerator $url,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,25 +27,15 @@ class Addressbook extends Base {
|
|||
public const SUBJECT_UNSHARE_USER = 'addressbook_user_unshare';
|
||||
public const SUBJECT_UNSHARE_GROUP = 'addressbook_group_unshare';
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IEventMerger */
|
||||
protected $eventMerger;
|
||||
|
||||
public function __construct(IFactory $languageFactory,
|
||||
public function __construct(
|
||||
protected IFactory $languageFactory,
|
||||
IURLGenerator $url,
|
||||
IManager $activityManager,
|
||||
protected IManager $activityManager,
|
||||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
IEventMerger $eventMerger) {
|
||||
protected IEventMerger $eventMerger,
|
||||
) {
|
||||
parent::__construct($userManager, $groupManager, $url);
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->eventMerger = $eventMerger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,27 +18,17 @@ use OCP\IURLGenerator;
|
|||
use OCP\IUserManager;
|
||||
|
||||
abstract class Base implements IProvider {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var string[] */
|
||||
protected $userDisplayNames = [];
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/** @var string[] */
|
||||
protected $groupDisplayNames = [];
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $url;
|
||||
|
||||
public function __construct(IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
IURLGenerator $urlGenerator) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->url = $urlGenerator;
|
||||
public function __construct(
|
||||
protected IUserManager $userManager,
|
||||
protected IGroupManager $groupManager,
|
||||
protected IURLGenerator $url,
|
||||
) {
|
||||
}
|
||||
|
||||
protected function setSubjects(IEvent $event, string $subject, array $parameters): void {
|
||||
|
|
|
|||
|
|
@ -24,30 +24,16 @@ class Card extends Base {
|
|||
public const SUBJECT_UPDATE = 'card_update';
|
||||
public const SUBJECT_DELETE = 'card_delete';
|
||||
|
||||
/** @var IFactory */
|
||||
protected $languageFactory;
|
||||
|
||||
/** @var IManager */
|
||||
protected $activityManager;
|
||||
|
||||
/** @var IEventMerger */
|
||||
protected $eventMerger;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
public function __construct(IFactory $languageFactory,
|
||||
public function __construct(
|
||||
protected IFactory $languageFactory,
|
||||
IURLGenerator $url,
|
||||
IManager $activityManager,
|
||||
protected IManager $activityManager,
|
||||
IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
IEventMerger $eventMerger,
|
||||
IAppManager $appManager) {
|
||||
protected IEventMerger $eventMerger,
|
||||
protected IAppManager $appManager,
|
||||
) {
|
||||
parent::__construct($userManager, $groupManager, $url);
|
||||
$this->languageFactory = $languageFactory;
|
||||
$this->activityManager = $activityManager;
|
||||
$this->eventMerger = $eventMerger;
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,18 +17,6 @@ use Sabre\VObject\UUIDUtil;
|
|||
|
||||
class AddressBookImpl implements IAddressBook {
|
||||
|
||||
/** @var CardDavBackend */
|
||||
private $backend;
|
||||
|
||||
/** @var array */
|
||||
private $addressBookInfo;
|
||||
|
||||
/** @var AddressBook */
|
||||
private $addressBook;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
/**
|
||||
* AddressBookImpl constructor.
|
||||
*
|
||||
|
|
@ -38,14 +26,11 @@ class AddressBookImpl implements IAddressBook {
|
|||
* @param IUrlGenerator $urlGenerator
|
||||
*/
|
||||
public function __construct(
|
||||
AddressBook $addressBook,
|
||||
array $addressBookInfo,
|
||||
CardDavBackend $backend,
|
||||
IURLGenerator $urlGenerator) {
|
||||
$this->addressBook = $addressBook;
|
||||
$this->addressBookInfo = $addressBookInfo;
|
||||
$this->backend = $backend;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
private AddressBook $addressBook,
|
||||
private array $addressBookInfo,
|
||||
private CardDavBackend $backend,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,26 +13,20 @@ use OCP\IUser;
|
|||
|
||||
class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
||||
|
||||
/** @var PluginManager */
|
||||
private $pluginManager;
|
||||
private ?IUser $user;
|
||||
private ?IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param \Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend
|
||||
* @param \Sabre\CardDAV\Backend\BackendInterface $carddavBackend
|
||||
* @param string $principalPrefix
|
||||
*/
|
||||
public function __construct(\Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend,
|
||||
public function __construct(
|
||||
\Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend,
|
||||
\Sabre\CardDAV\Backend\BackendInterface $carddavBackend,
|
||||
PluginManager $pluginManager,
|
||||
?IUser $user,
|
||||
?IGroupManager $groupManager,
|
||||
string $principalPrefix = 'principals') {
|
||||
private PluginManager $pluginManager,
|
||||
private ?IUser $user,
|
||||
private ?IGroupManager $groupManager,
|
||||
string $principalPrefix = 'principals',
|
||||
) {
|
||||
parent::__construct($principalBackend, $carddavBackend, $principalPrefix);
|
||||
$this->pluginManager = $pluginManager;
|
||||
$this->user = $user;
|
||||
$this->groupManager = $groupManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,21 +12,16 @@ use OCP\IL10N;
|
|||
use OCP\IURLGenerator;
|
||||
|
||||
class ContactsManager {
|
||||
/** @var CardDavBackend */
|
||||
private $backend;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/**
|
||||
* ContactsManager constructor.
|
||||
*
|
||||
* @param CardDavBackend $backend
|
||||
* @param IL10N $l10n
|
||||
*/
|
||||
public function __construct(CardDavBackend $backend, IL10N $l10n) {
|
||||
$this->backend = $backend;
|
||||
$this->l10n = $l10n;
|
||||
public function __construct(
|
||||
private CardDavBackend $backend,
|
||||
private IL10N $l10n,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,21 +20,12 @@ use Sabre\VObject\Property\Text;
|
|||
use Sabre\VObject\Property\VCard\Date;
|
||||
|
||||
class Converter {
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/** @var IAccountManager */
|
||||
private $accountManager;
|
||||
private IUserManager $userManager;
|
||||
|
||||
public function __construct(
|
||||
IAccountManager $accountManager,
|
||||
IUserManager $userManager,
|
||||
IURLGenerator $urlGenerator,
|
||||
private IAccountManager $accountManager,
|
||||
private IUserManager $userManager,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
$this->accountManager = $accountManager;
|
||||
$this->userManager = $userManager;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function createCardFromUser(IUser $user): ?VCard {
|
||||
|
|
|
|||
|
|
@ -18,16 +18,15 @@ class ImageExportPlugin extends ServerPlugin {
|
|||
|
||||
/** @var Server */
|
||||
protected $server;
|
||||
/** @var PhotoCache */
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* ImageExportPlugin constructor.
|
||||
*
|
||||
* @param PhotoCache $cache
|
||||
*/
|
||||
public function __construct(PhotoCache $cache) {
|
||||
$this->cache = $cache;
|
||||
public function __construct(
|
||||
private PhotoCache $cache,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
|||
*/
|
||||
private const DELIMITER = '--';
|
||||
|
||||
private string $appId;
|
||||
private string $uri;
|
||||
|
||||
public function __construct(string $appId, string $uri) {
|
||||
$this->appId = $appId;
|
||||
$this->uri = $uri;
|
||||
public function __construct(
|
||||
private string $appId,
|
||||
private string $uri,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,15 +28,13 @@ class PhotoCache {
|
|||
'image/vnd.microsoft.icon' => 'ico',
|
||||
];
|
||||
|
||||
protected IAppData $appData;
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* PhotoCache constructor.
|
||||
*/
|
||||
public function __construct(IAppData $appData, LoggerInterface $logger) {
|
||||
$this->appData = $appData;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
protected IAppData $appData,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,22 +23,19 @@ use function count;
|
|||
use function explode;
|
||||
|
||||
class CardDavRateLimitingPlugin extends ServerPlugin {
|
||||
private ?string $userId;
|
||||
|
||||
public function __construct(
|
||||
private Limiter $limiter,
|
||||
private IUserManager $userManager,
|
||||
private CardDavBackend $cardDavBackend,
|
||||
private LoggerInterface $logger,
|
||||
private IAppConfig $config,
|
||||
?string $userId,
|
||||
private ?string $userId,
|
||||
) {
|
||||
$this->limiter = $limiter;
|
||||
$this->userManager = $userManager;
|
||||
$this->cardDavBackend = $cardDavBackend;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function initialize(DAV\Server $server): void {
|
||||
|
|
|
|||
|
|
@ -26,32 +26,19 @@ use function is_null;
|
|||
class SyncService {
|
||||
|
||||
use TTransactional;
|
||||
|
||||
private CardDavBackend $backend;
|
||||
private IUserManager $userManager;
|
||||
private IDBConnection $dbConnection;
|
||||
private LoggerInterface $logger;
|
||||
private ?array $localSystemAddressBook = null;
|
||||
private Converter $converter;
|
||||
protected string $certPath;
|
||||
private IClientService $clientService;
|
||||
private IConfig $config;
|
||||
|
||||
public function __construct(CardDavBackend $backend,
|
||||
IUserManager $userManager,
|
||||
IDBConnection $dbConnection,
|
||||
LoggerInterface $logger,
|
||||
Converter $converter,
|
||||
IClientService $clientService,
|
||||
IConfig $config) {
|
||||
$this->backend = $backend;
|
||||
$this->userManager = $userManager;
|
||||
$this->logger = $logger;
|
||||
$this->converter = $converter;
|
||||
public function __construct(
|
||||
private CardDavBackend $backend,
|
||||
private IUserManager $userManager,
|
||||
private IDBConnection $dbConnection,
|
||||
private LoggerInterface $logger,
|
||||
private Converter $converter,
|
||||
private IClientService $clientService,
|
||||
private IConfig $config,
|
||||
) {
|
||||
$this->certPath = '';
|
||||
$this->dbConnection = $dbConnection;
|
||||
$this->clientService = $clientService;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,27 +30,18 @@ use function in_array;
|
|||
|
||||
class SystemAddressbook extends AddressBook {
|
||||
public const URI_SHARED = 'z-server-generated--system';
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
private IUserSession $userSession;
|
||||
private ?TrustedServers $trustedServers;
|
||||
private ?IRequest $request;
|
||||
private ?IGroupManager $groupManager;
|
||||
|
||||
public function __construct(BackendInterface $carddavBackend,
|
||||
public function __construct(
|
||||
BackendInterface $carddavBackend,
|
||||
array $addressBookInfo,
|
||||
IL10N $l10n,
|
||||
IConfig $config,
|
||||
IUserSession $userSession,
|
||||
?IRequest $request = null,
|
||||
?TrustedServers $trustedServers = null,
|
||||
?IGroupManager $groupManager = null) {
|
||||
private IConfig $config,
|
||||
private IUserSession $userSession,
|
||||
private ?IRequest $request = null,
|
||||
private ?TrustedServers $trustedServers = null,
|
||||
private ?IGroupManager $groupManager = null,
|
||||
) {
|
||||
parent::__construct($carddavBackend, $addressBookInfo, $l10n);
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
$this->request = $request;
|
||||
$this->trustedServers = $trustedServers;
|
||||
$this->groupManager = $groupManager;
|
||||
|
||||
$this->addressBookInfo['{DAV:}displayname'] = $l10n->t('Accounts');
|
||||
$this->addressBookInfo['{' . Plugin::NS_CARDDAV . '}addressbook-description'] = $l10n->t('System address book which holds all accounts');
|
||||
|
|
|
|||
|
|
@ -36,20 +36,14 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var PluginManager */
|
||||
private $pluginManager;
|
||||
private ?IUser $user;
|
||||
private ?IGroupManager $groupManager;
|
||||
|
||||
public function __construct(Backend\BackendInterface $carddavBackend,
|
||||
public function __construct(
|
||||
Backend\BackendInterface $carddavBackend,
|
||||
string $principalUri,
|
||||
PluginManager $pluginManager,
|
||||
?IUser $user,
|
||||
?IGroupManager $groupManager) {
|
||||
private PluginManager $pluginManager,
|
||||
private ?IUser $user,
|
||||
private ?IGroupManager $groupManager,
|
||||
) {
|
||||
parent::__construct($carddavBackend, $principalUri);
|
||||
$this->pluginManager = $pluginManager;
|
||||
$this->user = $user;
|
||||
$this->groupManager = $groupManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,14 +13,12 @@ use Sabre\Xml\XmlSerializable;
|
|||
class Groups implements XmlSerializable {
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/** @var string[] of TYPE:CHECKSUM */
|
||||
private $groups;
|
||||
|
||||
/**
|
||||
* @param string $groups
|
||||
* @param list<string> $groups
|
||||
*/
|
||||
public function __construct($groups) {
|
||||
$this->groups = $groups;
|
||||
public function __construct(
|
||||
private array $groups,
|
||||
) {
|
||||
}
|
||||
|
||||
public function xmlSerialize(Writer $writer) {
|
||||
|
|
|
|||
|
|
@ -30,37 +30,19 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
public const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId';
|
||||
public const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName';
|
||||
|
||||
/** @var IComment */
|
||||
public $comment;
|
||||
|
||||
/** @var ICommentsManager */
|
||||
protected $commentsManager;
|
||||
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/** @var array list of properties with key being their name and value their setter */
|
||||
protected $properties = [];
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IUserSession */
|
||||
protected $userSession;
|
||||
|
||||
/**
|
||||
* CommentNode constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ICommentsManager $commentsManager,
|
||||
IComment $comment,
|
||||
IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
LoggerInterface $logger,
|
||||
protected ICommentsManager $commentsManager,
|
||||
public IComment $comment,
|
||||
protected IUserManager $userManager,
|
||||
protected IUserSession $userSession,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->comment = $comment;
|
||||
$this->logger = $logger;
|
||||
|
||||
$methods = get_class_methods($this->comment);
|
||||
$methods = array_filter($methods, function ($name) {
|
||||
return str_starts_with($name, 'get');
|
||||
|
|
@ -72,8 +54,6 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
$name = '{' . self::NS_OWNCLOUD . '}' . lcfirst(substr($getter, 3));
|
||||
$this->properties[$name] = $getter;
|
||||
}
|
||||
$this->userManager = $userManager;
|
||||
$this->userSession = $userSession;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,24 +35,19 @@ class CommentsPlugin extends ServerPlugin {
|
|||
public const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset';
|
||||
public const REPORT_PARAM_TIMESTAMP = '{http://owncloud.org/ns}datetime';
|
||||
|
||||
/** @var ICommentsManager */
|
||||
protected $commentsManager;
|
||||
|
||||
/** @var \Sabre\DAV\Server $server */
|
||||
private $server;
|
||||
|
||||
/** @var \OCP\IUserSession */
|
||||
protected $userSession;
|
||||
|
||||
/**
|
||||
* Comments plugin
|
||||
*
|
||||
* @param ICommentsManager $commentsManager
|
||||
* @param IUserSession $userSession
|
||||
*/
|
||||
public function __construct(ICommentsManager $commentsManager, IUserSession $userSession) {
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->userSession = $userSession;
|
||||
public function __construct(
|
||||
protected ICommentsManager $commentsManager,
|
||||
protected IUserSession $userSession,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,11 +27,6 @@ use Sabre\DAV\PropPatch;
|
|||
class EntityCollection extends RootCollection implements IProperties {
|
||||
public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
|
||||
|
||||
/** @var string */
|
||||
protected $id;
|
||||
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $name
|
||||
|
|
@ -41,12 +36,12 @@ class EntityCollection extends RootCollection implements IProperties {
|
|||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
protected $id,
|
||||
$name,
|
||||
ICommentsManager $commentsManager,
|
||||
IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
LoggerInterface $logger,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
foreach (['id', 'name'] as $property) {
|
||||
$$property = trim($$property);
|
||||
|
|
@ -54,10 +49,8 @@ class EntityCollection extends RootCollection implements IProperties {
|
|||
throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
|
||||
}
|
||||
}
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->logger = $logger;
|
||||
$this->userManager = $userManager;
|
||||
$this->userSession = $userSession;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,19 +26,13 @@ use Sabre\DAV\Exception\NotFound;
|
|||
* @package OCA\DAV\Comments
|
||||
*/
|
||||
class EntityTypeCollection extends RootCollection {
|
||||
protected LoggerInterface $logger;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
/** @var \Closure */
|
||||
protected $childExistsFunction;
|
||||
|
||||
public function __construct(
|
||||
string $name,
|
||||
ICommentsManager $commentsManager,
|
||||
IUserManager $userManager,
|
||||
protected IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
LoggerInterface $logger,
|
||||
\Closure $childExistsFunction,
|
||||
protected LoggerInterface $logger,
|
||||
protected \Closure $childExistsFunction,
|
||||
) {
|
||||
$name = trim($name);
|
||||
if (empty($name)) {
|
||||
|
|
@ -46,10 +40,7 @@ class EntityTypeCollection extends RootCollection {
|
|||
}
|
||||
$this->name = $name;
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->logger = $logger;
|
||||
$this->userManager = $userManager;
|
||||
$this->userSession = $userSession;
|
||||
$this->childExistsFunction = $childExistsFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,24 +21,15 @@ use Sabre\DAV\ICollection;
|
|||
class RootCollection implements ICollection {
|
||||
/** @var EntityTypeCollection[]|null */
|
||||
private ?array $entityTypeCollections = null;
|
||||
protected ICommentsManager $commentsManager;
|
||||
protected string $name = 'comments';
|
||||
protected LoggerInterface $logger;
|
||||
protected IUserManager $userManager;
|
||||
protected IUserSession $userSession;
|
||||
protected IEventDispatcher $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
ICommentsManager $commentsManager,
|
||||
IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
IEventDispatcher $dispatcher,
|
||||
LoggerInterface $logger) {
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->logger = $logger;
|
||||
$this->userManager = $userManager;
|
||||
$this->userSession = $userSession;
|
||||
$this->dispatcher = $dispatcher;
|
||||
protected ICommentsManager $commentsManager,
|
||||
protected IUserManager $userManager,
|
||||
protected IUserSession $userSession,
|
||||
protected IEventDispatcher $dispatcher,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,20 +26,13 @@ class LegacyPublicAuth extends AbstractBasic {
|
|||
private const BRUTEFORCE_ACTION = 'legacy_public_webdav_auth';
|
||||
|
||||
private ?IShare $share = null;
|
||||
private IManager $shareManager;
|
||||
private ISession $session;
|
||||
private IRequest $request;
|
||||
private IThrottler $throttler;
|
||||
|
||||
public function __construct(IRequest $request,
|
||||
IManager $shareManager,
|
||||
ISession $session,
|
||||
IThrottler $throttler) {
|
||||
$this->request = $request;
|
||||
$this->shareManager = $shareManager;
|
||||
$this->session = $session;
|
||||
$this->throttler = $throttler;
|
||||
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
private IManager $shareManager,
|
||||
private ISession $session,
|
||||
private IThrottler $throttler,
|
||||
) {
|
||||
// setup realm
|
||||
$defaults = new Defaults();
|
||||
$this->realm = $defaults->getName() ?: 'Nextcloud';
|
||||
|
|
|
|||
|
|
@ -27,25 +27,20 @@ use Sabre\HTTP\ResponseInterface;
|
|||
|
||||
class Auth extends AbstractBasic {
|
||||
public const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND';
|
||||
|
||||
private ISession $session;
|
||||
private Session $userSession;
|
||||
private IRequest $request;
|
||||
private ?string $currentUser = null;
|
||||
private Manager $twoFactorManager;
|
||||
private IThrottler $throttler;
|
||||
|
||||
public function __construct(ISession $session,
|
||||
public function __construct(
|
||||
private ISession $session,
|
||||
Session $userSession,
|
||||
IRequest $request,
|
||||
private IRequest $request,
|
||||
Manager $twoFactorManager,
|
||||
IThrottler $throttler,
|
||||
string $principalPrefix = 'principals/users/') {
|
||||
$this->session = $session;
|
||||
private IThrottler $throttler,
|
||||
string $principalPrefix = 'principals/users/',
|
||||
) {
|
||||
$this->userSession = $userSession;
|
||||
$this->twoFactorManager = $twoFactorManager;
|
||||
$this->request = $request;
|
||||
$this->throttler = $throttler;
|
||||
$this->principalPrefix = $principalPrefix;
|
||||
|
||||
// setup realm
|
||||
|
|
|
|||
|
|
@ -14,20 +14,12 @@ use Sabre\HTTP\RequestInterface;
|
|||
use Sabre\HTTP\ResponseInterface;
|
||||
|
||||
class BearerAuth extends AbstractBearer {
|
||||
private IUserSession $userSession;
|
||||
private ISession $session;
|
||||
private IRequest $request;
|
||||
private string $principalPrefix;
|
||||
|
||||
public function __construct(IUserSession $userSession,
|
||||
ISession $session,
|
||||
IRequest $request,
|
||||
$principalPrefix = 'principals/users/') {
|
||||
$this->userSession = $userSession;
|
||||
$this->session = $session;
|
||||
$this->request = $request;
|
||||
$this->principalPrefix = $principalPrefix;
|
||||
|
||||
public function __construct(
|
||||
private IUserSession $userSession,
|
||||
private ISession $session,
|
||||
private IRequest $request,
|
||||
private string $principalPrefix = 'principals/users/',
|
||||
) {
|
||||
// setup realm
|
||||
$defaults = new Defaults();
|
||||
$this->realm = $defaults->getName() ?: 'Nextcloud';
|
||||
|
|
|
|||
|
|
@ -20,13 +20,12 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread';
|
||||
|
||||
protected ?Server $server = null;
|
||||
private ICommentsManager $commentsManager;
|
||||
private IUserSession $userSession;
|
||||
private array $cachedUnreadCount = [];
|
||||
|
||||
public function __construct(ICommentsManager $commentsManager, IUserSession $userSession) {
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->userSession = $userSession;
|
||||
public function __construct(
|
||||
private ICommentsManager $commentsManager,
|
||||
private IUserSession $userSession,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,20 +39,23 @@ use Sabre\DAV\INode;
|
|||
class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
|
||||
/**
|
||||
* Cached directory content
|
||||
* @var \OCP\Files\FileInfo[]
|
||||
* @var FileInfo[]
|
||||
*/
|
||||
private ?array $dirContent = null;
|
||||
|
||||
/** Cached quota info */
|
||||
private ?array $quotaInfo = null;
|
||||
private ?CachingTree $tree = null;
|
||||
|
||||
/**
|
||||
* Sets up the node, expects a full path name
|
||||
*/
|
||||
public function __construct(View $view, FileInfo $info, ?CachingTree $tree = null, ?IShareManager $shareManager = null) {
|
||||
public function __construct(
|
||||
View $view,
|
||||
FileInfo $info,
|
||||
private ?CachingTree $tree = null,
|
||||
?IShareManager $shareManager = null,
|
||||
) {
|
||||
parent::__construct($view, $info, $shareManager);
|
||||
$this->tree = $tree;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -161,7 +164,7 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot
|
|||
* Returns a specific child node, referenced by its name
|
||||
*
|
||||
* @param string $name
|
||||
* @param \OCP\Files\FileInfo $info
|
||||
* @param FileInfo $info
|
||||
* @return \Sabre\DAV\INode
|
||||
* @throws InvalidPath
|
||||
* @throws \Sabre\DAV\Exception\NotFound
|
||||
|
|
@ -360,10 +363,6 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot
|
|||
throw new BadRequest('Incompatible node types');
|
||||
}
|
||||
|
||||
if (!$this->fileView) {
|
||||
throw new ServiceUnavailable('filesystem not setup');
|
||||
}
|
||||
|
||||
$destinationPath = $this->getPath() . '/' . $targetName;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,19 +10,17 @@ namespace OCA\DAV\Connector\Sabre\Exception;
|
|||
class Forbidden extends \Sabre\DAV\Exception\Forbidden {
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $retry;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param bool $retry
|
||||
* @param \Exception $previous
|
||||
*/
|
||||
public function __construct($message, $retry = false, ?\Exception $previous = null) {
|
||||
public function __construct(
|
||||
$message,
|
||||
private $retry = false,
|
||||
?\Exception $previous = null,
|
||||
) {
|
||||
parent::__construct($message, 0, $previous);
|
||||
$this->retry = $retry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,19 +12,17 @@ use Sabre\DAV\Exception;
|
|||
class InvalidPath extends Exception {
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $retry;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param bool $retry
|
||||
* @param \Exception|null $previous
|
||||
*/
|
||||
public function __construct($message, $retry = false, ?\Exception $previous = null) {
|
||||
public function __construct(
|
||||
$message,
|
||||
private $retry = false,
|
||||
?\Exception $previous = null,
|
||||
) {
|
||||
parent::__construct($message, 0, $previous);
|
||||
$this->retry = $retry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -67,15 +67,13 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
ServerMaintenanceMode::class => true,
|
||||
];
|
||||
|
||||
private string $appName;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* @param string $loggerAppName app name to use when logging
|
||||
* @param string $appName app name to use when logging
|
||||
*/
|
||||
public function __construct(string $loggerAppName, LoggerInterface $logger) {
|
||||
$this->appName = $loggerAppName;
|
||||
$this->logger = $logger;
|
||||
public function __construct(
|
||||
private string $appName,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ class File extends Node implements IFile {
|
|||
/**
|
||||
* Sets up the node, expects a full path name
|
||||
*
|
||||
* @param \OC\Files\View $view
|
||||
* @param \OCP\Files\FileInfo $info
|
||||
* @param View $view
|
||||
* @param FileInfo $info
|
||||
* @param ?\OCP\Share\IManager $shareManager
|
||||
* @param ?IRequest $request
|
||||
* @param ?IL10N $l10n
|
||||
|
|
|
|||
|
|
@ -41,56 +41,9 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
*/
|
||||
private $server;
|
||||
|
||||
/**
|
||||
* @var Tree
|
||||
*/
|
||||
private $tree;
|
||||
|
||||
/**
|
||||
* @var View
|
||||
*/
|
||||
private $fileView;
|
||||
|
||||
/**
|
||||
* @var ISystemTagManager
|
||||
*/
|
||||
private $tagManager;
|
||||
|
||||
/**
|
||||
* @var ISystemTagObjectMapper
|
||||
*/
|
||||
private $tagMapper;
|
||||
|
||||
/**
|
||||
* Manager for private tags
|
||||
*
|
||||
* @var ITagManager
|
||||
*/
|
||||
private $fileTagger;
|
||||
|
||||
/**
|
||||
* @var IUserSession
|
||||
*/
|
||||
private $userSession;
|
||||
|
||||
/**
|
||||
* @var IGroupManager
|
||||
*/
|
||||
private $groupManager;
|
||||
|
||||
/**
|
||||
* @var Folder
|
||||
*/
|
||||
private $userFolder;
|
||||
|
||||
/**
|
||||
* @var IAppManager
|
||||
*/
|
||||
private $appManager;
|
||||
|
||||
/**
|
||||
* @param Tree $tree
|
||||
* @param View $view
|
||||
* @param View $fileView
|
||||
* @param ISystemTagManager $tagManager
|
||||
* @param ISystemTagObjectMapper $tagMapper
|
||||
* @param ITagManager $fileTagger manager for private tags
|
||||
|
|
@ -99,25 +52,20 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
* @param Folder $userFolder
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(Tree $tree,
|
||||
View $view,
|
||||
ISystemTagManager $tagManager,
|
||||
ISystemTagObjectMapper $tagMapper,
|
||||
ITagManager $fileTagger,
|
||||
IUserSession $userSession,
|
||||
IGroupManager $groupManager,
|
||||
Folder $userFolder,
|
||||
IAppManager $appManager,
|
||||
public function __construct(
|
||||
private Tree $tree,
|
||||
private View $fileView,
|
||||
private ISystemTagManager $tagManager,
|
||||
private ISystemTagObjectMapper $tagMapper,
|
||||
/**
|
||||
* Manager for private tags
|
||||
*/
|
||||
private ITagManager $fileTagger,
|
||||
private IUserSession $userSession,
|
||||
private IGroupManager $groupManager,
|
||||
private Folder $userFolder,
|
||||
private IAppManager $appManager,
|
||||
) {
|
||||
$this->tree = $tree;
|
||||
$this->fileView = $view;
|
||||
$this->tagManager = $tagManager;
|
||||
$this->tagMapper = $tagMapper;
|
||||
$this->fileTagger = $fileTagger;
|
||||
$this->userSession = $userSession;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->userFolder = $userFolder;
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@ use Sabre\DAV\ServerPlugin;
|
|||
|
||||
class MaintenancePlugin extends ServerPlugin {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var \OCP\IL10N */
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/**
|
||||
|
|
@ -32,8 +29,10 @@ class MaintenancePlugin extends ServerPlugin {
|
|||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config, IL10N $l10n) {
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
IL10N $l10n,
|
||||
) {
|
||||
$this->l10n = \OC::$server->getL10N('dav');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@ use OCP\Share\Exceptions\ShareNotFound;
|
|||
use OCP\Share\IManager;
|
||||
|
||||
abstract class Node implements \Sabre\DAV\INode {
|
||||
/**
|
||||
* @var View
|
||||
*/
|
||||
protected $fileView;
|
||||
|
||||
/**
|
||||
* The path to the current node
|
||||
*
|
||||
|
|
@ -55,8 +50,11 @@ abstract class Node implements \Sabre\DAV\INode {
|
|||
/**
|
||||
* Sets up the node, expects a full path name
|
||||
*/
|
||||
public function __construct(View $view, FileInfo $info, ?IManager $shareManager = null) {
|
||||
$this->fileView = $view;
|
||||
public function __construct(
|
||||
protected View $fileView,
|
||||
FileInfo $info,
|
||||
?IManager $shareManager = null,
|
||||
) {
|
||||
$this->path = $this->fileView->getRelativePath($info->getPath());
|
||||
$this->info = $info;
|
||||
if ($shareManager) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre;
|
|||
|
||||
use OC\Files\FileInfo;
|
||||
use OC\Files\Storage\FailedStorage;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\View;
|
||||
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
||||
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
|
||||
|
|
@ -23,12 +24,12 @@ use OCP\Lock\LockedException;
|
|||
class ObjectTree extends CachingTree {
|
||||
|
||||
/**
|
||||
* @var \OC\Files\View
|
||||
* @var View
|
||||
*/
|
||||
protected $fileView;
|
||||
|
||||
/**
|
||||
* @var \OCP\Files\Mount\IMountManager
|
||||
* @var IMountManager
|
||||
*/
|
||||
protected $mountManager;
|
||||
|
||||
|
|
@ -40,8 +41,8 @@ class ObjectTree extends CachingTree {
|
|||
|
||||
/**
|
||||
* @param \Sabre\DAV\INode $rootNode
|
||||
* @param \OC\Files\View $view
|
||||
* @param \OCP\Files\Mount\IMountManager $mountManager
|
||||
* @param View $view
|
||||
* @param IMountManager $mountManager
|
||||
*/
|
||||
public function init(\Sabre\DAV\INode $rootNode, View $view, IMountManager $mountManager) {
|
||||
$this->rootNode = $rootNode;
|
||||
|
|
@ -91,7 +92,7 @@ class ObjectTree extends CachingTree {
|
|||
$internalPath = $mount->getInternalPath($absPath);
|
||||
if ($storage && $storage->file_exists($internalPath)) {
|
||||
/**
|
||||
* @var \OC\Files\Storage\Storage $storage
|
||||
* @var Storage $storage
|
||||
*/
|
||||
// get data directly
|
||||
$data = $storage->getMetaData($internalPath);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre;
|
|||
use OC\KnownUser\KnownUserService;
|
||||
use OCA\Circles\Api\v1\Circles;
|
||||
use OCA\Circles\Exceptions\CircleNotFoundException;
|
||||
use OCA\Circles\Model\Circle;
|
||||
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
|
||||
use OCA\DAV\Traits\PrincipalProxyTrait;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
|
|
@ -31,24 +32,6 @@ use Sabre\DAVACL\PrincipalBackend\BackendInterface;
|
|||
|
||||
class Principal implements BackendInterface {
|
||||
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
|
||||
/** @var IAccountManager */
|
||||
private $accountManager;
|
||||
|
||||
/** @var IShareManager */
|
||||
private $shareManager;
|
||||
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
|
||||
/** @var string */
|
||||
private $principalPrefix;
|
||||
|
||||
|
|
@ -64,34 +47,23 @@ class Principal implements BackendInterface {
|
|||
/** @var KnownUserService */
|
||||
private $knownUserService;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var IFactory */
|
||||
private $languageFactory;
|
||||
|
||||
public function __construct(IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
IAccountManager $accountManager,
|
||||
IShareManager $shareManager,
|
||||
IUserSession $userSession,
|
||||
IAppManager $appManager,
|
||||
public function __construct(
|
||||
private IUserManager $userManager,
|
||||
private IGroupManager $groupManager,
|
||||
private IAccountManager $accountManager,
|
||||
private IShareManager $shareManager,
|
||||
private IUserSession $userSession,
|
||||
private IAppManager $appManager,
|
||||
ProxyMapper $proxyMapper,
|
||||
KnownUserService $knownUserService,
|
||||
IConfig $config,
|
||||
IFactory $languageFactory,
|
||||
string $principalPrefix = 'principals/users/') {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->accountManager = $accountManager;
|
||||
$this->shareManager = $shareManager;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
private IConfig $config,
|
||||
private IFactory $languageFactory,
|
||||
string $principalPrefix = 'principals/users/',
|
||||
) {
|
||||
$this->principalPrefix = trim($principalPrefix, '/');
|
||||
$this->hasGroups = $this->hasCircles = ($principalPrefix === 'principals/users/');
|
||||
$this->proxyMapper = $proxyMapper;
|
||||
$this->knownUserService = $knownUserService;
|
||||
$this->config = $config;
|
||||
$this->languageFactory = $languageFactory;
|
||||
}
|
||||
|
||||
use PrincipalProxyTrait {
|
||||
|
|
@ -556,7 +528,7 @@ class Principal implements BackendInterface {
|
|||
* @param string $principal
|
||||
* @return array
|
||||
* @throws Exception
|
||||
* @throws \OCP\AppFramework\QueryException
|
||||
* @throws QueryException
|
||||
* @suppress PhanUndeclaredClassMethod
|
||||
*/
|
||||
public function getCircleMembership($principal):array {
|
||||
|
|
@ -574,7 +546,7 @@ class Principal implements BackendInterface {
|
|||
$circles = Circles::joinedCircles($name, true);
|
||||
|
||||
$circles = array_map(function ($circle) {
|
||||
/** @var \OCA\Circles\Model\Circle $circle */
|
||||
/** @var Circle $circle */
|
||||
return 'principals/circles/' . urlencode($circle->getSingleId());
|
||||
}, $circles);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,23 +37,14 @@ class PublicAuth extends AbstractBasic {
|
|||
public const DAV_AUTHENTICATED = 'public_link_authenticated';
|
||||
|
||||
private ?IShare $share = null;
|
||||
private IManager $shareManager;
|
||||
private ISession $session;
|
||||
private IRequest $request;
|
||||
private IThrottler $throttler;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(IRequest $request,
|
||||
IManager $shareManager,
|
||||
ISession $session,
|
||||
IThrottler $throttler,
|
||||
LoggerInterface $logger) {
|
||||
$this->request = $request;
|
||||
$this->shareManager = $shareManager;
|
||||
$this->session = $session;
|
||||
$this->throttler = $throttler;
|
||||
$this->logger = $logger;
|
||||
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
private IManager $shareManager,
|
||||
private ISession $session,
|
||||
private IThrottler $throttler,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
// setup realm
|
||||
$defaults = new Defaults();
|
||||
$this->realm = $defaults->getName();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
namespace OCA\DAV\Connector\Sabre;
|
||||
|
||||
use OC\Files\View;
|
||||
use OCA\DAV\Upload\FutureFile;
|
||||
use OCA\DAV\Upload\UploadFolder;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
|
|
@ -23,9 +24,6 @@ use Sabre\DAV\INode;
|
|||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
|
||||
/** @var \OC\Files\View */
|
||||
private $view;
|
||||
|
||||
/**
|
||||
* Reference to main server object
|
||||
*
|
||||
|
|
@ -34,10 +32,11 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
private $server;
|
||||
|
||||
/**
|
||||
* @param \OC\Files\View $view
|
||||
* @param View $view
|
||||
*/
|
||||
public function __construct($view) {
|
||||
$this->view = $view;
|
||||
public function __construct(
|
||||
private $view,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ use Sabre\HTTP\RequestInterface;
|
|||
use Sabre\HTTP\ResponseInterface;
|
||||
|
||||
class RequestIdHeaderPlugin extends \Sabre\DAV\ServerPlugin {
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
|
||||
public function __construct(IRequest $request) {
|
||||
$this->request = $request;
|
||||
public function __construct(
|
||||
private IRequest $request,
|
||||
) {
|
||||
}
|
||||
|
||||
public function initialize(\Sabre\DAV\Server $server) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
namespace OCA\DAV\Connector\Sabre;
|
||||
|
||||
use OC\Files\View;
|
||||
use OCA\DAV\AppInfo\PluginManager;
|
||||
use OCA\DAV\CalDAV\DefaultCalendarValidator;
|
||||
use OCA\DAV\DAV\CustomPropertiesBackend;
|
||||
|
|
@ -96,7 +97,7 @@ class ServerFactory {
|
|||
// ensure the skeleton is copied
|
||||
$userFolder = \OC::$server->getUserFolder();
|
||||
|
||||
/** @var \OC\Files\View $view */
|
||||
/** @var View $view */
|
||||
$view = $viewCallBack($server);
|
||||
if ($userFolder instanceof Folder && $userFolder->getPath() === $view->getRoot()) {
|
||||
$rootInfo = $userFolder;
|
||||
|
|
|
|||
|
|
@ -19,18 +19,15 @@ use Sabre\Xml\Writer;
|
|||
class ShareTypeList implements Element {
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
* Share types
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
private $shareTypes;
|
||||
|
||||
/**
|
||||
* @param int[] $shareTypes
|
||||
*/
|
||||
public function __construct($shareTypes) {
|
||||
$this->shareTypes = $shareTypes;
|
||||
public function __construct(
|
||||
/**
|
||||
* Share types
|
||||
*/
|
||||
private $shareTypes,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,11 +18,10 @@ use Sabre\Xml\XmlSerializable;
|
|||
class ShareeList implements XmlSerializable {
|
||||
public const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
|
||||
|
||||
/** @var IShare[] */
|
||||
private $shares;
|
||||
|
||||
public function __construct(array $shares) {
|
||||
$this->shares = $shares;
|
||||
public function __construct(
|
||||
/** @var IShare[] */
|
||||
private array $shares,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,18 +19,15 @@ use Sabre\Xml\Writer;
|
|||
class TagList implements Element {
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
* tags
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $tags;
|
||||
|
||||
/**
|
||||
* @param array $tags
|
||||
*/
|
||||
public function __construct(array $tags) {
|
||||
$this->tags = $tags;
|
||||
public function __construct(
|
||||
/**
|
||||
* tags
|
||||
*/
|
||||
private array $tags,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue