Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
edf8ce32cf
commit
caff1023ea
|
@ -91,5 +91,4 @@ class AccessibilityProvider {
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ class ConfigController extends OCSController {
|
|||
*/
|
||||
public function setConfig(string $key, $value): DataResponse {
|
||||
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
|
||||
|
||||
if ($value === false || $value === '') {
|
||||
throw new OCSBadRequestException('Invalid value: ' . $value);
|
||||
}
|
||||
|
@ -142,7 +141,6 @@ class ConfigController extends OCSController {
|
|||
*/
|
||||
public function deleteConfig(string $key): DataResponse {
|
||||
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
|
||||
|
||||
$this->config->deleteUserValue($this->userId, $this->appName, $key);
|
||||
$userValues = $this->config->getUserKeys($this->userId, $this->appName);
|
||||
|
||||
|
@ -156,5 +154,4 @@ class ConfigController extends OCSController {
|
|||
|
||||
throw new OCSBadRequestException('Invalid key: ' . $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,5 +86,4 @@ class RepairUserConfig implements IRepairStep {
|
|||
});
|
||||
$output->finishProgress();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ declare(strict_types=1);
|
|||
namespace OCA\AdminAudit\Actions;
|
||||
|
||||
class Trashbin extends Action {
|
||||
|
||||
public function delete(array $params) {
|
||||
$this->log('File "%s" deleted from trash bin.',
|
||||
['path' => $params['path']], ['path']
|
||||
|
@ -41,5 +40,4 @@ class Trashbin extends Action {
|
|||
['path' => $params['filePath']], ['path']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ declare(strict_types=1);
|
|||
namespace OCA\AdminAudit\Actions;
|
||||
|
||||
class Versions extends Action {
|
||||
|
||||
public function rollback(array $params) {
|
||||
$this->log('Version "%s" of "%s" was restored.',
|
||||
[
|
||||
|
@ -46,5 +45,4 @@ class Versions extends Action {
|
|||
['path']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ class Application extends App {
|
|||
return;
|
||||
}
|
||||
$this->logger = $c->getLogFactory()->getCustomLogger($logFile);
|
||||
|
||||
}
|
||||
|
||||
public function register() {
|
||||
|
@ -152,7 +151,6 @@ class Application extends App {
|
|||
}
|
||||
|
||||
protected function appHooks() {
|
||||
|
||||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) {
|
||||
$appActions = new AppManagement($this->logger);
|
||||
|
@ -166,7 +164,6 @@ class Application extends App {
|
|||
$appActions = new AppManagement($this->logger);
|
||||
$appActions->disableApp($event->getAppID());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected function consoleHooks() {
|
||||
|
|
|
@ -73,5 +73,4 @@ class SecurityTest extends TestCase {
|
|||
|
||||
$this->security->twofactorSuccess($this->user, ['provider' => 'myprovider']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ use OCA\CloudFederationAPI\Capabilities;
|
|||
use OCP\AppFramework\App;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct('cloud_federation_api');
|
||||
|
||||
|
|
|
@ -55,5 +55,4 @@ class Config {
|
|||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -215,7 +215,6 @@ class RequestHandlerController extends Controller {
|
|||
return new JSONResponse(
|
||||
['recipientDisplayName' => $recipientDisplayName],
|
||||
Http::STATUS_CREATED);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,8 +266,7 @@ class RequestHandlerController extends Controller {
|
|||
return new JSONResponse($e->getReturnMessage(), Http::STATUS_BAD_REQUEST);
|
||||
} catch (AuthenticationFailedException $e) {
|
||||
return new JSONResponse(["message" => "RESOURCE_NOT_FOUND"], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
return new JSONResponse(
|
||||
['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],
|
||||
Http::STATUS_BAD_REQUEST
|
||||
|
@ -276,7 +274,6 @@ class RequestHandlerController extends Controller {
|
|||
}
|
||||
|
||||
return new JSONResponse($result,Http::STATUS_CREATED);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,5 +294,4 @@ class RequestHandlerController extends Controller {
|
|||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\Util;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
const APP_ID = 'comments';
|
||||
|
||||
public function __construct(array $urlParams = []) {
|
||||
|
|
|
@ -43,5 +43,4 @@ class LoadAdditionalScripts implements IEventListener {
|
|||
// we properly split it between files list and sidebar
|
||||
Util::addScript(Application::APP_ID, 'comments');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,5 +42,4 @@ class LoadSidebarScripts implements IEventListener {
|
|||
// we properly split it between files list and sidebar
|
||||
Util::addScript(Application::APP_ID, 'comments');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class Listener {
|
|||
IManager $notificationManager,
|
||||
IUserManager $userManager
|
||||
) {
|
||||
|
||||
$this->notificationManager = $notificationManager;
|
||||
$this->userManager = $userManager;
|
||||
}
|
||||
|
@ -74,8 +73,7 @@ class Listener {
|
|||
|
||||
$notification->setUser($uid);
|
||||
if ($event->getEvent() === CommentsEvent::EVENT_DELETE
|
||||
|| $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE)
|
||||
{
|
||||
|| $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) {
|
||||
$this->notificationManager->markProcessed($notification);
|
||||
} else {
|
||||
$this->notificationManager->notify($notification);
|
||||
|
|
|
@ -29,7 +29,6 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Search\Result as BaseResult;
|
||||
|
||||
class Result extends BaseResult {
|
||||
|
||||
public $type = 'comment';
|
||||
public $comment;
|
||||
public $authorId;
|
||||
|
@ -108,5 +107,4 @@ class Result extends BaseResult {
|
|||
|
||||
return $prefix . mb_substr($message, $start, $end - $start) . $suffix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,5 +116,4 @@ class EventHandlerTest extends TestCase {
|
|||
|
||||
$this->eventHandler->handle($event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -616,5 +616,4 @@ class NotifierTest extends TestCase {
|
|||
|
||||
$this->notifier->prepare($this->notification, $this->lc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ use Sabre\DAVACL\ACLTrait;
|
|||
use Sabre\DAVACL\IACL;
|
||||
|
||||
class AddressBook extends ExternalAddressBook implements IACL {
|
||||
|
||||
public const URI = 'recent';
|
||||
|
||||
use ACLTrait;
|
||||
|
@ -174,5 +173,4 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
list(, $uid) = \Sabre\Uri\split($this->principalUri);
|
||||
return $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,5 +77,4 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ use OCP\Contacts\Events\ContactInteractedWithEvent;
|
|||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
public const APP_ID = 'contactsinteraction';
|
||||
|
||||
public function __construct() {
|
||||
|
@ -43,5 +42,4 @@ class Application extends App {
|
|||
private function registerListeners(IEventDispatcher $dispatcher): void {
|
||||
$dispatcher->addServiceListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,5 +48,4 @@ class CleanupJob extends TimedJob {
|
|||
$time->modify('-7days');
|
||||
$this->mapper->cleanUp($time->getTimestamp());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ use Sabre\DAVACL\ACLTrait;
|
|||
use Sabre\DAVACL\IACL;
|
||||
|
||||
class Card implements ICard, IACL {
|
||||
|
||||
use ACLTrait;
|
||||
|
||||
/** @var RecentContact */
|
||||
|
@ -133,5 +132,4 @@ class Card implements ICard, IACL {
|
|||
function getLastModified(): ?int {
|
||||
return $this->contact->getLastContact();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,5 +88,4 @@ class CardSearchDao {
|
|||
|
||||
return $card;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,5 +69,4 @@ class RecentContact extends Entity {
|
|||
$this->addType('card', 'string');
|
||||
$this->addType('lastContact', 'int');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ use OCP\IDBConnection;
|
|||
use OCP\IUser;
|
||||
|
||||
class RecentContactMapper extends QBMapper {
|
||||
|
||||
public const TABLE_NAME = 'recent_contact';
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
|
@ -114,5 +113,4 @@ class RecentContactMapper extends QBMapper {
|
|||
|
||||
$delete->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -167,5 +167,4 @@ class ContactInteractionListener implements IEventListener {
|
|||
|
||||
return (new VCard($props))->serialize();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,5 +89,4 @@ class Version010000Date20200304152605 extends SimpleMigrationStep {
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ use OCP\IUser;
|
|||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
const APP_ID = 'dav';
|
||||
|
||||
/**
|
||||
|
@ -269,5 +268,4 @@ class Application extends App {
|
|||
$this->getContainer()->getServer()->getLogger()->logException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -303,5 +303,4 @@ class PluginManager {
|
|||
$this->calendarPlugins[] = $instantiatedCalendarPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,6 +116,4 @@ class AvatarHome implements ICollection {
|
|||
public function getLastModified() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,5 @@ class AvatarNode extends File {
|
|||
return (int)$timestamp;
|
||||
}
|
||||
return $timestamp;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,5 +47,4 @@ class RootCollection extends AbstractPrincipalCollection {
|
|||
public function getName() {
|
||||
return 'avatars';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,5 +48,4 @@ class CleanupDirectLinksJob extends TimedJob {
|
|||
// Delete all shares expired 24 hours ago
|
||||
$this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,5 +64,4 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|||
]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,5 +86,4 @@ class UploadCleanup extends TimedJob {
|
|||
$this->jobList->remove(self::class, $argument);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ use OCP\IUserManager;
|
|||
use OCP\L10N\IFactory;
|
||||
|
||||
class Calendar extends Base {
|
||||
|
||||
const SUBJECT_ADD = 'calendar_add';
|
||||
const SUBJECT_UPDATE = 'calendar_update';
|
||||
const SUBJECT_DELETE = 'calendar_delete';
|
||||
|
@ -111,12 +110,10 @@ class Calendar extends Base {
|
|||
$subject = $this->l->t('{actor} updated calendar {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UPDATE . '_self') {
|
||||
$subject = $this->l->t('You updated calendar {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_PUBLISH . '_self') {
|
||||
$subject = $this->l->t('You shared calendar {calendar} as public link');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UNPUBLISH . '_self') {
|
||||
$subject = $this->l->t('You removed public link for calendar {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_USER) {
|
||||
$subject = $this->l->t('{actor} shared calendar {calendar} with you');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') {
|
||||
|
@ -131,7 +128,6 @@ class Calendar extends Base {
|
|||
$subject = $this->l->t('{actor} unshared calendar {calendar} from {user}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') {
|
||||
$subject = $this->l->t('{actor} unshared calendar {calendar} from themselves');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') {
|
||||
$subject = $this->l->t('You shared calendar {calendar} with group {group}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') {
|
||||
|
|
|
@ -34,7 +34,6 @@ use OCP\IUserManager;
|
|||
use OCP\L10N\IFactory;
|
||||
|
||||
class Event extends Base {
|
||||
|
||||
const SUBJECT_OBJECT_ADD = 'object_add';
|
||||
const SUBJECT_OBJECT_UPDATE = 'object_update';
|
||||
const SUBJECT_OBJECT_DELETE = 'object_delete';
|
||||
|
|
|
@ -60,7 +60,6 @@ class Todo extends Event {
|
|||
$subject = $this->l->t('{actor} updated todo {todo} in list {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') {
|
||||
$subject = $this->l->t('You updated todo {todo} in list {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') {
|
||||
$subject = $this->l->t('{actor} solved todo {todo} in list {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') {
|
||||
|
|
|
@ -49,7 +49,6 @@ use Sabre\VObject\Reader;
|
|||
* @package OCA\DAV\CalDAV
|
||||
*/
|
||||
class BirthdayService {
|
||||
|
||||
const BIRTHDAY_CALENDAR_URI = 'contact_birthdays';
|
||||
|
||||
/** @var GroupPrincipalBackend */
|
||||
|
|
|
@ -136,7 +136,6 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
|
||||
$obj['acl'] = $this->getChildACL();
|
||||
return new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,7 +77,6 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* @package OCA\DAV\CalDAV
|
||||
*/
|
||||
class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
|
||||
|
||||
const CALENDAR_TYPE_CALENDAR = 0;
|
||||
const CALENDAR_TYPE_SUBSCRIPTION = 1;
|
||||
|
||||
|
@ -274,7 +273,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$calendars = [];
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$components = [];
|
||||
if ($row['components']) {
|
||||
$components = explode(',',$row['components']);
|
||||
|
@ -564,7 +562,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$this->addOwnerPrincipal($calendar);
|
||||
|
||||
return $calendar;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -803,7 +800,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
|
||||
$newValues = [];
|
||||
foreach ($mutations as $propertyName => $propertyValue) {
|
||||
|
||||
switch ($propertyName) {
|
||||
case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
|
||||
$fieldName = 'transparent';
|
||||
|
@ -814,7 +810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$newValues[$fieldName] = $propertyValue;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendars');
|
||||
|
@ -1326,7 +1321,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$requirePostFilter = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$columns = ['uri'];
|
||||
if ($requirePostFilter) {
|
||||
|
@ -1557,7 +1551,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) {
|
||||
$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
|
||||
$outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp())));
|
||||
|
||||
}
|
||||
if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) {
|
||||
$outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
|
||||
|
@ -1696,7 +1689,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return string|null
|
||||
*/
|
||||
function getCalendarObjectByUID($principalUri, $uid) {
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
|
||||
->from('calendarobjects', 'co')
|
||||
|
@ -1789,7 +1781,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
];
|
||||
|
||||
if ($syncToken) {
|
||||
|
||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
|
||||
if ($limit>0) {
|
||||
$query.= " LIMIT " . (int)$limit;
|
||||
|
@ -1804,13 +1795,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
// This loop ensures that any duplicates are overwritten, only the
|
||||
// last change on a node is relevant.
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$changes[$row['uri']] = $row['operation'];
|
||||
|
||||
}
|
||||
|
||||
foreach ($changes as $uri => $operation) {
|
||||
|
||||
switch ($operation) {
|
||||
case 1:
|
||||
$result['added'][] = $uri;
|
||||
|
@ -1822,7 +1810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result['deleted'][] = $uri;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// No synctoken supplied, this is the initial sync.
|
||||
|
@ -1833,7 +1820,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1886,7 +1872,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$subscriptions = [];
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$subscription = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -1905,7 +1890,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
$subscriptions[] = $subscription;
|
||||
|
||||
}
|
||||
|
||||
return $subscriptions;
|
||||
|
@ -1923,7 +1907,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return mixed
|
||||
*/
|
||||
function createSubscription($principalUri, $uri, array $properties) {
|
||||
|
||||
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
|
||||
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
|
||||
}
|
||||
|
@ -1994,7 +1977,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
||||
|
||||
$newValues = [];
|
||||
|
||||
foreach ($mutations as $propertyName=>$propertyValue) {
|
||||
|
@ -2024,7 +2006,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
]));
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2205,7 +2186,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt->execute([
|
||||
$calendarId
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2224,7 +2204,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return array
|
||||
*/
|
||||
public function getDenormalizedData($calendarData) {
|
||||
|
||||
$vObject = Reader::read($calendarData);
|
||||
$componentType = null;
|
||||
$component = null;
|
||||
|
@ -2269,11 +2248,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
while ($it->valid() && $end < $maxDate) {
|
||||
$end = $it->getDtEnd();
|
||||
$it->next();
|
||||
|
||||
}
|
||||
$lastOccurrence = $end->getTimestamp();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2297,7 +2274,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'uid' => $uid,
|
||||
'classification' => $classification
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2346,7 +2322,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return string|null
|
||||
*/
|
||||
public function setPublishStatus($value, $calendar) {
|
||||
|
||||
$calendarId = $calendar->getResourceId();
|
||||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent(
|
||||
'\OCA\DAV\CalDAV\CalDavBackend::updateShares',
|
||||
|
@ -2540,8 +2515,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $uriOrigin
|
||||
* @param string $uriDestination
|
||||
*/
|
||||
public function moveCalendar($uriName, $uriOrigin, $uriDestination)
|
||||
{
|
||||
public function moveCalendar($uriName, $uriOrigin, $uriDestination) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendars')
|
||||
->set('principaluri', $query->createNamedParameter($uriDestination))
|
||||
|
|
|
@ -280,7 +280,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
}
|
||||
|
||||
public function getChild($name) {
|
||||
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
|
||||
|
||||
if (!$obj) {
|
||||
|
@ -294,11 +293,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$obj['acl'] = $this->getChildACL();
|
||||
|
||||
return new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
public function getChildren() {
|
||||
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
|
||||
$children = [];
|
||||
foreach ($objs as $obj) {
|
||||
|
@ -309,11 +306,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
}
|
||||
return $children;
|
||||
|
||||
}
|
||||
|
||||
public function getMultipleChildren(array $paths) {
|
||||
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
|
||||
$children = [];
|
||||
foreach ($objs as $obj) {
|
||||
|
@ -324,7 +319,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
}
|
||||
return $children;
|
||||
|
||||
}
|
||||
|
||||
public function childExists($name) {
|
||||
|
@ -340,7 +334,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
}
|
||||
|
||||
public function calendarQuery(array $filters) {
|
||||
|
||||
$uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters);
|
||||
if ($this->isShared()) {
|
||||
return array_filter($uris, function ($uri) {
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
namespace OCA\DAV\CalDAV;
|
||||
|
||||
class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
||||
|
||||
function getChildForPrincipal(array $principal) {
|
||||
return new CalendarHome($this->caldavBackend, $principal);
|
||||
}
|
||||
|
|
|
@ -93,5 +93,4 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
|
|||
|
||||
return $vcalendar;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
*/
|
||||
final public function createDirectory($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,5 +67,4 @@ interface ICalendarProvider {
|
|||
* @return ExternalCalendar|null Calendar if it exists, null otherwise
|
||||
*/
|
||||
public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar;
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
namespace OCA\DAV\CalDAV;
|
||||
|
||||
class Plugin extends \Sabre\CalDAV\Plugin {
|
||||
|
||||
const SYSTEM_CALENDAR_ROOT = 'system-calendars';
|
||||
|
||||
/**
|
||||
|
@ -52,5 +51,4 @@ class Plugin extends \Sabre\CalDAV\Plugin {
|
|||
return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,5 +39,4 @@ class Collection extends \Sabre\CalDAV\Principal\Collection {
|
|||
function getChildForPrincipal(array $principalInfo) {
|
||||
return new User($this->principalBackend, $principalInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,5 +51,4 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
];
|
||||
return $acl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ use OCP\IDBConnection;
|
|||
* @package OCA\DAV\CalDAV\Proxy
|
||||
*/
|
||||
class ProxyMapper extends QBMapper {
|
||||
|
||||
const PERMISSION_READ = 1;
|
||||
const PERMISSION_WRITE = 2;
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class PublicCalendarRoot extends Collection {
|
|||
$this->caldavBackend = $caldavBackend;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,5 +39,4 @@ class ProviderNotAvailableException extends \Exception {
|
|||
public function __construct(string $type) {
|
||||
parent::__construct("No notification provider for type $type available");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,5 +38,4 @@ class NotificationTypeDoesNotExistException extends \Exception {
|
|||
public function __construct(string $type) {
|
||||
parent::__construct("Type $type is not an accepted type of notification");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -422,7 +422,6 @@ class ReminderService {
|
|||
!$reminder['is_recurring'] ||
|
||||
!$reminder['is_relative'] ||
|
||||
$reminder['is_recurrence_exception']) {
|
||||
|
||||
$this->backend->removeReminder($reminder['id']);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
} else {
|
||||
$principals[] = $this->rowToPrincipal($row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
|
|
@ -361,7 +361,6 @@ class IMipPlugin extends SabreIMipPlugin {
|
|||
while ($it->valid() && $end < $maxDate) {
|
||||
$end = $it->getDtEnd();
|
||||
$it->next();
|
||||
|
||||
}
|
||||
$lastOccurrence = $end->getTimestamp();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ class SearchPlugin extends ServerPlugin {
|
|||
// If we're dealing with the calendar home, the calendar home itself is
|
||||
// responsible for the calendar-query
|
||||
if ($node instanceof CalendarHome && $depth === 2) {
|
||||
|
||||
$nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);
|
||||
|
||||
foreach ($nodePaths as $path) {
|
||||
|
|
|
@ -45,7 +45,6 @@ class ParamFilter implements XmlDeserializable {
|
|||
|
||||
if (!is_string($property)) {
|
||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
|
||||
|
||||
}
|
||||
if (!is_string($parameter)) {
|
||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace OCA\DAV;
|
|||
use OCP\Capabilities\ICapability;
|
||||
|
||||
class Capabilities implements ICapability {
|
||||
|
||||
public function getCapabilities() {
|
||||
return [
|
||||
'dav' => [
|
||||
|
|
|
@ -155,14 +155,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
}
|
||||
|
||||
public function getChild($name) {
|
||||
|
||||
$obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name);
|
||||
if (!$obj) {
|
||||
throw new NotFound('Card not found');
|
||||
}
|
||||
$obj['acl'] = $this->getChildACL();
|
||||
return new Card($this->carddavBackend, $this->addressBookInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
array $addressBookInfo,
|
||||
CardDavBackend $backend,
|
||||
IURLGenerator $urlGenerator) {
|
||||
|
||||
$this->addressBook = $addressBook;
|
||||
$this->addressBookInfo = $addressBookInfo;
|
||||
$this->backend = $backend;
|
||||
|
@ -156,7 +155,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
}
|
||||
|
||||
return $this->vCard2Array($uri, $vCard);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,7 +259,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
]) . '?photo';
|
||||
|
||||
$result['PHOTO'] = 'VALUE=uri:' . $url;
|
||||
|
||||
} elseif ($property->name === 'X-SOCIALPROFILE') {
|
||||
$type = $this->getTypeFromProperty($property);
|
||||
|
||||
|
@ -288,8 +285,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
} else {
|
||||
$result[$property->name][] = $property->getValue();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$result[$property->name] = $property->getValue();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
|||
}
|
||||
|
||||
function getName() {
|
||||
|
||||
if ($this->principalPrefix === 'principals') {
|
||||
return parent::getName();
|
||||
}
|
||||
|
@ -70,7 +69,5 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
|||
|
||||
// We are only interested in the second part.
|
||||
return $parts[1];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class CardDavBackend implements BackendInterface, SyncSupport {
|
||||
|
||||
const PERSONAL_ADDRESSBOOK_URI = 'contacts';
|
||||
const PERSONAL_ADDRESSBOOK_NAME = 'Contacts';
|
||||
|
||||
|
@ -364,10 +363,8 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
|
||||
|
||||
$updates = [];
|
||||
foreach ($mutations as $property=>$newValue) {
|
||||
|
||||
switch ($property) {
|
||||
case '{DAV:}displayname':
|
||||
$updates['displayname'] = $newValue;
|
||||
|
@ -389,7 +386,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$this->addChange($addressBookId, "", 2);
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -412,7 +408,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
];
|
||||
|
||||
foreach ($properties as $property=>$newValue) {
|
||||
|
||||
switch ($property) {
|
||||
case '{DAV:}displayname':
|
||||
$values['displayname'] = $newValue;
|
||||
|
@ -423,7 +418,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
default:
|
||||
throw new BadRequest('Unknown property: ' . $property);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fallback to make sure the displayname is set. Some clients may refuse
|
||||
|
@ -475,7 +469,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$query->delete($this->dbCardsPropertiesTable)
|
||||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
|
||||
->execute();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -680,7 +673,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
* @return string
|
||||
*/
|
||||
function updateCard($addressBookId, $cardUri, $cardData) {
|
||||
|
||||
$uid = $this->getUID($cardData);
|
||||
$etag = md5($cardData);
|
||||
$query = $this->db->getQueryBuilder();
|
||||
|
@ -804,7 +796,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$stmt->execute([ $addressBookId ]);
|
||||
$currentToken = $stmt->fetchColumn(0);
|
||||
|
||||
if (is_null($currentToken)) return null;
|
||||
if (is_null($currentToken)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = [
|
||||
'syncToken' => $currentToken,
|
||||
|
@ -814,7 +808,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
];
|
||||
|
||||
if ($syncToken) {
|
||||
|
||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
|
||||
if ($limit>0) {
|
||||
$query .= " LIMIT " . (int)$limit;
|
||||
|
@ -829,13 +822,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
// This loop ensures that any duplicates are overwritten, only the
|
||||
// last change on a node is relevant.
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$changes[$row['uri']] = $row['operation'];
|
||||
|
||||
}
|
||||
|
||||
foreach ($changes as $uri => $operation) {
|
||||
|
||||
switch ($operation) {
|
||||
case 1:
|
||||
$result['added'][] = $uri;
|
||||
|
@ -847,7 +837,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$result['deleted'][] = $uri;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// No synctoken supplied, this is the initial sync.
|
||||
|
|
|
@ -86,5 +86,4 @@ class ContactsManager {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ class Converter {
|
|||
* @return VCard|null
|
||||
*/
|
||||
public function createCardFromUser(IUser $user) {
|
||||
|
||||
$userData = $this->accountManager->getUser($user);
|
||||
|
||||
$uid = $user->getUID();
|
||||
|
@ -68,7 +67,6 @@ class Converter {
|
|||
}
|
||||
|
||||
foreach ($userData as $property => $value) {
|
||||
|
||||
$shareWithTrustedServers =
|
||||
$value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
|
||||
$value['scope'] === AccountManager::VISIBILITY_PUBLIC;
|
||||
|
@ -150,5 +148,4 @@ class Converter {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ class HasPhotoPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
function propFind(PropFind $propFind, INode $node) {
|
||||
|
||||
$ns = '{http://nextcloud.com/ns}';
|
||||
|
||||
if ($node instanceof Card) {
|
||||
|
@ -96,7 +95,5 @@ class HasPhotoPlugin extends ServerPlugin {
|
|||
'name' => $this->getPluginName(),
|
||||
'description' => 'Return a boolean stating if the vcard have a photo property set or not.'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ class ImageExportPlugin extends ServerPlugin {
|
|||
* @return bool
|
||||
*/
|
||||
public function httpGet(RequestInterface $request, ResponseInterface $response) {
|
||||
|
||||
$queryParams = $request->getQueryParameters();
|
||||
// TODO: in addition to photo we should also add logo some point in time
|
||||
if (!array_key_exists('photo', $queryParams)) {
|
||||
|
|
|
@ -87,7 +87,6 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
|||
*/
|
||||
final public function createDirectory($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Creating collections in address book objects is not allowed');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,5 +129,4 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
|||
public static function doesViolateReservedName(string $uri): bool {
|
||||
return strpos($uri, self::PREFIX) === 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,5 +68,4 @@ interface IAddressBookProvider {
|
|||
*@since 19.0.0
|
||||
*/
|
||||
public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
* @return bool
|
||||
*/
|
||||
public function httpReport(RequestInterface $request, ResponseInterface $response) {
|
||||
|
||||
$queryParams = $request->getQueryParameters();
|
||||
if (!array_key_exists('export', $queryParams)) {
|
||||
return;
|
||||
|
@ -118,7 +117,5 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
'name' => $this->getPluginName(),
|
||||
'description' => 'Intercept a multi-get request and return a single vcf file instead.'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,7 +164,6 @@ class PhotoCache {
|
|||
$file = $folder->newFile($path);
|
||||
$file->putContent($photo->data());
|
||||
} catch (NotPermittedException $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ use Sabre\DAV\PropFind;
|
|||
use Sabre\DAV\Server;
|
||||
|
||||
class Plugin extends \Sabre\CardDAV\Plugin {
|
||||
|
||||
function initialize(Server $server) {
|
||||
$server->on('propFind', [$this, 'propFind']);
|
||||
parent::initialize($server);
|
||||
|
@ -65,11 +64,9 @@ class Plugin extends \Sabre\CardDAV\Plugin {
|
|||
* @return void
|
||||
*/
|
||||
function propFind(PropFind $propFind, INode $node) {
|
||||
|
||||
$ns = '{http://owncloud.org/ns}';
|
||||
|
||||
if ($node instanceof AddressBook) {
|
||||
|
||||
$propFind->handle($ns . 'groups', function () use ($node) {
|
||||
return new Groups($node->getContactsGroups());
|
||||
});
|
||||
|
|
|
@ -225,7 +225,6 @@ class SyncService {
|
|||
* @return string
|
||||
*/
|
||||
private function buildSyncCollectionRequestBody($syncToken) {
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->formatOutput = true;
|
||||
$root = $dom->createElementNS('DAV:', 'd:sync-collection');
|
||||
|
@ -340,6 +339,4 @@ class SyncService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -108,7 +108,6 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
* @return array
|
||||
*/
|
||||
function getACL() {
|
||||
|
||||
$acl = parent::getACL();
|
||||
if ($this->principalUri === 'principals/system/system') {
|
||||
$acl[] = [
|
||||
|
@ -120,5 +119,4 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
|
||||
return $acl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,5 +101,4 @@ class ListCalendars extends Command {
|
|||
$output->writeln("<info>User <$user> has no calendars</info>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,8 +146,7 @@ class MoveCalendar extends Command {
|
|||
* @param string $userDestination
|
||||
* @param bool $force
|
||||
*/
|
||||
private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false)
|
||||
{
|
||||
private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false) {
|
||||
$shares = $this->calDav->getShares($calendar['id']);
|
||||
foreach ($shares as $share) {
|
||||
list(, $prefix, $userOrGroup) = explode('/', $share['href'], 3);
|
||||
|
|
|
@ -192,7 +192,6 @@ class CommentsPlugin extends ServerPlugin {
|
|||
200
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$xml = $this->server->xml->write(
|
||||
|
@ -251,7 +250,4 @@ class CommentsPlugin extends ServerPlugin {
|
|||
throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -123,5 +123,4 @@ class EntityTypeCollection extends RootCollection {
|
|||
function childExists($name) {
|
||||
return call_user_func($this->childExistsFunction, $name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,8 +70,7 @@ class RootCollection implements ICollection {
|
|||
IUserManager $userManager,
|
||||
IUserSession $userSession,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
ILogger $logger)
|
||||
{
|
||||
ILogger $logger) {
|
||||
$this->commentsManager = $commentsManager;
|
||||
$this->logger = $logger;
|
||||
$this->userManager = $userManager;
|
||||
|
|
|
@ -38,7 +38,9 @@ class LegacyDAVACL extends DavAclPlugin {
|
|||
public function getCurrentUserPrincipals() {
|
||||
$principalV2 = $this->getCurrentUserPrincipal();
|
||||
|
||||
if (is_null($principalV2)) return [];
|
||||
if (is_null($principalV2)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$principalV1 = $this->convertPrincipal($principalV2, false);
|
||||
return array_merge(
|
||||
|
|
|
@ -98,7 +98,6 @@ class PublicAuth extends AbstractBasic {
|
|||
|
||||
// check if the share is password protected
|
||||
if ($share->getPassword() !== null) {
|
||||
|
||||
if ($share->getShareType() === IShare::TYPE_LINK
|
||||
|| $share->getShareType() === IShare::TYPE_EMAIL
|
||||
|| $share->getShareType() === IShare::TYPE_CIRCLE) {
|
||||
|
|
|
@ -72,7 +72,6 @@ class AppEnabledPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize(\Sabre\DAV\Server $server) {
|
||||
|
||||
$this->server = $server;
|
||||
$this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ use Sabre\HTTP\RequestInterface;
|
|||
use Sabre\HTTP\ResponseInterface;
|
||||
|
||||
class Auth extends AbstractBasic {
|
||||
|
||||
|
||||
const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND';
|
||||
|
||||
/** @var ISession */
|
||||
|
|
|
@ -64,7 +64,6 @@ class ChecksumList implements XmlSerializable {
|
|||
* @return void
|
||||
*/
|
||||
function xmlSerialize(Writer $writer) {
|
||||
|
||||
foreach ($this->checksums as $checksum) {
|
||||
$writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ use Sabre\DAV\PropFind;
|
|||
use Sabre\DAV\ServerPlugin;
|
||||
|
||||
class CommentPropertiesPlugin extends ServerPlugin {
|
||||
|
||||
const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href';
|
||||
const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count';
|
||||
const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread';
|
||||
|
@ -160,5 +159,4 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -118,7 +118,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
|
|||
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||
*/
|
||||
public function createFile($name, $data = null) {
|
||||
|
||||
try {
|
||||
// for chunked upload also updating a existing file is a "createFile"
|
||||
// because we create all the chunks before re-assemble them to the existing file.
|
||||
|
@ -131,7 +130,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
|
|||
) {
|
||||
throw new \Sabre\DAV\Exception\Forbidden();
|
||||
}
|
||||
|
||||
} else {
|
||||
// For non-chunked upload it is enough to check if we can create a new file
|
||||
if (!$this->fileView->isCreatable($this->path)) {
|
||||
|
@ -293,7 +291,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
|
|||
// TODO: resolve chunk file name here and implement "updateFile"
|
||||
$path = $this->path . '/' . $name;
|
||||
return $this->fileView->file_exists($path);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -304,7 +301,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
|
|||
* @throws \Sabre\DAV\Exception\Forbidden
|
||||
*/
|
||||
public function delete() {
|
||||
|
||||
if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
|
||||
throw new \Sabre\DAV\Exception\Forbidden();
|
||||
}
|
||||
|
|
|
@ -39,9 +39,6 @@ class EntityTooLarge extends \Sabre\DAV\Exception {
|
|||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 413;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace OCA\DAV\Connector\Sabre\Exception;
|
|||
use Exception;
|
||||
|
||||
class FileLocked extends \Sabre\DAV\Exception {
|
||||
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null) {
|
||||
if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
|
||||
$message = sprintf('Target file %s is locked by another process.', $previous->path);
|
||||
|
@ -43,7 +42,6 @@ class FileLocked extends \Sabre\DAV\Exception {
|
|||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 423;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
namespace OCA\DAV\Connector\Sabre\Exception;
|
||||
|
||||
class Forbidden extends \Sabre\DAV\Exception\Forbidden {
|
||||
|
||||
const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace OCA\DAV\Connector\Sabre\Exception;
|
|||
use Sabre\DAV\Exception;
|
||||
|
||||
class InvalidPath extends Exception {
|
||||
|
||||
const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
/**
|
||||
|
@ -50,9 +49,7 @@ class InvalidPath extends Exception {
|
|||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 400;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,5 +73,4 @@ class InvalidPath extends Exception {
|
|||
$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
|
||||
$errorNode->appendChild($error);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ use Sabre\DAV\Exception\NotAuthenticated;
|
|||
use Sabre\DAV\Server;
|
||||
|
||||
class PasswordLoginForbidden extends NotAuthenticated {
|
||||
|
||||
const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
public function getHTTPCode() {
|
||||
|
@ -52,5 +51,4 @@ class PasswordLoginForbidden extends NotAuthenticated {
|
|||
$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
|
||||
$errorNode->appendChild($error);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,9 +39,6 @@ class UnsupportedMediaType extends \Sabre\DAV\Exception {
|
|||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 415;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -103,7 +103,6 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize(\Sabre\DAV\Server $server) {
|
||||
|
||||
$server->on('exception', [$this, 'logException'], 10);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ class FakeLockerPlugin extends ServerPlugin {
|
|||
*/
|
||||
public function fakeLockProvider(RequestInterface $request,
|
||||
ResponseInterface $response) {
|
||||
|
||||
$lockInfo = new LockInfo();
|
||||
$lockInfo->token = md5($request->getPath());
|
||||
$lockInfo->uri = $request->getPath();
|
||||
|
|
|
@ -70,7 +70,6 @@ use Sabre\DAV\Exception\ServiceUnavailable;
|
|||
use Sabre\DAV\IFile;
|
||||
|
||||
class File extends Node implements IFile {
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
|
@ -175,7 +174,6 @@ class File extends Node implements IFile {
|
|||
}
|
||||
|
||||
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
|
||||
|
||||
if (!is_resource($data)) {
|
||||
$tmpData = fopen('php://temp', 'r+');
|
||||
if ($data !== null) {
|
||||
|
@ -199,7 +197,6 @@ class File extends Node implements IFile {
|
|||
$result = feof($wrappedData);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$target = $partStorage->fopen($internalPartPath, 'wb');
|
||||
if ($target === false) {
|
||||
|
@ -230,7 +227,6 @@ class File extends Node implements IFile {
|
|||
throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
|
||||
}
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$context = [];
|
||||
|
||||
|
@ -332,7 +328,6 @@ class File extends Node implements IFile {
|
|||
$this->fileView->putFileInfo($this->path, ['checksum' => '']);
|
||||
$this->refreshInfo();
|
||||
}
|
||||
|
||||
} catch (StorageNotAvailableException $e) {
|
||||
throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,9 @@ class FilesPlugin extends ServerPlugin {
|
|||
function httpGet(RequestInterface $request, ResponseInterface $response) {
|
||||
// Only handle valid files
|
||||
$node = $this->tree->getNodeForPath($request->getPath());
|
||||
if (!($node instanceof IFile)) return;
|
||||
if (!($node instanceof IFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// adds a 'Content-Disposition: attachment' header in case no disposition
|
||||
// header has been set before
|
||||
|
@ -290,7 +292,6 @@ class FilesPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
|
||||
|
||||
$httpRequest = $this->server->httpRequest;
|
||||
|
||||
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
|
||||
|
@ -412,7 +413,6 @@ class FilesPlugin extends ServerPlugin {
|
|||
$propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileInfo()->getUploadTime();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) {
|
||||
|
@ -433,7 +433,6 @@ class FilesPlugin extends ServerPlugin {
|
|||
* @return array
|
||||
*/
|
||||
protected function ncPermissions2ocmPermissions($ncPermissions) {
|
||||
|
||||
$ocmPermissions = [];
|
||||
|
||||
if ($ncPermissions & Constants::PERMISSION_SHARE) {
|
||||
|
@ -450,7 +449,6 @@ class FilesPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
return $ocmPermissions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -151,7 +151,6 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize(\Sabre\DAV\Server $server) {
|
||||
|
||||
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
|
||||
|
||||
$this->server = $server;
|
||||
|
@ -282,7 +281,6 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
if ($filterRule['name'] === $ns . 'favorite') {
|
||||
$favoriteFilter = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($favoriteFilter !== null) {
|
||||
|
|
|
@ -416,5 +416,4 @@ abstract class Node implements \Sabre\DAV\INode {
|
|||
|
||||
return (int)$mtimeFromRequest;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -181,7 +181,6 @@ class ObjectTree extends CachingTree {
|
|||
|
||||
$this->cache[$path] = $node;
|
||||
return $node;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,6 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize(\Sabre\DAV\Server $server) {
|
||||
|
||||
$this->server = $server;
|
||||
|
||||
$server->on('beforeWriteContent', [$this, 'beforeWriteContent'], 10);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue