@@ -100,7 +100,7 @@ $server->setBaseUri($baseuri); | |||
// Add plugins | |||
$server->addPlugin(new MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav'))); | |||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')); | |||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend)); | |||
$server->addPlugin(new \Sabre\CalDAV\Plugin()); | |||
$server->addPlugin(new LegacyDAVACL()); |
@@ -29,6 +29,9 @@ | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
use Psr\Log\LoggerInterface; | |||
// load needed apps | |||
$RUNTIME_APPTYPES = ['filesystem', 'authentication', 'logging']; | |||
@@ -48,7 +51,7 @@ $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); | |||
$serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory( | |||
\OC::$server->getConfig(), | |||
\OC::$server->get(Psr\Log\LoggerInterface::class), | |||
\OC::$server->get(LoggerInterface::class), | |||
\OC::$server->getDatabaseConnection(), | |||
\OC::$server->getUserSession(), | |||
\OC::$server->getMountManager(), |
@@ -28,6 +28,8 @@ | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
use Psr\Log\LoggerInterface; | |||
// no php execution timeout for webdav | |||
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { | |||
@set_time_limit(0); | |||
@@ -39,7 +41,7 @@ ignore_user_abort(true); | |||
$serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory( | |||
\OC::$server->getConfig(), | |||
\OC::$server->get(Psr\Log\LoggerInterface::class), | |||
\OC::$server->get(LoggerInterface::class), | |||
\OC::$server->getDatabaseConnection(), | |||
\OC::$server->getUserSession(), | |||
\OC::$server->getMountManager(), |
@@ -139,7 +139,6 @@ return array( | |||
'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir . '/../lib/Connector/LegacyDAVACL.php', | |||
'OCA\\DAV\\Connector\\PublicAuth' => $baseDir . '/../lib/Connector/PublicAuth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', | |||
'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir . '/../lib/Connector/Sabre/AppEnabledPlugin.php', | |||
'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir . '/../lib/Connector/Sabre/Auth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir . '/../lib/Connector/Sabre/BearerAuth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
@@ -154,7 +154,6 @@ class ComposerStaticInitDAV | |||
'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__ . '/..' . '/../lib/Connector/LegacyDAVACL.php', | |||
'OCA\\DAV\\Connector\\PublicAuth' => __DIR__ . '/..' . '/../lib/Connector/PublicAuth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', | |||
'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AppEnabledPlugin.php', | |||
'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Auth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BearerAuth.php', | |||
'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
@@ -71,12 +71,9 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { | |||
$this->timeFactory = $timeFactory; | |||
} | |||
/** | |||
* @param $arguments | |||
*/ | |||
public function run($arguments) { | |||
$offset = (int) $arguments['offset']; | |||
$stopAt = (int) $arguments['stopAt']; | |||
public function run($argument) { | |||
$offset = (int) $argument['offset']; | |||
$stopAt = (int) $argument['stopAt']; | |||
$this->logger->info('Building calendar reminder index (' . $offset .'/' . $stopAt . ')'); | |||
@@ -52,12 +52,11 @@ class EventReminderJob extends TimedJob { | |||
} | |||
/** | |||
* @param $arg | |||
* @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException | |||
* @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException | |||
* @throws \OC\User\NoUserException | |||
*/ | |||
public function run($arg):void { | |||
public function run($argument):void { | |||
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') { | |||
return; | |||
} |
@@ -47,12 +47,9 @@ class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { | |||
$this->config = $config; | |||
} | |||
/** | |||
* @param array $arguments | |||
*/ | |||
public function run($arguments) { | |||
$userId = $arguments['userId']; | |||
$purgeBeforeGenerating = $arguments['purgeBeforeGenerating'] ?? false; | |||
public function run($argument) { | |||
$userId = $argument['userId']; | |||
$purgeBeforeGenerating = $argument['purgeBeforeGenerating'] ?? false; | |||
// make sure admin didn't change his mind | |||
$isGloballyEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); |
@@ -32,18 +32,15 @@ use OCP\AppFramework\Utility\ITimeFactory; | |||
use OCP\BackgroundJob\IJob; | |||
use OCP\BackgroundJob\IJobList; | |||
use OCP\BackgroundJob\TimedJob; | |||
use OCP\Files\Node; | |||
use OCP\Files\File; | |||
use OCP\Files\Folder; | |||
use OCP\Files\IRootFolder; | |||
use OCP\Files\NotFoundException; | |||
class UploadCleanup extends TimedJob { | |||
/** @var IRootFolder */ | |||
private $rootFolder; | |||
/** @var IJobList */ | |||
private $jobList; | |||
private IRootFolder $rootFolder; | |||
private IJobList $jobList; | |||
public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobList $jobList) { | |||
parent::__construct($time); | |||
@@ -71,6 +68,7 @@ class UploadCleanup extends TimedJob { | |||
return; | |||
} | |||
/** @var File[] $files */ | |||
$files = $uploadFolder->getDirectoryListing(); | |||
// Remove if all files have an mtime of more than a day |
@@ -53,34 +53,15 @@ use Sabre\VObject\Reader; | |||
*/ | |||
class BirthdayService { | |||
public const BIRTHDAY_CALENDAR_URI = 'contact_birthdays'; | |||
/** @var GroupPrincipalBackend */ | |||
private $principalBackend; | |||
/** @var CalDavBackend */ | |||
private $calDavBackEnd; | |||
/** @var CardDavBackend */ | |||
private $cardDavBackEnd; | |||
/** @var IConfig */ | |||
private $config; | |||
/** @var IDBConnection */ | |||
private $dbConnection; | |||
/** @var IL10N */ | |||
private $l10n; | |||
private GroupPrincipalBackend $principalBackend; | |||
private CalDavBackend $calDavBackEnd; | |||
private CardDavBackend $cardDavBackEnd; | |||
private IConfig $config; | |||
private IDBConnection $dbConnection; | |||
private IL10N $l10n; | |||
/** | |||
* BirthdayService constructor. | |||
* | |||
* @param CalDavBackend $calDavBackEnd | |||
* @param CardDavBackend $cardDavBackEnd | |||
* @param GroupPrincipalBackend $principalBackend | |||
* @param IConfig $config | |||
* @param IDBConnection $dbConnection | |||
* @param IL10N $l10n | |||
*/ | |||
public function __construct(CalDavBackend $calDavBackEnd, | |||
CardDavBackend $cardDavBackEnd, | |||
@@ -96,14 +77,9 @@ class BirthdayService { | |||
$this->l10n = $l10n; | |||
} | |||
/** | |||
* @param int $addressBookId | |||
* @param string $cardUri | |||
* @param string $cardData | |||
*/ | |||
public function onCardChanged(int $addressBookId, | |||
string $cardUri, | |||
string $cardData) { | |||
string $cardData): void { | |||
if (!$this->isGloballyEnabled()) { | |||
return; | |||
} | |||
@@ -129,12 +105,8 @@ class BirthdayService { | |||
} | |||
} | |||
/** | |||
* @param int $addressBookId | |||
* @param string $cardUri | |||
*/ | |||
public function onCardDeleted(int $addressBookId, | |||
string $cardUri) { | |||
string $cardUri): void { | |||
if (!$this->isGloballyEnabled()) { | |||
return; | |||
} | |||
@@ -156,11 +128,9 @@ class BirthdayService { | |||
} | |||
/** | |||
* @param string $principal | |||
* @return array|null | |||
* @throws \Sabre\DAV\Exception\BadRequest | |||
*/ | |||
public function ensureCalendarExists(string $principal):?array { | |||
public function ensureCalendarExists(string $principal): ?array { | |||
$calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); | |||
if (!is_null($calendar)) { | |||
return $calendar; |
@@ -31,6 +31,7 @@ use OCA\DAV\Exception\UnsupportedLimitOnInitialSyncException; | |||
use Sabre\CalDAV\Backend\BackendInterface; | |||
use Sabre\DAV\Exception\MethodNotAllowed; | |||
use Sabre\DAV\Exception\NotFound; | |||
use Sabre\DAV\INode; | |||
use Sabre\DAV\PropPatch; | |||
/** | |||
@@ -51,7 +52,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { | |||
/** | |||
* @return array | |||
*/ | |||
public function getACL():array { | |||
public function getACL() { | |||
return [ | |||
[ | |||
'privilege' => '{DAV:}read', | |||
@@ -79,7 +80,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { | |||
/** | |||
* @return array | |||
*/ | |||
public function getChildACL():array { | |||
public function getChildACL() { | |||
return [ | |||
[ | |||
'privilege' => '{DAV:}read', | |||
@@ -139,9 +140,9 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { | |||
} | |||
/** | |||
* @return array | |||
* @return INode[] | |||
*/ | |||
public function getChildren():array { | |||
public function getChildren(): array { | |||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); | |||
$children = []; | |||
@@ -169,8 +170,8 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { | |||
/** | |||
* @param string $name | |||
* @param null $calendarData | |||
* @return null|string|void | |||
* @param null|resource|string $calendarData | |||
* @return null|string | |||
* @throws MethodNotAllowed | |||
*/ | |||
public function createFile($name, $calendarData = null) { |
@@ -50,7 +50,7 @@ class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject { | |||
/** | |||
* @param resource|string $calendarData | |||
* @return string|void | |||
* @return string | |||
* @throws MethodNotAllowed | |||
*/ | |||
public function put($calendarData) { |
@@ -35,10 +35,7 @@ use Sabre\VObject\Property\ICalendar\Duration; | |||
* @package OCA\DAV\CalDAV\ICSExportPlugin | |||
*/ | |||
class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { | |||
/** @var IConfig */ | |||
private $config; | |||
private IConfig $config; | |||
private LoggerInterface $logger; | |||
/** @var string */ |
@@ -100,7 +100,7 @@ class InvitationResponseServer { | |||
)); | |||
// wait with registering these until auth is handled and the filesystem is setup | |||
$this->server->on('beforeMethod:*', function () use ($root) { | |||
$this->server->on('beforeMethod:*', function () use ($root): void { | |||
// register plugins from apps | |||
$pluginManager = new PluginManager( | |||
\OC::$server, |
@@ -134,8 +134,8 @@ class PublishPlugin extends ServerPlugin { | |||
$canPublish = (!$node->isSubscription() && $node->canWrite()); | |||
if ($this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes') { | |||
$canShare &= ($node->getOwner() === $node->getPrincipalURI()); | |||
$canPublish &= ($node->getOwner() === $node->getPrincipalURI()); | |||
$canShare = $canShare && ($node->getOwner() === $node->getPrincipalURI()); | |||
$canPublish = $canPublish && ($node->getOwner() === $node->getPrincipalURI()); | |||
} | |||
return new AllowedSharingModes($canShare, $canPublish); |
@@ -38,6 +38,7 @@ use OCP\IURLGenerator; | |||
use OCP\L10N\IFactory as L10NFactory; | |||
use OCP\Mail\IEMailTemplate; | |||
use OCP\Mail\IMailer; | |||
use OCP\IUser; | |||
use Psr\Log\LoggerInterface; | |||
use Sabre\VObject; | |||
use Sabre\VObject\Component\VEvent; | |||
@@ -54,8 +55,7 @@ class EmailProvider extends AbstractProvider { | |||
/** @var string */ | |||
public const NOTIFICATION_TYPE = 'EMAIL'; | |||
/** @var IMailer */ | |||
private $mailer; | |||
private IMailer $mailer; | |||
public function __construct(IConfig $config, | |||
IMailer $mailer, | |||
@@ -168,10 +168,6 @@ class EmailProvider extends AbstractProvider { | |||
} | |||
} | |||
/** | |||
* @param string $path | |||
* @return string | |||
*/ | |||
private function getAbsoluteImagePath(string $path):string { | |||
return $this->urlGenerator->getAbsoluteURL( | |||
$this->urlGenerator->imagePath('core', $path) | |||
@@ -207,9 +203,8 @@ class EmailProvider extends AbstractProvider { | |||
} | |||
/** | |||
* @param array $emails | |||
* @param string $defaultLanguage | |||
* @return array | |||
* @param array<string, array{LANG?: string}> $emails | |||
* @return array<string, string[]> | |||
*/ | |||
private function sortEMailAddressesByLanguage(array $emails, | |||
string $defaultLanguage):array { | |||
@@ -234,7 +229,7 @@ class EmailProvider extends AbstractProvider { | |||
/** | |||
* @param VEvent $vevent | |||
* @return array | |||
* @return array<string, array{LANG?: string}> | |||
*/ | |||
private function getAllEMailAddressesFromEvent(VEvent $vevent):array { | |||
$emailAddresses = []; | |||
@@ -277,7 +272,7 @@ class EmailProvider extends AbstractProvider { | |||
$properties = []; | |||
$langProp = $attendee->offsetGet('LANG'); | |||
if ($langProp instanceof VObject\Parameter) { | |||
if ($langProp instanceof VObject\Parameter && $langProp->getValue() !== null) { | |||
$properties['LANG'] = $langProp->getValue(); | |||
} | |||
@@ -287,18 +282,15 @@ class EmailProvider extends AbstractProvider { | |||
} | |||
if (isset($vevent->ORGANIZER) && $this->hasAttendeeMailURI($vevent->ORGANIZER)) { | |||
$emailAddresses[$this->getEMailAddressOfAttendee($vevent->ORGANIZER)] = []; | |||
$organizerEmailAddress = $this->getEMailAddressOfAttendee($vevent->ORGANIZER); | |||
if ($organizerEmailAddress !== null) { | |||
$emailAddresses[$organizerEmailAddress] = []; | |||
} | |||
} | |||
return $emailAddresses; | |||
} | |||
/** | |||
* @param VObject\Property $attendee | |||
* @return string | |||
*/ | |||
private function getCUTypeOfAttendee(VObject\Property $attendee):string { | |||
$cuType = $attendee->offsetGet('CUTYPE'); | |||
if ($cuType instanceof VObject\Parameter) { | |||
@@ -308,10 +300,6 @@ class EmailProvider extends AbstractProvider { | |||
return 'INDIVIDUAL'; | |||
} | |||
/** | |||
* @param VObject\Property $attendee | |||
* @return string | |||
*/ | |||
private function getPartstatOfAttendee(VObject\Property $attendee):string { | |||
$partstat = $attendee->offsetGet('PARTSTAT'); | |||
if ($partstat instanceof VObject\Parameter) { | |||
@@ -321,19 +309,11 @@ class EmailProvider extends AbstractProvider { | |||
return 'NEEDS-ACTION'; | |||
} | |||
/** | |||
* @param VObject\Property $attendee | |||
* @return bool | |||
*/ | |||
private function hasAttendeeMailURI(VObject\Property $attendee):bool { | |||
private function hasAttendeeMailURI(VObject\Property $attendee): bool { | |||
return stripos($attendee->getValue(), 'mailto:') === 0; | |||
} | |||
/** | |||
* @param VObject\Property $attendee | |||
* @return string|null | |||
*/ | |||
private function getEMailAddressOfAttendee(VObject\Property $attendee):?string { | |||
private function getEMailAddressOfAttendee(VObject\Property $attendee): ?string { | |||
if (!$this->hasAttendeeMailURI($attendee)) { | |||
return null; | |||
} | |||
@@ -342,8 +322,8 @@ class EmailProvider extends AbstractProvider { | |||
} | |||
/** | |||
* @param array $users | |||
* @return array | |||
* @param IUser[] $users | |||
* @return array<string, array{LANG?: string}> | |||
*/ | |||
private function getEMailAddressesOfAllUsersWithWriteAccessToCalendar(array $users):array { | |||
$emailAddresses = []; | |||
@@ -366,12 +346,9 @@ class EmailProvider extends AbstractProvider { | |||
} | |||
/** | |||
* @param IL10N $l10n | |||
* @param VEvent $vevent | |||
* @return string | |||
* @throws \Exception | |||
*/ | |||
private function generateDateString(IL10N $l10n, VEvent $vevent):string { | |||
private function generateDateString(IL10N $l10n, VEvent $vevent): string { | |||
$isAllDay = $vevent->DTSTART instanceof Property\ICalendar\Date; | |||
/** @var Property\ICalendar\Date | Property\ICalendar\DateTime $dtstart */ | |||
@@ -437,57 +414,27 @@ class EmailProvider extends AbstractProvider { | |||
. ' (' . $startTimezone . ')'; | |||
} | |||
/** | |||
* @param DateTime $dtStart | |||
* @param DateTime $dtEnd | |||
* @return bool | |||
*/ | |||
private function isDayEqual(DateTime $dtStart, | |||
DateTime $dtEnd):bool { | |||
return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); | |||
} | |||
/** | |||
* @param IL10N $l10n | |||
* @param DateTime $dt | |||
* @return string | |||
*/ | |||
private function getWeekDayName(IL10N $l10n, DateTime $dt):string { | |||
return $l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); | |||
return (string)$l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); | |||
} | |||
/** | |||
* @param IL10N $l10n | |||
* @param DateTime $dt | |||
* @return string | |||
*/ | |||
private function getDateString(IL10N $l10n, DateTime $dt):string { | |||
return $l10n->l('date', $dt, ['width' => 'medium']); | |||
return (string)$l10n->l('date', $dt, ['width' => 'medium']); | |||
} | |||
/** | |||
* @param IL10N $l10n | |||
* @param DateTime $dt | |||
* @return string | |||
*/ | |||
private function getDateTimeString(IL10N $l10n, DateTime $dt):string { | |||
return $l10n->l('datetime', $dt, ['width' => 'medium|short']); | |||
return (string)$l10n->l('datetime', $dt, ['width' => 'medium|short']); | |||
} | |||
/** | |||
* @param IL10N $l10n | |||
* @param DateTime $dt | |||
* @return string | |||
*/ | |||
private function getTimeString(IL10N $l10n, DateTime $dt):string { | |||
return $l10n->l('time', $dt, ['width' => 'short']); | |||
return (string)$l10n->l('time', $dt, ['width' => 'short']); | |||
} | |||
/** | |||
* @param VEvent $vevent | |||
* @param IL10N $l10n | |||
* @return string | |||
*/ | |||
private function getTitleFromVEvent(VEvent $vevent, IL10N $l10n):string { | |||
if (isset($vevent->SUMMARY)) { | |||
return (string)$vevent->SUMMARY; |
@@ -109,8 +109,6 @@ class PushProvider extends AbstractProvider { | |||
} | |||
/** | |||
* @var VEvent $vevent | |||
* @return array | |||
* @throws \Exception | |||
*/ | |||
protected function extractEventDetails(VEvent $vevent):array { |
@@ -298,7 +298,7 @@ class Notifier implements INotifier { | |||
* @return string | |||
*/ | |||
private function getWeekDayName(DateTime $dt):string { | |||
return $this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); | |||
return (string)$this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); | |||
} | |||
/** | |||
@@ -306,7 +306,7 @@ class Notifier implements INotifier { | |||
* @return string | |||
*/ | |||
private function getDateString(DateTime $dt):string { | |||
return $this->l10n->l('date', $dt, ['width' => 'medium']); | |||
return (string)$this->l10n->l('date', $dt, ['width' => 'medium']); | |||
} | |||
/** | |||
@@ -314,7 +314,7 @@ class Notifier implements INotifier { | |||
* @return string | |||
*/ | |||
private function getDateTimeString(DateTime $dt):string { | |||
return $this->l10n->l('datetime', $dt, ['width' => 'medium|short']); | |||
return (string)$this->l10n->l('datetime', $dt, ['width' => 'medium|short']); | |||
} | |||
/** | |||
@@ -322,6 +322,6 @@ class Notifier implements INotifier { | |||
* @return string | |||
*/ | |||
private function getTimeString(DateTime $dt):string { | |||
return $this->l10n->l('time', $dt, ['width' => 'short']); | |||
return (string)$this->l10n->l('time', $dt, ['width' => 'short']); | |||
} | |||
} |
@@ -291,16 +291,15 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
/** | |||
* @param int $addressBookId | |||
*/ | |||
public function getAddressBookById($addressBookId) { | |||
public function getAddressBookById(int $addressBookId): ?array { | |||
$query = $this->db->getQueryBuilder(); | |||
$result = $query->select(['id', 'uri', 'displayname', 'principaluri', 'description', 'synctoken']) | |||
->from('addressbooks') | |||
->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) | |||
->execute(); | |||
->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId, IQueryBuilder::PARAM_INT))) | |||
->executeQuery(); | |||
$row = $result->fetch(); | |||
$result->closeCursor(); | |||
if ($row === false) { | |||
if (!$row) { | |||
return null; | |||
} | |||
@@ -457,7 +456,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$addressBookId = $query->getLastInsertId(); | |||
$addressBookRow = $this->getAddressBookById($addressBookId); | |||
$this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow)); | |||
$this->dispatcher->dispatchTyped(new AddressBookCreatedEvent($addressBookId, $addressBookRow)); | |||
return $addressBookId; | |||
} | |||
@@ -495,7 +494,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
->execute(); | |||
if ($addressBookData) { | |||
$this->dispatcher->dispatchTyped(new AddressBookDeletedEvent((int) $addressBookId, $addressBookData, $shares)); | |||
$this->dispatcher->dispatchTyped(new AddressBookDeletedEvent($addressBookId, $addressBookData, $shares)); | |||
} | |||
} | |||
@@ -515,14 +514,14 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* calculating them. If they are specified, you can also ommit carddata. | |||
* This may speed up certain requests, especially with large cards. | |||
* | |||
* @param mixed $addressBookId | |||
* @param mixed $addressbookId | |||
* @return array | |||
*/ | |||
public function getCards($addressBookId) { | |||
public function getCards($addressbookId) { | |||
$query = $this->db->getQueryBuilder(); | |||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid']) | |||
->from($this->dbCardsTable) | |||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))); | |||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressbookId))); | |||
$cards = []; | |||
@@ -588,7 +587,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
* If the backend supports this, it may allow for some speed-ups. | |||
* | |||
* @param mixed $addressBookId | |||
* @param string[] $uris | |||
* @param array $uris | |||
* @return array | |||
*/ | |||
public function getMultipleCards($addressBookId, array $uris) { | |||
@@ -692,7 +691,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$objectRow = $this->getCard($addressBookId, $cardUri); | |||
$this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->dispatcher->dispatchTyped(new CardCreatedEvent($addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
@@ -756,7 +755,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$addressBookData = $this->getAddressBookById($addressBookId); | |||
$shares = $this->getShares($addressBookId); | |||
$objectRow = $this->getCard($addressBookId, $cardUri); | |||
$this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->dispatcher->dispatchTyped(new CardUpdatedEvent($addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
@@ -787,13 +786,13 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$ret = $query->delete($this->dbCardsTable) | |||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))) | |||
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($cardUri))) | |||
->execute(); | |||
->executeStatement(); | |||
$this->addChange($addressBookId, $cardUri, 3); | |||
if ($ret === 1) { | |||
if ($cardId !== null) { | |||
$this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->dispatcher->dispatchTyped(new CardDeletedEvent($addressBookId, $addressBookData, $shares, $objectRow)); | |||
$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', | |||
new GenericEvent(null, [ | |||
'addressBookId' => $addressBookId, | |||
@@ -871,12 +870,12 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
->where( | |||
$qb->expr()->eq('id', $qb->createNamedParameter($addressBookId)) | |||
); | |||
$stmt = $qb->execute(); | |||
$stmt = $qb->executeQuery(); | |||
$currentToken = $stmt->fetchOne(); | |||
$stmt->closeCursor(); | |||
if (is_null($currentToken)) { | |||
return null; | |||
return []; | |||
} | |||
$result = [ | |||
@@ -903,7 +902,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
} | |||
// Fetching all changes | |||
$stmt = $qb->execute(); | |||
$stmt = $qb->executeQuery(); | |||
$changes = []; | |||
@@ -935,7 +934,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { | |||
$qb->expr()->eq('addressbookid', $qb->createNamedParameter($addressBookId)) | |||
); | |||
// No synctoken supplied, this is the initial sync. | |||
$stmt = $qb->execute(); | |||
$stmt = $qb->executeQuery(); | |||
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); | |||
$stmt->closeCursor(); | |||
} |
@@ -34,12 +34,12 @@ use OCP\Files\NotFoundException; | |||
use OCP\Files\NotPermittedException; | |||
use OCP\Files\SimpleFS\ISimpleFile; | |||
use OCP\Files\SimpleFS\ISimpleFolder; | |||
use Psr\Log\LoggerInterface; | |||
use Sabre\CardDAV\Card; | |||
use Sabre\VObject\Document; | |||
use Sabre\VObject\Parameter; | |||
use Sabre\VObject\Property\Binary; | |||
use Sabre\VObject\Reader; | |||
use Psr\Log\LoggerInterface; | |||
class PhotoCache { | |||
@@ -51,9 +51,7 @@ class PhotoCache { | |||
'image/vnd.microsoft.icon' => 'ico', | |||
]; | |||
/** @var IAppData */ | |||
protected $appData; | |||
protected IAppData $appData; | |||
protected LoggerInterface $logger; | |||
/** | |||
@@ -65,15 +63,9 @@ class PhotoCache { | |||
} | |||
/** | |||
* @param int $addressBookId | |||
* @param string $cardUri | |||
* @param int $size | |||
* @param Card $card | |||
* | |||
* @return ISimpleFile | |||
* @throws NotFoundException | |||
*/ | |||
public function get($addressBookId, $cardUri, $size, Card $card) { | |||
public function get(int $addressBookId, string $cardUri, int $size, Card $card): ISimpleFile { | |||
$folder = $this->getFolder($addressBookId, $cardUri); | |||
if ($this->isEmpty($folder)) { | |||
@@ -91,17 +83,11 @@ class PhotoCache { | |||
return $this->getFile($folder, $size); | |||
} | |||
/** | |||
* @param ISimpleFolder $folder | |||
* @return bool | |||
*/ | |||
private function isEmpty(ISimpleFolder $folder) { | |||
private function isEmpty(ISimpleFolder $folder): bool { | |||
return $folder->getDirectoryListing() === []; | |||
} | |||
/** | |||
* @param ISimpleFolder $folder | |||
* @param Card $card | |||
* @throws NotPermittedException | |||
*/ | |||
private function init(ISimpleFolder $folder, Card $card): void { | |||
@@ -124,11 +110,14 @@ class PhotoCache { | |||
$file->putContent($data['body']); | |||
} | |||
private function hasPhoto(ISimpleFolder $folder) { | |||
private function hasPhoto(ISimpleFolder $folder): bool { | |||
return !$folder->fileExists('nophoto'); | |||
} | |||
private function getFile(ISimpleFolder $folder, $size) { | |||
/** | |||
* @param float|-1 $size | |||
*/ | |||
private function getFile(ISimpleFolder $folder, $size): ISimpleFile { | |||
$ext = $this->getExtension($folder); | |||
if ($size === -1) { | |||
@@ -189,8 +178,6 @@ class PhotoCache { | |||
/** | |||
* Get the extension of the avatar. If there is no avatar throw Exception | |||
* | |||
* @param ISimpleFolder $folder | |||
* @return string | |||
* @throws NotFoundException | |||
*/ | |||
private function getExtension(ISimpleFolder $folder): string { | |||
@@ -205,7 +192,7 @@ class PhotoCache { | |||
/** | |||
* @param Card $node | |||
* @return bool|array{body: string, Content-Type: string} | |||
* @return false|array{body: string, Content-Type: string} | |||
*/ | |||
private function getPhoto(Card $node) { | |||
try { | |||
@@ -220,8 +207,7 @@ class PhotoCache { | |||
} | |||
/** | |||
* @param Document $vObject | |||
* @return bool|array{body: string, Content-Type: string} | |||
* @return false|array{body: string, Content-Type: string} | |||
*/ | |||
public function getPhotoFromVObject(Document $vObject) { | |||
try { | |||
@@ -265,11 +251,7 @@ class PhotoCache { | |||
return false; | |||
} | |||
/** | |||
* @param string $cardData | |||
* @return \Sabre\VObject\Document | |||
*/ | |||
private function readCard($cardData) { | |||
private function readCard(string $cardData): Document { | |||
return Reader::read($cardData); | |||
} | |||
@@ -86,7 +86,7 @@ class SyncService { | |||
*/ | |||
public function syncRemoteAddressBook($url, $userName, $addressBookUrl, $sharedSecret, $syncToken, $targetBookId, $targetPrincipal, $targetProperties) { | |||
// 1. create addressbook | |||
$book = $this->ensureSystemAddressBookExists($targetPrincipal, $targetBookId, $targetProperties); | |||
$book = $this->ensureSystemAddressBookExists($targetPrincipal, (string)$targetBookId, $targetProperties); | |||
$addressBookId = $book['id']; | |||
// 2. query changes |
@@ -44,28 +44,12 @@ use Sabre\DAV\Auth\Backend\AbstractBasic; | |||
*/ | |||
class PublicAuth extends AbstractBasic { | |||
private const BRUTEFORCE_ACTION = 'public_webdav_auth'; | |||
private ?IShare $share = null; | |||
private IManager $shareManager; | |||
private ISession $session; | |||
private IRequest $request; | |||
private Throttler $throttler; | |||
/** @var \OCP\Share\IShare */ | |||
private $share; | |||
/** @var IManager */ | |||
private $shareManager; | |||
/** @var ISession */ | |||
private $session; | |||
/** @var IRequest */ | |||
private $request; | |||
/** @var Throttler */ | |||
private $throttler; | |||
/** | |||
* @param IRequest $request | |||
* @param IManager $shareManager | |||
* @param ISession $session | |||
* @param Throttler $throttler | |||
*/ | |||
public function __construct(IRequest $request, | |||
IManager $shareManager, | |||
ISession $session, | |||
@@ -88,7 +72,6 @@ class PublicAuth extends AbstractBasic { | |||
* | |||
* @param string $username | |||
* @param string $password | |||
* | |||
* @return bool | |||
* @throws \Sabre\DAV\Exception\NotAuthenticated | |||
*/ | |||
@@ -133,15 +116,12 @@ class PublicAuth extends AbstractBasic { | |||
$this->throttler->registerAttempt(self::BRUTEFORCE_ACTION, $this->request->getRemoteAddress()); | |||
return false; | |||
} | |||
} else { | |||
return true; | |||
} | |||
return true; | |||
} | |||
/** | |||
* @return \OCP\Share\IShare | |||
*/ | |||
public function getShare() { | |||
public function getShare(): IShare { | |||
assert($this->share !== null); | |||
return $this->share; | |||
} | |||
} |
@@ -1,88 +0,0 @@ | |||
<?php | |||
/** | |||
* @copyright Copyright (c) 2016, ownCloud, Inc. | |||
* | |||
* @author Georg Ehrke <oc.list@georgehrke.com> | |||
* @author Robin Appelman <robin@icewind.nl> | |||
* @author Thomas Müller <thomas.mueller@tmit.eu> | |||
* | |||
* @license AGPL-3.0 | |||
* | |||
* This code is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License, version 3, | |||
* as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License, version 3, | |||
* along with this program. If not, see <http://www.gnu.org/licenses/> | |||
* | |||
*/ | |||
namespace OCA\DAV\Connector\Sabre; | |||
use OCP\App\IAppManager; | |||
use Sabre\DAV\Exception\Forbidden; | |||
use Sabre\DAV\ServerPlugin; | |||
/** | |||
* Plugin to check if an app is enabled for the current user | |||
*/ | |||
class AppEnabledPlugin extends ServerPlugin { | |||
/** | |||
* Reference to main server object | |||
* | |||
* @var \Sabre\DAV\Server | |||
*/ | |||
private $server; | |||
/** | |||
* @var string | |||
*/ | |||
private $app; | |||
/** | |||
* @var \OCP\App\IAppManager | |||
*/ | |||
private $appManager; | |||
/** | |||
* @param string $app | |||
* @param \OCP\App\IAppManager $appManager | |||
*/ | |||
public function __construct($app, IAppManager $appManager) { | |||
$this->app = $app; | |||
$this->appManager = $appManager; | |||
} | |||
/** | |||
* This initializes the plugin. | |||
* | |||
* This function is called by \Sabre\DAV\Server, after | |||
* addPlugin is called. | |||
* | |||
* This method should set up the required event subscriptions. | |||
* | |||
* @param \Sabre\DAV\Server $server | |||
* @return void | |||
*/ | |||
public function initialize(\Sabre\DAV\Server $server) { | |||
$this->server = $server; | |||
$this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30); | |||
} | |||
/** | |||
* This method is called before any HTTP after auth and checks if the user has access to the app | |||
* | |||
* @throws \Sabre\DAV\Exception\Forbidden | |||
* @return bool | |||
*/ | |||
public function checkAppEnabled() { | |||
if (!$this->appManager->isEnabledForUser($this->app)) { | |||
throw new Forbidden(); | |||
} | |||
} | |||
} |
@@ -51,33 +51,19 @@ use Sabre\HTTP\ResponseInterface; | |||
class Auth extends AbstractBasic { | |||
public const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND'; | |||
/** @var ISession */ | |||
private $session; | |||
/** @var Session */ | |||
private $userSession; | |||
/** @var IRequest */ | |||
private $request; | |||
/** @var string */ | |||
private $currentUser; | |||
/** @var Manager */ | |||
private $twoFactorManager; | |||
/** @var Throttler */ | |||
private $throttler; | |||
private ISession $session; | |||
private Session $userSession; | |||
private IRequest $request; | |||
private ?string $currentUser = null; | |||
private Manager $twoFactorManager; | |||
private Throttler $throttler; | |||
/** | |||
* @param ISession $session | |||
* @param Session $userSession | |||
* @param IRequest $request | |||
* @param Manager $twoFactorManager | |||
* @param Throttler $throttler | |||
* @param string $principalPrefix | |||
*/ | |||
public function __construct(ISession $session, | |||
Session $userSession, | |||
IRequest $request, | |||
Manager $twoFactorManager, | |||
Throttler $throttler, | |||
$principalPrefix = 'principals/users/') { | |||
string $principalPrefix = 'principals/users/') { | |||
$this->session = $session; | |||
$this->userSession = $userSession; | |||
$this->twoFactorManager = $twoFactorManager; | |||
@@ -97,11 +83,8 @@ class Auth extends AbstractBasic { | |||
* account was changed. | |||
* | |||
* @see https://github.com/owncloud/core/issues/13245 | |||
* | |||
* @param string $username | |||
* @return bool | |||
*/ | |||
public function isDavAuthenticated($username) { | |||
public function isDavAuthenticated(string $username): bool { | |||
return !is_null($this->session->get(self::DAV_AUTHENTICATED)) && | |||
$this->session->get(self::DAV_AUTHENTICATED) === $username; | |||
} | |||
@@ -144,9 +127,7 @@ class Auth extends AbstractBasic { | |||
} | |||
/** | |||
* @param RequestInterface $request | |||
* @param ResponseInterface $response | |||
* @return array | |||
* @return array{bool, string} | |||
* @throws NotAuthenticated | |||
* @throws ServiceUnavailable | |||
*/ | |||
@@ -165,10 +146,8 @@ class Auth extends AbstractBasic { | |||
/** | |||
* Checks whether a CSRF check is required on the request | |||
* | |||
* @return bool | |||
*/ | |||
private function requiresCSRFCheck() { | |||
private function requiresCSRFCheck(): bool { | |||
// GET requires no check at all | |||
if ($this->request->getMethod() === 'GET') { | |||
return false; | |||
@@ -203,12 +182,10 @@ class Auth extends AbstractBasic { | |||
} | |||
/** | |||
* @param RequestInterface $request | |||
* @param ResponseInterface $response | |||
* @return array | |||
* @return array{bool, string} | |||
* @throws NotAuthenticated | |||
*/ | |||
private function auth(RequestInterface $request, ResponseInterface $response) { | |||
private function auth(RequestInterface $request, ResponseInterface $response): array { | |||
$forcedLogout = false; | |||
if (!$this->request->passesCSRFCheck() && |
@@ -31,21 +31,11 @@ use Sabre\HTTP\RequestInterface; | |||
use Sabre\HTTP\ResponseInterface; | |||
class BearerAuth extends AbstractBearer { | |||
/** @var IUserSession */ | |||
private $userSession; | |||
/** @var ISession */ | |||
private $session; | |||
/** @var IRequest */ | |||
private $request; | |||
/** @var string */ | |||
private $principalPrefix; | |||
private IUserSession $userSession; | |||
private ISession $session; | |||
private IRequest $request; | |||
private string $principalPrefix; | |||
/** | |||
* @param IUserSession $userSession | |||
* @param ISession $session | |||
* @param string $principalPrefix | |||
* @param IRequest $request | |||
*/ | |||
public function __construct(IUserSession $userSession, | |||
ISession $session, | |||
IRequest $request, | |||
@@ -90,7 +80,7 @@ class BearerAuth extends AbstractBearer { | |||
* @param RequestInterface $request | |||
* @param ResponseInterface $response | |||
*/ | |||
public function challenge(RequestInterface $request, ResponseInterface $response) { | |||
public function challenge(RequestInterface $request, ResponseInterface $response): void { | |||
$response->setStatus(401); | |||
} | |||
} |
@@ -28,6 +28,7 @@ namespace OCA\DAV\Connector\Sabre; | |||
use OCP\IConfig; | |||
use Sabre\DAV\ServerPlugin; | |||
use Sabre\HTTP\RequestInterface; | |||
use Sabre\DAV\Server; | |||
/** | |||
* Class BlockLegacyClientPlugin is used to detect old legacy sync clients and | |||
@@ -36,23 +37,17 @@ use Sabre\HTTP\RequestInterface; | |||
* @package OCA\DAV\Connector\Sabre | |||
*/ | |||
class BlockLegacyClientPlugin extends ServerPlugin { | |||
/** @var \Sabre\DAV\Server */ | |||
protected $server; | |||
/** @var IConfig */ | |||
protected $config; | |||
protected ?Server $server = null; | |||
protected IConfig $config; | |||
/** | |||
* @param IConfig $config | |||
*/ | |||
public function __construct(IConfig $config) { | |||
$this->config = $config; | |||
} | |||
/** | |||
* @param \Sabre\DAV\Server $server | |||
* @return void | |||
*/ | |||
public function initialize(\Sabre\DAV\Server $server) { | |||
public function initialize(Server $server) { | |||
$this->server = $server; | |||
$this->server->on('beforeMethod:*', [$this, 'beforeHandler'], 200); | |||
} |
@@ -28,17 +28,18 @@ use Sabre\DAV\Tree; | |||
class CachingTree extends Tree { | |||
/** | |||
* Store a node in the cache | |||
* | |||
* @param Node $node | |||
* @param null|string $path | |||
*/ | |||
public function cacheNode(Node $node, $path = null) { | |||
public function cacheNode(Node $node, ?string $path = null): void { | |||
if (is_null($path)) { | |||
$path = $node->getPath(); | |||
} | |||
$this->cache[trim($path, '/')] = $node; | |||
} | |||
/** | |||
* @param string $path | |||
* @return void | |||
*/ | |||
public function markDirty($path) { | |||
// We don't care enough about sub-paths | |||
// flushing the entire cache |
@@ -35,12 +35,9 @@ class ChecksumList implements XmlSerializable { | |||
public const NS_OWNCLOUD = 'http://owncloud.org/ns'; | |||
/** @var string[] of TYPE:CHECKSUM */ | |||
private $checksums; | |||
private array $checksums; | |||
/** | |||
* @param string $checksum | |||
*/ | |||
public function __construct($checksum) { | |||
public function __construct(string $checksum) { | |||
$this->checksums = explode(',', $checksum); | |||
} | |||
@@ -26,14 +26,12 @@ namespace OCA\DAV\Connector\Sabre; | |||
use Sabre\DAV\ServerPlugin; | |||
use Sabre\HTTP\RequestInterface; | |||
use Sabre\HTTP\ResponseInterface; | |||
use Sabre\DAV\Server; | |||
class ChecksumUpdatePlugin extends ServerPlugin { | |||
/** | |||
* @var \Sabre\DAV\Server | |||
*/ | |||
protected $server; | |||
protected ?Server $server = null; | |||
public function initialize(\Sabre\DAV\Server $server) { | |||
public function initialize(Server $server) { | |||
$this->server = $server; | |||
$server->on('method:PATCH', [$this, 'httpPatch']); | |||
} | |||
@@ -42,6 +40,7 @@ class ChecksumUpdatePlugin extends ServerPlugin { | |||
return 'checksumupdate'; | |||
} | |||
/** @return string[] */ | |||
public function getHTTPMethods($path): array { | |||
$tree = $this->server->tree; | |||
@@ -55,6 +54,7 @@ class ChecksumUpdatePlugin extends ServerPlugin { | |||
return []; | |||
} | |||
/** @return string[] */ | |||
public function getFeatures(): array { | |||
return ['nextcloud-checksum-update']; | |||
} |
@@ -29,22 +29,17 @@ use OCP\Comments\ICommentsManager; | |||
use OCP\IUserSession; | |||
use Sabre\DAV\PropFind; | |||
use Sabre\DAV\ServerPlugin; | |||
use Sabre\DAV\Server; | |||
class CommentPropertiesPlugin extends ServerPlugin { | |||
public const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href'; | |||
public const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count'; | |||
public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread'; | |||
/** @var \Sabre\DAV\Server */ | |||
protected $server; | |||
/** @var ICommentsManager */ | |||
private $commentsManager; | |||
/** @var IUserSession */ | |||
private $userSession; | |||
private $cachedUnreadCount = []; | |||
protected ?Server $server = null; | |||
private ICommentsManager $commentsManager; | |||
private IUserSession $userSession; | |||
private array $cachedUnreadCount = []; | |||
public function __construct(ICommentsManager $commentsManager, IUserSession $userSession) { | |||
$this->commentsManager = $commentsManager; | |||
@@ -67,7 +62,7 @@ class CommentPropertiesPlugin extends ServerPlugin { | |||
$this->server->on('propFind', [$this, 'handleGetProperties']); | |||
} | |||
private function cacheDirectory(Directory $directory) { | |||
private function cacheDirectory(Directory $directory): void { | |||
$children = $directory->getChildren(); | |||
$ids = []; | |||
@@ -109,14 +104,14 @@ class CommentPropertiesPlugin extends ServerPlugin { | |||
} | |||
// need prefetch ? | |||
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory | |||
if ($node instanceof Directory | |||
&& $propFind->getDepth() !== 0 | |||
&& !is_null($propFind->getStatus(self::PROPERTY_NAME_UNREAD)) | |||
) { | |||
$this->cacheDirectory($node); | |||
} | |||
$propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node) { | |||
$propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node): int { | |||
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); | |||
}); | |||
@@ -124,19 +119,15 @@ class CommentPropertiesPlugin extends ServerPlugin { | |||
return $this->getCommentsLink($node); | |||
}); | |||
$propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node) { | |||
if (isset($this->cachedUnreadCount[$node->getId()])) { | |||
return $this->cachedUnreadCount[$node->getId()]; | |||
} | |||
return $this->getUnreadCount($node); | |||
$propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node): ?bool { | |||
return $this->cachedUnreadCount[$node->getId()] ?? $this->getUnreadCount($node); | |||
}); | |||
} | |||
/** | |||
* returns a reference to the comments node | |||
* Returns a reference to the comments node | |||
* | |||
* @param Node $node | |||
* @return mixed|string | |||
* @return array|string|null | |||
*/ | |||
public function getCommentsLink(Node $node) { | |||
$href = $this->server->getBaseUri(); | |||
@@ -151,13 +142,10 @@ class CommentPropertiesPlugin extends ServerPlugin { | |||
} | |||
/** | |||
* returns the number of unread comments for the currently logged in user | |||
* Returns the number of unread comments for the currently logged in user | |||
* on the given file or directory node | |||
* | |||
* @param Node $node | |||
* @return Int|null | |||
*/ | |||
public function getUnreadCount(Node $node) { | |||
public function getUnreadCount(Node $node): ?int { | |||
$user = $this->userSession->getUser(); | |||
if (is_null($user)) { | |||
return null; |
@@ -27,6 +27,7 @@ namespace OCA\DAV\Connector\Sabre; | |||
use Sabre\DAV\Exception\NotFound; | |||
use Sabre\HTTP\RequestInterface; | |||
use Sabre\HTTP\ResponseInterface; | |||
use Sabre\DAV\Server; | |||
/** | |||
* Copies the "Etag" header to "OC-Etag" after any request. | |||
@@ -34,9 +35,8 @@ use Sabre\HTTP\ResponseInterface; | |||
* or mangle Etag headers. | |||
*/ | |||
class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin { | |||
private ?Server $server = null; | |||
/** @var \Sabre\DAV\Server */ | |||
private $server; | |||
/** | |||
* This initializes the plugin. | |||
* |
@@ -54,40 +54,27 @@ use Sabre\DAV\Exception\NotFound; | |||
use Sabre\DAV\Exception\ServiceUnavailable; | |||
use Sabre\DAV\IFile; | |||
use Sabre\DAV\INode; | |||
use OCP\Share\IManager as IShareManager; | |||
class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget { | |||
/** | |||
* Cached directory content | |||
* | |||
* @var \OCP\Files\FileInfo[] | |||
*/ | |||
private $dirContent; | |||
private ?array $dirContent = null; | |||
/** | |||
* Cached quota info | |||
* | |||
* @var array | |||
*/ | |||
private $quotaInfo; | |||
/** | |||
* @var ObjectTree|null | |||
*/ | |||
private $tree; | |||
/** Cached quota info */ | |||
private ?array $quotaInfo = null; | |||
private ?ObjectTree $tree = null; | |||
/** @var array<string, array<int, FileMetadata>> */ | |||
private array $metadata = []; | |||
/** | |||
* Sets up the node, expects a full path name | |||
* | |||
* @param \OC\Files\View $view | |||
* @param \OCP\Files\FileInfo $info | |||
* @param ObjectTree|null $tree | |||
* @param \OCP\Share\IManager $shareManager | |||
*/ | |||
public function __construct(View $view, FileInfo $info, $tree = null, $shareManager = null) { | |||
public function __construct(View $view, FileInfo $info, ?ObjectTree $tree = null, IShareManager $shareManager = null) { | |||
parent::__construct($view, $info, $shareManager); | |||
$this->tree = $tree; | |||
} |
@@ -28,6 +28,7 @@ namespace OCA\DAV\Connector\Sabre; | |||
use Sabre\HTTP\RequestInterface; | |||
use Sabre\HTTP\ResponseInterface; | |||
use Sabre\DAV\Server; | |||
/** | |||
* Class DummyGetResponsePlugin is a plugin used to not show a "Not implemented" | |||
@@ -43,8 +44,7 @@ use Sabre\HTTP\ResponseInterface; | |||
* @package OCA\DAV\Connector\Sabre | |||
*/ | |||
class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin { | |||
/** @var \Sabre\DAV\Server */ | |||
protected $server; | |||
protected ?Server $server = null; | |||
/** | |||
* @param \Sabre\DAV\Server $server |
@@ -83,16 +83,13 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { | |||
RequestedRangeNotSatisfiable::class => true, | |||
]; | |||
/** @var string */ | |||
private $appName; | |||
private string $appName; | |||
private LoggerInterface $logger; | |||
/** | |||
* @param string $loggerAppName app name to use when logging | |||
* @param LoggerInterface $logger | |||
*/ | |||
public function __construct($loggerAppName, LoggerInterface $logger) { | |||
public function __construct(string $loggerAppName, LoggerInterface $logger) { | |||
$this->appName = $loggerAppName; | |||
$this->logger = $logger; | |||
} | |||
@@ -114,7 +111,6 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { | |||
/** | |||
* Log exception | |||
* | |||
*/ | |||
public function logException(\Throwable $ex) { | |||
$exceptionClass = get_class($ex); | |||
@@ -128,11 +124,12 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { | |||
'app' => $this->appName, | |||
'exception' => $ex, | |||
]); | |||
} else { | |||
$this->logger->critical($ex->getMessage(), [ | |||
'app' => $this->appName, | |||
'exception' => $ex, | |||
]); | |||
return; | |||
} | |||
$this->logger->critical($ex->getMessage(), [ | |||
'app' => $this->appName, | |||
'exception' => $ex, | |||
]); | |||
} | |||
} |
@@ -49,6 +49,7 @@ use Sabre\DAV\IFile; | |||
use Sabre\DAV\PropFind; | |||
use Sabre\DAV\PropPatch; | |||
use Sabre\DAV\ServerPlugin; | |||
use Sabre\DAV\Server; | |||
use Sabre\DAV\Tree; | |||
use Sabre\HTTP\RequestInterface; | |||
use Sabre\HTTP\ResponseInterface; | |||
@@ -84,66 +85,28 @@ class FilesPlugin extends ServerPlugin { | |||
public const SUBFILE_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-file-count'; | |||
public const FILE_METADATA_SIZE = '{http://nextcloud.org/ns}file-metadata-size'; | |||
/** | |||
* Reference to main server object | |||
* | |||
* @var \Sabre\DAV\Server | |||
*/ | |||
private $server; | |||
/** | |||
* @var Tree | |||
*/ | |||
private $tree; | |||
/** | |||
* @var IUserSession | |||
*/ | |||
private $userSession; | |||
/** Reference to main server object */ | |||
private ?Server $server = null; | |||
private Tree $tree; | |||
private IUserSession $userSession; | |||
/** | |||
* Whether this is public webdav. | |||
* If true, some returned information will be stripped off. | |||
* | |||
* @var bool | |||
*/ | |||
private $isPublic; | |||
/** | |||
* @var bool | |||
*/ | |||
private $downloadAttachment; | |||
private bool $isPublic; | |||
private bool $downloadAttachment; | |||
private IConfig $config; | |||
private IRequest $request; | |||
private IPreview $previewManager; | |||
/** | |||
* @var IConfig | |||
*/ | |||
private $config; | |||
/** | |||
* @var IRequest | |||
*/ | |||
private $request; | |||
/** | |||
* @var IPreview | |||
*/ | |||
private $previewManager; | |||
/** | |||
* @param Tree $tree | |||
* @param IConfig $config | |||
* @param IRequest $request | |||
* @param IPreview $previewManager | |||
* @param bool $isPublic | |||
* @param bool $downloadAttachment | |||
*/ | |||
public function __construct(Tree $tree, | |||
IConfig $config, | |||
IRequest $request, | |||
IPreview $previewManager, | |||
IUserSession $userSession, | |||
$isPublic = false, | |||
$downloadAttachment = true) { | |||
bool $isPublic = false, | |||
bool $downloadAttachment = true) { | |||
$this->tree = $tree; | |||
$this->config = $config; | |||
$this->request = $request; | |||
@@ -161,10 +124,9 @@ class FilesPlugin extends ServerPlugin { | |||
* | |||
* This method should set up the required event subscriptions. | |||
* | |||
* @param \Sabre\DAV\Server $server | |||
* @return void | |||
*/ | |||
public function initialize(\Sabre\DAV\Server $server) { | |||
public function initialize(Server $server) { | |||
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; | |||
$server->xml->namespaceMap[self::NS_NEXTCLOUD] = 'nc'; | |||
$server->protectedProperties[] = self::FILEID_PROPERTYNAME; | |||
@@ -347,7 +309,7 @@ class FilesPlugin extends ServerPlugin { | |||
); | |||
}); | |||
$propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { | |||
$propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest): ?string { | |||
$user = $this->userSession->getUser(); | |||
if ($user === null) { | |||
return null; | |||
@@ -359,11 +321,11 @@ class FilesPlugin extends ServerPlugin { | |||
return json_encode($ocmPermissions); | |||
}); | |||
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node) { | |||
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node): string { | |||
return $node->getETag(); | |||
}); | |||
$propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node) { | |||
$propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node): ?string { | |||
$owner = $node->getOwner(); | |||
if (!$owner) { | |||
return null; | |||
@@ -371,7 +333,7 @@ class FilesPlugin extends ServerPlugin { | |||
return $owner->getUID(); | |||
} | |||
}); | |||
$propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node) { | |||
$propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node): ?string { | |||
$owner = $node->getOwner(); | |||
if (!$owner) { | |||
return null; | |||
@@ -383,14 +345,14 @@ class FilesPlugin extends ServerPlugin { | |||
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { | |||
return json_encode($this->previewManager->isAvailable($node->getFileInfo())); | |||
}); | |||
$propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { | |||
$propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node): ?int { | |||
return $node->getSize(); | |||
}); | |||
$propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { | |||
return $node->getFileInfo()->getMountPoint()->getMountType(); | |||
}); | |||
$propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest) { | |||
$propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest): ?string { | |||
$user = $this->userSession->getUser(); | |||
if ($user === null) { | |||
return null; | |||
@@ -569,10 +531,7 @@ class FilesPlugin extends ServerPlugin { | |||
if (empty($etag)) { | |||
return false; | |||
} | |||
if ($node->setEtag($etag) !== -1) { | |||
return true; | |||
} | |||
return false; | |||
return $node->setEtag($etag) !== -1; | |||
}); | |||
$propPatch->handle(self::CREATIONDATE_PROPERTYNAME, function ($time) use ($node) { | |||
if (empty($time)) { |
@@ -48,25 +48,16 @@ use Sabre\DAV\Auth\Plugin; | |||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | |||
class ServerFactory { | |||
/** @var IConfig */ | |||
private $config; | |||
private IConfig $config; | |||
private LoggerInterface $logger; | |||
/** @var IDBConnection */ | |||
private $databaseConnection; | |||
/** @var IUserSession */ | |||
private $userSession; | |||
/** @var IMountManager */ | |||
private $mountManager; | |||
/** @var ITagManager */ | |||
private $tagManager; | |||
/** @var IRequest */ | |||
private $request; | |||
/** @var IPreview */ | |||
private $previewManager; | |||
/** @var EventDispatcherInterface */ | |||
private $eventDispatcher; | |||
/** @var IL10N */ | |||
private $l10n; | |||
private IDBConnection $databaseConnection; | |||
private IUserSession $userSession; | |||
private IMountManager $mountManager; | |||
private ITagManager $tagManager; | |||
private IRequest $request; | |||
private IPreview $previewManager; | |||
private EventDispatcherInterface $eventDispatcher; | |||
private IL10N $l10n; | |||
public function __construct( | |||
IConfig $config, | |||
@@ -93,16 +84,12 @@ class ServerFactory { | |||
} | |||
/** | |||
* @param string $baseUri | |||
* @param string $requestUri | |||
* @param Plugin $authPlugin | |||
* @param callable $viewCallBack callback that should return the view for the dav endpoint | |||
* @return Server | |||
*/ | |||
public function createServer($baseUri, | |||
$requestUri, | |||
public function createServer(string $baseUri, | |||
string $requestUri, | |||
Plugin $authPlugin, | |||
callable $viewCallBack) { | |||
callable $viewCallBack): Server { | |||
// Fire up server | |||
$objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree(); | |||
$server = new \OCA\DAV\Connector\Sabre\Server($objectTree); |
@@ -30,10 +30,14 @@ namespace OCA\DAV\Connector\Sabre; | |||
use OCA\DAV\Connector\Sabre\Node as DavNode; | |||
use OCP\Files\Folder; | |||
use OCP\Files\Node; | |||
use OCP\Files\NotFoundException; | |||
use OCP\IUserSession; | |||
use OCP\Share\IShare; | |||
use OCP\Share\IManager; | |||
use Sabre\DAV\PropFind; | |||
use Sabre\DAV\Tree; | |||
use Sabre\DAV\Server; | |||
/** | |||
* Sabre Plugin to provide share-related properties | |||
@@ -50,36 +54,20 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { | |||
* @var \Sabre\DAV\Server | |||
*/ | |||
private $server; | |||
/** @var \OCP\Share\IManager */ | |||
private $shareManager; | |||
/** @var \Sabre\DAV\Tree */ | |||
private $tree; | |||
/** @var string */ | |||
private $userId; | |||
/** @var \OCP\Files\Folder */ | |||
private $userFolder; | |||
private IManager $shareManager; | |||
private Tree $tree; | |||
private string $userId; | |||
private Folder $userFolder; | |||
/** @var IShare[][] */ | |||
private $cachedShares = []; | |||
private array $cachedShares = []; | |||
/** @var string[] */ | |||
private $cachedFolders = []; | |||
private array $cachedFolders = []; | |||
/** | |||
* @param \Sabre\DAV\Tree $tree tree | |||
* @param IUserSession $userSession user session | |||
* @param \OCP\Files\Folder $userFolder user home folder | |||
* @param \OCP\Share\IManager $shareManager share manager | |||
*/ | |||
public function __construct( | |||
\Sabre\DAV\Tree $tree, | |||
Tree $tree, | |||
IUserSession $userSession, | |||
\OCP\Files\Folder $userFolder, | |||
\OCP\Share\IManager $shareManager | |||
Folder $userFolder, | |||
IManager $shareManager | |||
) { | |||
$this->tree = $tree; | |||
$this->shareManager = $shareManager; | |||
@@ -95,9 +83,9 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { | |||
* | |||
* This method should set up the required event subscriptions. | |||
* | |||
* @param \Sabre\DAV\Server $server | |||
* @return void | |||
*/ | |||
public function initialize(\Sabre\DAV\Server $server) { | |||
public function initialize(Server $server) { | |||
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; | |||
$server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = ShareTypeList::class; | |||
$server->protectedProperties[] = self::SHARETYPES_PROPERTYNAME; | |||
@@ -108,10 +96,10 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { | |||
} | |||
/** | |||
* @param \OCP\Files\Node $node | |||
* @param Node $node | |||
* @return IShare[] | |||
*/ | |||
private function getShare(\OCP\Files\Node $node): array { | |||
private function getShare(Node $node): array { | |||
$result = []; | |||
$requestedShareTypes = [ | |||
IShare::TYPE_USER, | |||
@@ -209,7 +197,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { | |||
} | |||
} | |||
$propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) { | |||
$propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode): ShareTypeList { | |||
$shares = $this->getShares($sabreNode); | |||
$shareTypes = array_unique(array_map(function (IShare $share) { | |||
@@ -219,7 +207,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { | |||
return new ShareTypeList($shareTypes); | |||
}); | |||
$propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) { | |||
$propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode): ShareeList { | |||
$shares = $this->getShares($sabreNode); | |||
return new ShareeList($shares); |
@@ -237,7 +237,7 @@ class Server { | |||
$this->server->addPlugin(new SearchPlugin($lazySearchBackend)); | |||
// wait with registering these until auth is handled and the filesystem is setup | |||
$this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend) { | |||
$this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend, $logger) { | |||
// custom properties plugin must be the last one | |||
$userSession = \OC::$server->getUserSession(); | |||
$user = $userSession->getUser(); | |||
@@ -306,7 +306,6 @@ class Server { | |||
\OC::$server->getShareManager(), | |||
$view | |||
)); | |||
$logger = \OC::$server->get(LoggerInterface::class); | |||
$this->server->addPlugin( | |||
new BulkUploadPlugin($userFolder, $logger) | |||
); |
@@ -29,7 +29,7 @@ namespace OCA\DAV\Tests\Files; | |||
use OC\Files\Search\SearchComparison; | |||
use OC\Files\Search\SearchQuery; | |||
use OC\Files\View; | |||
use OCA\DAV\Connector\Sabre\CachingTree; | |||
use OCA\DAV\Connector\Sabre\ObjectTree; | |||
use OCA\DAV\Connector\Sabre\Directory; | |||
use OCA\DAV\Connector\Sabre\File; | |||
use OCA\DAV\Connector\Sabre\FilesPlugin; | |||
@@ -48,7 +48,7 @@ use SearchDAV\Query\Query; | |||
use Test\TestCase; | |||
class FileSearchBackendTest extends TestCase { | |||
/** @var CachingTree|\PHPUnit\Framework\MockObject\MockObject */ | |||
/** @var ObjectTree|\PHPUnit\Framework\MockObject\MockObject */ | |||
private $tree; | |||
/** @var IUser */ | |||
@@ -80,7 +80,7 @@ class FileSearchBackendTest extends TestCase { | |||
->method('getUID') | |||
->willReturn('test'); | |||
$this->tree = $this->getMockBuilder(CachingTree::class) | |||
$this->tree = $this->getMockBuilder(ObjectTree::class) | |||
->disableOriginalConstructor() | |||
->getMock(); | |||
@@ -55,9 +55,6 @@ | |||
</UndefinedFunction> | |||
</file> | |||
<file src="apps/dav/appinfo/v1/caldav.php"> | |||
<TooManyArguments occurrences="1"> | |||
<code>new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')</code> | |||
</TooManyArguments> | |||
<UndefinedGlobalVariable occurrences="1"> | |||
<code>$baseuri</code> | |||
</UndefinedGlobalVariable> | |||
@@ -122,26 +119,6 @@ | |||
<code>Uri\split($this->principalInfo['uri'])</code> | |||
</UndefinedFunction> | |||
</file> | |||
<file src="apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php"> | |||
<ParamNameMismatch occurrences="1"> | |||
<code>$arguments</code> | |||
</ParamNameMismatch> | |||
</file> | |||
<file src="apps/dav/lib/BackgroundJob/EventReminderJob.php"> | |||
<ParamNameMismatch occurrences="1"> | |||
<code>$arg</code> | |||
</ParamNameMismatch> | |||
</file> | |||
<file src="apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php"> | |||
<ParamNameMismatch occurrences="1"> | |||
<code>$arguments</code> | |||
</ParamNameMismatch> | |||
</file> | |||
<file src="apps/dav/lib/BackgroundJob/UploadCleanup.php"> | |||
<InvalidArgument occurrences="1"> | |||
<code>File</code> | |||
</InvalidArgument> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/BirthdayService.php"> | |||
<UndefinedMethod occurrences="2"> | |||
<code>setDateTime</code> | |||
@@ -155,20 +132,11 @@ | |||
</UndefinedPropertyFetch> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/CachedSubscription.php"> | |||
<LessSpecificImplementedReturnType occurrences="1"> | |||
<code>array</code> | |||
</LessSpecificImplementedReturnType> | |||
<MoreSpecificImplementedParamType occurrences="1"> | |||
<code>$calendarData</code> | |||
</MoreSpecificImplementedParamType> | |||
<ParamNameMismatch occurrences="1"> | |||
<code>$calendarData</code> | |||
</ParamNameMismatch> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/CachedSubscriptionObject.php"> | |||
<ImplementedReturnTypeMismatch occurrences="1"> | |||
<code>string|void</code> | |||
</ImplementedReturnTypeMismatch> | |||
<NullableReturnStatement occurrences="1"> | |||
<code>$this->objectData['calendardata']</code> | |||
</NullableReturnStatement> | |||
@@ -263,16 +231,6 @@ | |||
<code>$paths</code> | |||
</MoreSpecificImplementedParamType> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Publishing/PublishPlugin.php"> | |||
<InvalidOperand occurrences="2"> | |||
<code>$canPublish</code> | |||
<code>$canShare</code> | |||
</InvalidOperand> | |||
<InvalidScalarArgument occurrences="2"> | |||
<code>$canPublish</code> | |||
<code>$canShare</code> | |||
</InvalidScalarArgument> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php"> | |||
<UndefinedMethod occurrences="3"> | |||
<code>hasTime</code> | |||
@@ -281,60 +239,17 @@ | |||
</UndefinedMethod> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php"> | |||
<FalsableReturnStatement occurrences="4"> | |||
<code>$l10n->l('date', $dt, ['width' => 'medium'])</code> | |||
<code>$l10n->l('datetime', $dt, ['width' => 'medium|short'])</code> | |||
<code>$l10n->l('time', $dt, ['width' => 'short'])</code> | |||
<code>$l10n->l('weekdayName', $dt, ['width' => 'abbreviated'])</code> | |||
</FalsableReturnStatement> | |||
<InvalidReturnStatement occurrences="4"> | |||
<code>$l10n->l('date', $dt, ['width' => 'medium'])</code> | |||
<code>$l10n->l('datetime', $dt, ['width' => 'medium|short'])</code> | |||
<code>$l10n->l('time', $dt, ['width' => 'short'])</code> | |||
<code>$l10n->l('weekdayName', $dt, ['width' => 'abbreviated'])</code> | |||
</InvalidReturnStatement> | |||
<InvalidReturnType occurrences="4"> | |||
<code>string</code> | |||
<code>string</code> | |||
<code>string</code> | |||
<code>string</code> | |||
</InvalidReturnType> | |||
<UndefinedMethod occurrences="3"> | |||
<code>getDateTime</code> | |||
<code>getDateTime</code> | |||
<code>isFloating</code> | |||
</UndefinedMethod> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php"> | |||
<PossiblyInvalidDocblockTag occurrences="1"> | |||
<code>@var VEvent $vevent</code> | |||
</PossiblyInvalidDocblockTag> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php"> | |||
<UndefinedConstant occurrences="1"> | |||
<code>$provider::NOTIFICATION_TYPE</code> | |||
</UndefinedConstant> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/Notifier.php"> | |||
<FalsableReturnStatement occurrences="4"> | |||
<code>$this->l10n->l('date', $dt, ['width' => 'medium'])</code> | |||
<code>$this->l10n->l('datetime', $dt, ['width' => 'medium|short'])</code> | |||
<code>$this->l10n->l('time', $dt, ['width' => 'short'])</code> | |||
<code>$this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated'])</code> | |||
</FalsableReturnStatement> | |||
<InvalidReturnStatement occurrences="4"> | |||
<code>$this->l10n->l('date', $dt, ['width' => 'medium'])</code> | |||
<code>$this->l10n->l('datetime', $dt, ['width' => 'medium|short'])</code> | |||
<code>$this->l10n->l('time', $dt, ['width' => 'short'])</code> | |||
<code>$this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated'])</code> | |||
</InvalidReturnStatement> | |||
<InvalidReturnType occurrences="4"> | |||
<code>string</code> | |||
<code>string</code> | |||
<code>string</code> | |||
<code>string</code> | |||
</InvalidReturnType> | |||
</file> | |||
<file src="apps/dav/lib/CalDAV/Reminder/ReminderService.php"> | |||
<UndefinedMethod occurrences="3"> | |||
<code>getDateInterval</code> | |||
@@ -457,21 +372,6 @@ | |||
<code>'\OCA\DAV\CardDAV\CardDavBackend::deleteCard'</code> | |||
<code>'\OCA\DAV\CardDAV\CardDavBackend::updateCard'</code> | |||
</InvalidArgument> | |||
<InvalidNullableReturnType occurrences="1"> | |||
<code>array</code> | |||
</InvalidNullableReturnType> | |||
<MoreSpecificImplementedParamType occurrences="1"> | |||
<code>$uris</code> | |||
</MoreSpecificImplementedParamType> | |||
<NullableReturnStatement occurrences="1"> | |||
<code>null</code> | |||
</NullableReturnStatement> | |||
<ParamNameMismatch occurrences="1"> | |||
<code>$addressBookId</code> | |||
</ParamNameMismatch> | |||
<RedundantCast occurrences="1"> | |||
<code>(int)$addressBookId</code> | |||
</RedundantCast> | |||
<TooManyArguments occurrences="3"> | |||
<code>dispatch</code> | |||
<code>dispatch</code> | |||
@@ -511,11 +411,6 @@ | |||
<code>\Sabre\Uri\split($principal)</code> | |||
</UndefinedFunction> | |||
</file> | |||
<file src="apps/dav/lib/CardDAV/SyncService.php"> | |||
<InvalidScalarArgument occurrences="1"> | |||
<code>$targetBookId</code> | |||
</InvalidScalarArgument> | |||
</file> | |||
<file src="apps/dav/lib/CardDAV/UserAddressBooks.php"> | |||
<InvalidArgument occurrences="2"> | |||
<code>$this->principalUri</code> | |||
@@ -583,11 +478,6 @@ | |||
<code>bool</code> | |||
</InvalidNullableReturnType> | |||
</file> | |||
<file src="apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php"> | |||
<InvalidReturnType occurrences="1"> | |||
<code>bool</code> | |||
</InvalidReturnType> | |||
</file> | |||
<file src="apps/dav/lib/Connector/Sabre/BearerAuth.php"> | |||
<UndefinedInterfaceMethod occurrences="1"> | |||
<code>tryTokenLogin</code> |