@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
| 71 | 71 | |
| 72 | 72 | // first time login event setup |
| 73 | - $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 73 | + $dispatcher->addListener(IUser::class.'::firstLogin', function($event) use ($hm) { |
|
| 74 | 74 | if ($event instanceof GenericEvent) { |
| 75 | 75 | $hm->firstLogin($event->getSubject()); |
| 76 | 76 | } |
@@ -43,185 +43,185 @@ |
||
| 43 | 43 | |
| 44 | 44 | class Application extends App { |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Application constructor. |
|
| 48 | - */ |
|
| 49 | - public function __construct() { |
|
| 50 | - parent::__construct('dav'); |
|
| 51 | - |
|
| 52 | - $container = $this->getContainer(); |
|
| 53 | - $server = $container->getServer(); |
|
| 54 | - |
|
| 55 | - $container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) { |
|
| 56 | - return new PhotoCache( |
|
| 57 | - $server->getAppDataDir('dav-photocache'), |
|
| 58 | - $server->getLogger() |
|
| 59 | - ); |
|
| 60 | - }); |
|
| 61 | - |
|
| 62 | - /* |
|
| 46 | + /** |
|
| 47 | + * Application constructor. |
|
| 48 | + */ |
|
| 49 | + public function __construct() { |
|
| 50 | + parent::__construct('dav'); |
|
| 51 | + |
|
| 52 | + $container = $this->getContainer(); |
|
| 53 | + $server = $container->getServer(); |
|
| 54 | + |
|
| 55 | + $container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) { |
|
| 56 | + return new PhotoCache( |
|
| 57 | + $server->getAppDataDir('dav-photocache'), |
|
| 58 | + $server->getLogger() |
|
| 59 | + ); |
|
| 60 | + }); |
|
| 61 | + |
|
| 62 | + /* |
|
| 63 | 63 | * Register capabilities |
| 64 | 64 | */ |
| 65 | - $container->registerCapability(Capabilities::class); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @param IContactsManager $contactsManager |
|
| 70 | - * @param string $userID |
|
| 71 | - */ |
|
| 72 | - public function setupContactsProvider(IContactsManager $contactsManager, $userID) { |
|
| 73 | - /** @var ContactsManager $cm */ |
|
| 74 | - $cm = $this->getContainer()->query(ContactsManager::class); |
|
| 75 | - $urlGenerator = $this->getContainer()->getServer()->getURLGenerator(); |
|
| 76 | - $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @param IManager $contactsManager |
|
| 81 | - */ |
|
| 82 | - public function setupSystemContactsProvider(IContactsManager $contactsManager) { |
|
| 83 | - /** @var ContactsManager $cm */ |
|
| 84 | - $cm = $this->getContainer()->query(ContactsManager::class); |
|
| 85 | - $urlGenerator = $this->getContainer()->getServer()->getURLGenerator(); |
|
| 86 | - $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @param ICalendarManager $calendarManager |
|
| 91 | - * @param string $userId |
|
| 92 | - */ |
|
| 93 | - public function setupCalendarProvider(ICalendarManager $calendarManager, $userId) { |
|
| 94 | - $cm = $this->getContainer()->query(CalendarManager::class); |
|
| 95 | - $cm->setupCalendarProvider($calendarManager, $userId); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - public function registerHooks() { |
|
| 99 | - /** @var HookManager $hm */ |
|
| 100 | - $hm = $this->getContainer()->query(HookManager::class); |
|
| 101 | - $hm->setup(); |
|
| 102 | - |
|
| 103 | - $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 104 | - |
|
| 105 | - // first time login event setup |
|
| 106 | - $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 107 | - if ($event instanceof GenericEvent) { |
|
| 108 | - $hm->firstLogin($event->getSubject()); |
|
| 109 | - } |
|
| 110 | - }); |
|
| 111 | - |
|
| 112 | - // carddav/caldav sync event setup |
|
| 113 | - $listener = function($event) { |
|
| 114 | - if ($event instanceof GenericEvent) { |
|
| 115 | - /** @var BirthdayService $b */ |
|
| 116 | - $b = $this->getContainer()->query(BirthdayService::class); |
|
| 117 | - $b->onCardChanged( |
|
| 118 | - $event->getArgument('addressBookId'), |
|
| 119 | - $event->getArgument('cardUri'), |
|
| 120 | - $event->getArgument('cardData') |
|
| 121 | - ); |
|
| 122 | - } |
|
| 123 | - }; |
|
| 124 | - |
|
| 125 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $listener); |
|
| 126 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $listener); |
|
| 127 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) { |
|
| 128 | - if ($event instanceof GenericEvent) { |
|
| 129 | - /** @var BirthdayService $b */ |
|
| 130 | - $b = $this->getContainer()->query(BirthdayService::class); |
|
| 131 | - $b->onCardDeleted( |
|
| 132 | - $event->getArgument('addressBookId'), |
|
| 133 | - $event->getArgument('cardUri') |
|
| 134 | - ); |
|
| 135 | - } |
|
| 136 | - }); |
|
| 137 | - |
|
| 138 | - $clearPhotoCache = function($event) { |
|
| 139 | - if ($event instanceof GenericEvent) { |
|
| 140 | - /** @var PhotoCache $p */ |
|
| 141 | - $p = $this->getContainer()->query(PhotoCache::class); |
|
| 142 | - $p->delete( |
|
| 143 | - $event->getArgument('addressBookId'), |
|
| 144 | - $event->getArgument('cardUri') |
|
| 145 | - ); |
|
| 146 | - } |
|
| 147 | - }; |
|
| 148 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); |
|
| 149 | - $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); |
|
| 150 | - |
|
| 151 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) { |
|
| 152 | - $user = $event->getSubject(); |
|
| 153 | - $syncService = $this->getContainer()->query(SyncService::class); |
|
| 154 | - $syncService->updateUser($user); |
|
| 155 | - }); |
|
| 156 | - |
|
| 157 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) { |
|
| 158 | - /** @var Backend $backend */ |
|
| 159 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 160 | - $backend->onCalendarAdd( |
|
| 161 | - $event->getArgument('calendarData') |
|
| 162 | - ); |
|
| 163 | - }); |
|
| 164 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) { |
|
| 165 | - /** @var Backend $backend */ |
|
| 166 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 167 | - $backend->onCalendarUpdate( |
|
| 168 | - $event->getArgument('calendarData'), |
|
| 169 | - $event->getArgument('shares'), |
|
| 170 | - $event->getArgument('propertyMutations') |
|
| 171 | - ); |
|
| 172 | - }); |
|
| 173 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) { |
|
| 174 | - /** @var Backend $backend */ |
|
| 175 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 176 | - $backend->onCalendarDelete( |
|
| 177 | - $event->getArgument('calendarData'), |
|
| 178 | - $event->getArgument('shares') |
|
| 179 | - ); |
|
| 180 | - }); |
|
| 181 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) { |
|
| 182 | - /** @var Backend $backend */ |
|
| 183 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 184 | - $backend->onCalendarUpdateShares( |
|
| 185 | - $event->getArgument('calendarData'), |
|
| 186 | - $event->getArgument('shares'), |
|
| 187 | - $event->getArgument('add'), |
|
| 188 | - $event->getArgument('remove') |
|
| 189 | - ); |
|
| 190 | - }); |
|
| 191 | - |
|
| 192 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) { |
|
| 193 | - /** @var Backend $backend */ |
|
| 194 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 195 | - $backend->onCalendarPublication( |
|
| 196 | - $event->getArgument('calendarData'), |
|
| 197 | - $event->getArgument('public') |
|
| 198 | - ); |
|
| 199 | - }); |
|
| 200 | - |
|
| 201 | - $listener = function(GenericEvent $event, $eventName) { |
|
| 202 | - /** @var Backend $backend */ |
|
| 203 | - $backend = $this->getContainer()->query(Backend::class); |
|
| 204 | - |
|
| 205 | - $subject = Event::SUBJECT_OBJECT_ADD; |
|
| 206 | - if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') { |
|
| 207 | - $subject = Event::SUBJECT_OBJECT_UPDATE; |
|
| 208 | - } else if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') { |
|
| 209 | - $subject = Event::SUBJECT_OBJECT_DELETE; |
|
| 210 | - } |
|
| 211 | - $backend->onTouchCalendarObject( |
|
| 212 | - $subject, |
|
| 213 | - $event->getArgument('calendarData'), |
|
| 214 | - $event->getArgument('shares'), |
|
| 215 | - $event->getArgument('objectData') |
|
| 216 | - ); |
|
| 217 | - }; |
|
| 218 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener); |
|
| 219 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener); |
|
| 220 | - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener); |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - public function getSyncService() { |
|
| 224 | - return $this->getContainer()->query(SyncService::class); |
|
| 225 | - } |
|
| 65 | + $container->registerCapability(Capabilities::class); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @param IContactsManager $contactsManager |
|
| 70 | + * @param string $userID |
|
| 71 | + */ |
|
| 72 | + public function setupContactsProvider(IContactsManager $contactsManager, $userID) { |
|
| 73 | + /** @var ContactsManager $cm */ |
|
| 74 | + $cm = $this->getContainer()->query(ContactsManager::class); |
|
| 75 | + $urlGenerator = $this->getContainer()->getServer()->getURLGenerator(); |
|
| 76 | + $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @param IManager $contactsManager |
|
| 81 | + */ |
|
| 82 | + public function setupSystemContactsProvider(IContactsManager $contactsManager) { |
|
| 83 | + /** @var ContactsManager $cm */ |
|
| 84 | + $cm = $this->getContainer()->query(ContactsManager::class); |
|
| 85 | + $urlGenerator = $this->getContainer()->getServer()->getURLGenerator(); |
|
| 86 | + $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @param ICalendarManager $calendarManager |
|
| 91 | + * @param string $userId |
|
| 92 | + */ |
|
| 93 | + public function setupCalendarProvider(ICalendarManager $calendarManager, $userId) { |
|
| 94 | + $cm = $this->getContainer()->query(CalendarManager::class); |
|
| 95 | + $cm->setupCalendarProvider($calendarManager, $userId); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + public function registerHooks() { |
|
| 99 | + /** @var HookManager $hm */ |
|
| 100 | + $hm = $this->getContainer()->query(HookManager::class); |
|
| 101 | + $hm->setup(); |
|
| 102 | + |
|
| 103 | + $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 104 | + |
|
| 105 | + // first time login event setup |
|
| 106 | + $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) { |
|
| 107 | + if ($event instanceof GenericEvent) { |
|
| 108 | + $hm->firstLogin($event->getSubject()); |
|
| 109 | + } |
|
| 110 | + }); |
|
| 111 | + |
|
| 112 | + // carddav/caldav sync event setup |
|
| 113 | + $listener = function($event) { |
|
| 114 | + if ($event instanceof GenericEvent) { |
|
| 115 | + /** @var BirthdayService $b */ |
|
| 116 | + $b = $this->getContainer()->query(BirthdayService::class); |
|
| 117 | + $b->onCardChanged( |
|
| 118 | + $event->getArgument('addressBookId'), |
|
| 119 | + $event->getArgument('cardUri'), |
|
| 120 | + $event->getArgument('cardData') |
|
| 121 | + ); |
|
| 122 | + } |
|
| 123 | + }; |
|
| 124 | + |
|
| 125 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $listener); |
|
| 126 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $listener); |
|
| 127 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) { |
|
| 128 | + if ($event instanceof GenericEvent) { |
|
| 129 | + /** @var BirthdayService $b */ |
|
| 130 | + $b = $this->getContainer()->query(BirthdayService::class); |
|
| 131 | + $b->onCardDeleted( |
|
| 132 | + $event->getArgument('addressBookId'), |
|
| 133 | + $event->getArgument('cardUri') |
|
| 134 | + ); |
|
| 135 | + } |
|
| 136 | + }); |
|
| 137 | + |
|
| 138 | + $clearPhotoCache = function($event) { |
|
| 139 | + if ($event instanceof GenericEvent) { |
|
| 140 | + /** @var PhotoCache $p */ |
|
| 141 | + $p = $this->getContainer()->query(PhotoCache::class); |
|
| 142 | + $p->delete( |
|
| 143 | + $event->getArgument('addressBookId'), |
|
| 144 | + $event->getArgument('cardUri') |
|
| 145 | + ); |
|
| 146 | + } |
|
| 147 | + }; |
|
| 148 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache); |
|
| 149 | + $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache); |
|
| 150 | + |
|
| 151 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) { |
|
| 152 | + $user = $event->getSubject(); |
|
| 153 | + $syncService = $this->getContainer()->query(SyncService::class); |
|
| 154 | + $syncService->updateUser($user); |
|
| 155 | + }); |
|
| 156 | + |
|
| 157 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) { |
|
| 158 | + /** @var Backend $backend */ |
|
| 159 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 160 | + $backend->onCalendarAdd( |
|
| 161 | + $event->getArgument('calendarData') |
|
| 162 | + ); |
|
| 163 | + }); |
|
| 164 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) { |
|
| 165 | + /** @var Backend $backend */ |
|
| 166 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 167 | + $backend->onCalendarUpdate( |
|
| 168 | + $event->getArgument('calendarData'), |
|
| 169 | + $event->getArgument('shares'), |
|
| 170 | + $event->getArgument('propertyMutations') |
|
| 171 | + ); |
|
| 172 | + }); |
|
| 173 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) { |
|
| 174 | + /** @var Backend $backend */ |
|
| 175 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 176 | + $backend->onCalendarDelete( |
|
| 177 | + $event->getArgument('calendarData'), |
|
| 178 | + $event->getArgument('shares') |
|
| 179 | + ); |
|
| 180 | + }); |
|
| 181 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) { |
|
| 182 | + /** @var Backend $backend */ |
|
| 183 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 184 | + $backend->onCalendarUpdateShares( |
|
| 185 | + $event->getArgument('calendarData'), |
|
| 186 | + $event->getArgument('shares'), |
|
| 187 | + $event->getArgument('add'), |
|
| 188 | + $event->getArgument('remove') |
|
| 189 | + ); |
|
| 190 | + }); |
|
| 191 | + |
|
| 192 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) { |
|
| 193 | + /** @var Backend $backend */ |
|
| 194 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 195 | + $backend->onCalendarPublication( |
|
| 196 | + $event->getArgument('calendarData'), |
|
| 197 | + $event->getArgument('public') |
|
| 198 | + ); |
|
| 199 | + }); |
|
| 200 | + |
|
| 201 | + $listener = function(GenericEvent $event, $eventName) { |
|
| 202 | + /** @var Backend $backend */ |
|
| 203 | + $backend = $this->getContainer()->query(Backend::class); |
|
| 204 | + |
|
| 205 | + $subject = Event::SUBJECT_OBJECT_ADD; |
|
| 206 | + if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') { |
|
| 207 | + $subject = Event::SUBJECT_OBJECT_UPDATE; |
|
| 208 | + } else if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') { |
|
| 209 | + $subject = Event::SUBJECT_OBJECT_DELETE; |
|
| 210 | + } |
|
| 211 | + $backend->onTouchCalendarObject( |
|
| 212 | + $subject, |
|
| 213 | + $event->getArgument('calendarData'), |
|
| 214 | + $event->getArgument('shares'), |
|
| 215 | + $event->getArgument('objectData') |
|
| 216 | + ); |
|
| 217 | + }; |
|
| 218 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener); |
|
| 219 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener); |
|
| 220 | + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener); |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + public function getSyncService() { |
|
| 224 | + return $this->getContainer()->query(SyncService::class); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | } |
@@ -28,35 +28,35 @@ |
||
| 28 | 28 | |
| 29 | 29 | class FixBirthdayCalendarComponent implements IRepairStep { |
| 30 | 30 | |
| 31 | - /** @var IDBConnection */ |
|
| 32 | - private $connection; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * FixBirthdayCalendarComponent constructor. |
|
| 36 | - * |
|
| 37 | - * @param IDBConnection $connection |
|
| 38 | - */ |
|
| 39 | - public function __construct(IDBConnection $connection) { |
|
| 40 | - $this->connection = $connection; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @inheritdoc |
|
| 45 | - */ |
|
| 46 | - public function getName() { |
|
| 47 | - return 'Fix component of birthday calendars'; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @inheritdoc |
|
| 52 | - */ |
|
| 53 | - public function run(IOutput $output) { |
|
| 54 | - $query = $this->connection->getQueryBuilder(); |
|
| 55 | - $updated = $query->update('calendars') |
|
| 56 | - ->set('components', $query->createNamedParameter('VEVENT')) |
|
| 57 | - ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 58 | - ->execute(); |
|
| 59 | - |
|
| 60 | - $output->info("$updated birthday calendars updated."); |
|
| 61 | - } |
|
| 31 | + /** @var IDBConnection */ |
|
| 32 | + private $connection; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * FixBirthdayCalendarComponent constructor. |
|
| 36 | + * |
|
| 37 | + * @param IDBConnection $connection |
|
| 38 | + */ |
|
| 39 | + public function __construct(IDBConnection $connection) { |
|
| 40 | + $this->connection = $connection; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @inheritdoc |
|
| 45 | + */ |
|
| 46 | + public function getName() { |
|
| 47 | + return 'Fix component of birthday calendars'; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @inheritdoc |
|
| 52 | + */ |
|
| 53 | + public function run(IOutput $output) { |
|
| 54 | + $query = $this->connection->getQueryBuilder(); |
|
| 55 | + $updated = $query->update('calendars') |
|
| 56 | + ->set('components', $query->createNamedParameter('VEVENT')) |
|
| 57 | + ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 58 | + ->execute(); |
|
| 59 | + |
|
| 60 | + $output->info("$updated birthday calendars updated."); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -31,36 +31,36 @@ |
||
| 31 | 31 | |
| 32 | 32 | class SyncSystemAddressBook extends Command { |
| 33 | 33 | |
| 34 | - /** @var SyncService */ |
|
| 35 | - private $syncService; |
|
| 34 | + /** @var SyncService */ |
|
| 35 | + private $syncService; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param SyncService $syncService |
|
| 39 | - */ |
|
| 40 | - function __construct(SyncService $syncService) { |
|
| 41 | - parent::__construct(); |
|
| 42 | - $this->syncService = $syncService; |
|
| 43 | - } |
|
| 37 | + /** |
|
| 38 | + * @param SyncService $syncService |
|
| 39 | + */ |
|
| 40 | + function __construct(SyncService $syncService) { |
|
| 41 | + parent::__construct(); |
|
| 42 | + $this->syncService = $syncService; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - protected function configure() { |
|
| 46 | - $this |
|
| 47 | - ->setName('dav:sync-system-addressbook') |
|
| 48 | - ->setDescription('Synchronizes users to the system addressbook'); |
|
| 49 | - } |
|
| 45 | + protected function configure() { |
|
| 46 | + $this |
|
| 47 | + ->setName('dav:sync-system-addressbook') |
|
| 48 | + ->setDescription('Synchronizes users to the system addressbook'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param InputInterface $input |
|
| 53 | - * @param OutputInterface $output |
|
| 54 | - */ |
|
| 55 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 56 | - $output->writeln('Syncing users ...'); |
|
| 57 | - $progress = new ProgressBar($output); |
|
| 58 | - $progress->start(); |
|
| 59 | - $this->syncService->syncInstance(function() use ($progress) { |
|
| 60 | - $progress->advance(); |
|
| 61 | - }); |
|
| 51 | + /** |
|
| 52 | + * @param InputInterface $input |
|
| 53 | + * @param OutputInterface $output |
|
| 54 | + */ |
|
| 55 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 56 | + $output->writeln('Syncing users ...'); |
|
| 57 | + $progress = new ProgressBar($output); |
|
| 58 | + $progress->start(); |
|
| 59 | + $this->syncService->syncInstance(function() use ($progress) { |
|
| 60 | + $progress->advance(); |
|
| 61 | + }); |
|
| 62 | 62 | |
| 63 | - $progress->finish(); |
|
| 64 | - $output->writeln(''); |
|
| 65 | - } |
|
| 63 | + $progress->finish(); |
|
| 64 | + $output->writeln(''); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -36,43 +36,43 @@ |
||
| 36 | 36 | |
| 37 | 37 | class CreateAddressBook extends Command { |
| 38 | 38 | |
| 39 | - /** @var IUserManager */ |
|
| 40 | - private $userManager; |
|
| 39 | + /** @var IUserManager */ |
|
| 40 | + private $userManager; |
|
| 41 | 41 | |
| 42 | - /** @var CardDavBackend */ |
|
| 43 | - private $cardDavBackend; |
|
| 42 | + /** @var CardDavBackend */ |
|
| 43 | + private $cardDavBackend; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param IUserManager $userManager |
|
| 47 | - * @param CardDavBackend $cardDavBackend |
|
| 48 | - */ |
|
| 49 | - function __construct(IUserManager $userManager, |
|
| 50 | - CardDavBackend $cardDavBackend |
|
| 51 | - ) { |
|
| 52 | - parent::__construct(); |
|
| 53 | - $this->userManager = $userManager; |
|
| 54 | - $this->cardDavBackend = $cardDavBackend; |
|
| 55 | - } |
|
| 45 | + /** |
|
| 46 | + * @param IUserManager $userManager |
|
| 47 | + * @param CardDavBackend $cardDavBackend |
|
| 48 | + */ |
|
| 49 | + function __construct(IUserManager $userManager, |
|
| 50 | + CardDavBackend $cardDavBackend |
|
| 51 | + ) { |
|
| 52 | + parent::__construct(); |
|
| 53 | + $this->userManager = $userManager; |
|
| 54 | + $this->cardDavBackend = $cardDavBackend; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - protected function configure() { |
|
| 58 | - $this |
|
| 59 | - ->setName('dav:create-addressbook') |
|
| 60 | - ->setDescription('Create a dav addressbook') |
|
| 61 | - ->addArgument('user', |
|
| 62 | - InputArgument::REQUIRED, |
|
| 63 | - 'User for whom the addressbook will be created') |
|
| 64 | - ->addArgument('name', |
|
| 65 | - InputArgument::REQUIRED, |
|
| 66 | - 'Name of the addressbook'); |
|
| 67 | - } |
|
| 57 | + protected function configure() { |
|
| 58 | + $this |
|
| 59 | + ->setName('dav:create-addressbook') |
|
| 60 | + ->setDescription('Create a dav addressbook') |
|
| 61 | + ->addArgument('user', |
|
| 62 | + InputArgument::REQUIRED, |
|
| 63 | + 'User for whom the addressbook will be created') |
|
| 64 | + ->addArgument('name', |
|
| 65 | + InputArgument::REQUIRED, |
|
| 66 | + 'Name of the addressbook'); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 70 | - $user = $input->getArgument('user'); |
|
| 71 | - if (!$this->userManager->userExists($user)) { |
|
| 72 | - throw new \InvalidArgumentException("User <$user> in unknown."); |
|
| 73 | - } |
|
| 69 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 70 | + $user = $input->getArgument('user'); |
|
| 71 | + if (!$this->userManager->userExists($user)) { |
|
| 72 | + throw new \InvalidArgumentException("User <$user> in unknown."); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $name = $input->getArgument('name'); |
|
| 76 | - $this->cardDavBackend->createAddressBook("principals/users/$user", $name, []); |
|
| 77 | - } |
|
| 75 | + $name = $input->getArgument('name'); |
|
| 76 | + $this->cardDavBackend->createAddressBook("principals/users/$user", $name, []); |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | |
| 27 | 27 | class Capabilities implements ICapability { |
| 28 | 28 | |
| 29 | - public function getCapabilities() { |
|
| 30 | - return [ |
|
| 31 | - 'dav' => [ |
|
| 32 | - 'chunking' => '1.0', |
|
| 33 | - ] |
|
| 34 | - ]; |
|
| 35 | - } |
|
| 29 | + public function getCapabilities() { |
|
| 30 | + return [ |
|
| 31 | + 'dav' => [ |
|
| 32 | + 'chunking' => '1.0', |
|
| 33 | + ] |
|
| 34 | + ]; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -31,78 +31,78 @@ |
||
| 31 | 31 | use Sabre\DAV\ServerPlugin; |
| 32 | 32 | |
| 33 | 33 | class BrowserErrorPagePlugin extends ServerPlugin { |
| 34 | - /** @var Server */ |
|
| 35 | - private $server; |
|
| 34 | + /** @var Server */ |
|
| 35 | + private $server; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * This initializes the plugin. |
|
| 39 | - * |
|
| 40 | - * This function is called by Sabre\DAV\Server, after |
|
| 41 | - * addPlugin is called. |
|
| 42 | - * |
|
| 43 | - * This method should set up the required event subscriptions. |
|
| 44 | - * |
|
| 45 | - * @param Server $server |
|
| 46 | - * @return void |
|
| 47 | - */ |
|
| 48 | - function initialize(Server $server) { |
|
| 49 | - $this->server = $server; |
|
| 50 | - $server->on('exception', array($this, 'logException'), 1000); |
|
| 51 | - } |
|
| 37 | + /** |
|
| 38 | + * This initializes the plugin. |
|
| 39 | + * |
|
| 40 | + * This function is called by Sabre\DAV\Server, after |
|
| 41 | + * addPlugin is called. |
|
| 42 | + * |
|
| 43 | + * This method should set up the required event subscriptions. |
|
| 44 | + * |
|
| 45 | + * @param Server $server |
|
| 46 | + * @return void |
|
| 47 | + */ |
|
| 48 | + function initialize(Server $server) { |
|
| 49 | + $this->server = $server; |
|
| 50 | + $server->on('exception', array($this, 'logException'), 1000); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @param IRequest $request |
|
| 55 | - * @return bool |
|
| 56 | - */ |
|
| 57 | - public static function isBrowserRequest(IRequest $request) { |
|
| 58 | - if ($request->getMethod() !== 'GET') { |
|
| 59 | - return false; |
|
| 60 | - } |
|
| 61 | - return $request->isUserAgent([ |
|
| 62 | - Request::USER_AGENT_IE, |
|
| 63 | - Request::USER_AGENT_MS_EDGE, |
|
| 64 | - Request::USER_AGENT_CHROME, |
|
| 65 | - Request::USER_AGENT_FIREFOX, |
|
| 66 | - Request::USER_AGENT_SAFARI, |
|
| 67 | - ]); |
|
| 68 | - } |
|
| 53 | + /** |
|
| 54 | + * @param IRequest $request |
|
| 55 | + * @return bool |
|
| 56 | + */ |
|
| 57 | + public static function isBrowserRequest(IRequest $request) { |
|
| 58 | + if ($request->getMethod() !== 'GET') { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 61 | + return $request->isUserAgent([ |
|
| 62 | + Request::USER_AGENT_IE, |
|
| 63 | + Request::USER_AGENT_MS_EDGE, |
|
| 64 | + Request::USER_AGENT_CHROME, |
|
| 65 | + Request::USER_AGENT_FIREFOX, |
|
| 66 | + Request::USER_AGENT_SAFARI, |
|
| 67 | + ]); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @param \Exception $ex |
|
| 72 | - */ |
|
| 73 | - public function logException(\Exception $ex) { |
|
| 74 | - if ($ex instanceof Exception) { |
|
| 75 | - $httpCode = $ex->getHTTPCode(); |
|
| 76 | - $headers = $ex->getHTTPHeaders($this->server); |
|
| 77 | - } else { |
|
| 78 | - $httpCode = 500; |
|
| 79 | - $headers = []; |
|
| 80 | - } |
|
| 81 | - $this->server->httpResponse->addHeaders($headers); |
|
| 82 | - $this->server->httpResponse->setStatus($httpCode); |
|
| 83 | - $body = $this->generateBody(); |
|
| 84 | - $this->server->httpResponse->setBody($body); |
|
| 85 | - $this->sendResponse(); |
|
| 86 | - } |
|
| 70 | + /** |
|
| 71 | + * @param \Exception $ex |
|
| 72 | + */ |
|
| 73 | + public function logException(\Exception $ex) { |
|
| 74 | + if ($ex instanceof Exception) { |
|
| 75 | + $httpCode = $ex->getHTTPCode(); |
|
| 76 | + $headers = $ex->getHTTPHeaders($this->server); |
|
| 77 | + } else { |
|
| 78 | + $httpCode = 500; |
|
| 79 | + $headers = []; |
|
| 80 | + } |
|
| 81 | + $this->server->httpResponse->addHeaders($headers); |
|
| 82 | + $this->server->httpResponse->setStatus($httpCode); |
|
| 83 | + $body = $this->generateBody(); |
|
| 84 | + $this->server->httpResponse->setBody($body); |
|
| 85 | + $this->sendResponse(); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * @codeCoverageIgnore |
|
| 90 | - * @return bool|string |
|
| 91 | - */ |
|
| 92 | - public function generateBody() { |
|
| 93 | - $request = \OC::$server->getRequest(); |
|
| 94 | - $content = new OC_Template('dav', 'exception', 'guest'); |
|
| 95 | - $content->assign('title', $this->server->httpResponse->getStatusText()); |
|
| 96 | - $content->assign('remoteAddr', $request->getRemoteAddress()); |
|
| 97 | - $content->assign('requestID', $request->getId()); |
|
| 98 | - return $content->fetchPage(); |
|
| 99 | - } |
|
| 88 | + /** |
|
| 89 | + * @codeCoverageIgnore |
|
| 90 | + * @return bool|string |
|
| 91 | + */ |
|
| 92 | + public function generateBody() { |
|
| 93 | + $request = \OC::$server->getRequest(); |
|
| 94 | + $content = new OC_Template('dav', 'exception', 'guest'); |
|
| 95 | + $content->assign('title', $this->server->httpResponse->getStatusText()); |
|
| 96 | + $content->assign('remoteAddr', $request->getRemoteAddress()); |
|
| 97 | + $content->assign('requestID', $request->getId()); |
|
| 98 | + return $content->fetchPage(); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * @codeCoverageIgnore |
|
| 103 | - */ |
|
| 104 | - public function sendResponse() { |
|
| 105 | - $this->server->sapi->sendResponse($this->server->httpResponse); |
|
| 106 | - exit(); |
|
| 107 | - } |
|
| 101 | + /** |
|
| 102 | + * @codeCoverageIgnore |
|
| 103 | + */ |
|
| 104 | + public function sendResponse() { |
|
| 105 | + $this->server->sapi->sendResponse($this->server->httpResponse); |
|
| 106 | + exit(); |
|
| 107 | + } |
|
| 108 | 108 | } |
@@ -32,33 +32,33 @@ |
||
| 32 | 32 | * Verify that the public link share is valid |
| 33 | 33 | */ |
| 34 | 34 | class PublicLinkCheckPlugin extends ServerPlugin { |
| 35 | - /** |
|
| 36 | - * @var FileInfo |
|
| 37 | - */ |
|
| 38 | - private $fileInfo; |
|
| 35 | + /** |
|
| 36 | + * @var FileInfo |
|
| 37 | + */ |
|
| 38 | + private $fileInfo; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param FileInfo $fileInfo |
|
| 42 | - */ |
|
| 43 | - public function setFileInfo($fileInfo) { |
|
| 44 | - $this->fileInfo = $fileInfo; |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * @param FileInfo $fileInfo |
|
| 42 | + */ |
|
| 43 | + public function setFileInfo($fileInfo) { |
|
| 44 | + $this->fileInfo = $fileInfo; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * This initializes the plugin. |
|
| 49 | - * |
|
| 50 | - * @param \Sabre\DAV\Server $server Sabre server |
|
| 51 | - * |
|
| 52 | - * @return void |
|
| 53 | - */ |
|
| 54 | - public function initialize(\Sabre\DAV\Server $server) { |
|
| 55 | - $server->on('beforeMethod', [$this, 'beforeMethod']); |
|
| 56 | - } |
|
| 47 | + /** |
|
| 48 | + * This initializes the plugin. |
|
| 49 | + * |
|
| 50 | + * @param \Sabre\DAV\Server $server Sabre server |
|
| 51 | + * |
|
| 52 | + * @return void |
|
| 53 | + */ |
|
| 54 | + public function initialize(\Sabre\DAV\Server $server) { |
|
| 55 | + $server->on('beforeMethod', [$this, 'beforeMethod']); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 59 | - // verify that the owner didn't have his share permissions revoked |
|
| 60 | - if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
|
| 61 | - throw new NotFound(); |
|
| 62 | - } |
|
| 63 | - } |
|
| 58 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 59 | + // verify that the owner didn't have his share permissions revoked |
|
| 60 | + if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
|
| 61 | + throw new NotFound(); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $server->on('beforeMethod', [$this, 'beforeMethod']); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 58 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
| 59 | 59 | // verify that the owner didn't have his share permissions revoked |
| 60 | 60 | if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
| 61 | 61 | throw new NotFound(); |
@@ -33,52 +33,52 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class FilesDropPlugin extends ServerPlugin { |
| 35 | 35 | |
| 36 | - /** @var View */ |
|
| 37 | - private $view; |
|
| 36 | + /** @var View */ |
|
| 37 | + private $view; |
|
| 38 | 38 | |
| 39 | - /** @var bool */ |
|
| 40 | - private $enabled = false; |
|
| 39 | + /** @var bool */ |
|
| 40 | + private $enabled = false; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param View $view |
|
| 44 | - */ |
|
| 45 | - public function setView($view) { |
|
| 46 | - $this->view = $view; |
|
| 47 | - } |
|
| 42 | + /** |
|
| 43 | + * @param View $view |
|
| 44 | + */ |
|
| 45 | + public function setView($view) { |
|
| 46 | + $this->view = $view; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function enable() { |
|
| 50 | - $this->enabled = true; |
|
| 51 | - } |
|
| 49 | + public function enable() { |
|
| 50 | + $this->enabled = true; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * This initializes the plugin. |
|
| 56 | - * |
|
| 57 | - * @param \Sabre\DAV\Server $server Sabre server |
|
| 58 | - * |
|
| 59 | - * @return void |
|
| 60 | - * @throws MethodNotAllowed |
|
| 61 | - */ |
|
| 62 | - public function initialize(\Sabre\DAV\Server $server) { |
|
| 63 | - $server->on('beforeMethod', [$this, 'beforeMethod'], 999); |
|
| 64 | - $this->enabled = false; |
|
| 65 | - } |
|
| 54 | + /** |
|
| 55 | + * This initializes the plugin. |
|
| 56 | + * |
|
| 57 | + * @param \Sabre\DAV\Server $server Sabre server |
|
| 58 | + * |
|
| 59 | + * @return void |
|
| 60 | + * @throws MethodNotAllowed |
|
| 61 | + */ |
|
| 62 | + public function initialize(\Sabre\DAV\Server $server) { |
|
| 63 | + $server->on('beforeMethod', [$this, 'beforeMethod'], 999); |
|
| 64 | + $this->enabled = false; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 67 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 68 | 68 | |
| 69 | - if (!$this->enabled) { |
|
| 70 | - return; |
|
| 71 | - } |
|
| 69 | + if (!$this->enabled) { |
|
| 70 | + return; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ($request->getMethod() !== 'PUT') { |
|
| 74 | - throw new MethodNotAllowed('Only PUT is allowed on files drop'); |
|
| 75 | - } |
|
| 73 | + if ($request->getMethod() !== 'PUT') { |
|
| 74 | + throw new MethodNotAllowed('Only PUT is allowed on files drop'); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $path = explode('/', $request->getPath()); |
|
| 78 | - $path = array_pop($path); |
|
| 77 | + $path = explode('/', $request->getPath()); |
|
| 78 | + $path = array_pop($path); |
|
| 79 | 79 | |
| 80 | - $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
|
| 81 | - $url = $request->getBaseUrl() . $newName; |
|
| 82 | - $request->setUrl($url); |
|
| 83 | - } |
|
| 80 | + $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
|
| 81 | + $url = $request->getBaseUrl() . $newName; |
|
| 82 | + $request->setUrl($url); |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->enabled = false; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
| 67 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
| 68 | 68 | |
| 69 | 69 | if (!$this->enabled) { |
| 70 | 70 | return; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $path = array_pop($path); |
| 79 | 79 | |
| 80 | 80 | $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view); |
| 81 | - $url = $request->getBaseUrl() . $newName; |
|
| 81 | + $url = $request->getBaseUrl().$newName; |
|
| 82 | 82 | $request->setUrl($url); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -28,54 +28,54 @@ |
||
| 28 | 28 | |
| 29 | 29 | class UploadFolder implements ICollection { |
| 30 | 30 | |
| 31 | - private $node; |
|
| 31 | + private $node; |
|
| 32 | 32 | |
| 33 | - function __construct(Directory $node) { |
|
| 34 | - $this->node = $node; |
|
| 35 | - } |
|
| 33 | + function __construct(Directory $node) { |
|
| 34 | + $this->node = $node; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - function createFile($name, $data = null) { |
|
| 38 | - // TODO: verify name - should be a simple number |
|
| 39 | - $this->node->createFile($name, $data); |
|
| 40 | - } |
|
| 37 | + function createFile($name, $data = null) { |
|
| 38 | + // TODO: verify name - should be a simple number |
|
| 39 | + $this->node->createFile($name, $data); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - function createDirectory($name) { |
|
| 43 | - throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
| 44 | - } |
|
| 42 | + function createDirectory($name) { |
|
| 43 | + throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - function getChild($name) { |
|
| 47 | - if ($name === '.file') { |
|
| 48 | - return new FutureFile($this->node, '.file'); |
|
| 49 | - } |
|
| 50 | - return $this->node->getChild($name); |
|
| 51 | - } |
|
| 46 | + function getChild($name) { |
|
| 47 | + if ($name === '.file') { |
|
| 48 | + return new FutureFile($this->node, '.file'); |
|
| 49 | + } |
|
| 50 | + return $this->node->getChild($name); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - function getChildren() { |
|
| 54 | - $children = $this->node->getChildren(); |
|
| 55 | - $children[] = new FutureFile($this->node, '.file'); |
|
| 56 | - return $children; |
|
| 57 | - } |
|
| 53 | + function getChildren() { |
|
| 54 | + $children = $this->node->getChildren(); |
|
| 55 | + $children[] = new FutureFile($this->node, '.file'); |
|
| 56 | + return $children; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - function childExists($name) { |
|
| 60 | - if ($name === '.file') { |
|
| 61 | - return true; |
|
| 62 | - } |
|
| 63 | - return $this->node->childExists($name); |
|
| 64 | - } |
|
| 59 | + function childExists($name) { |
|
| 60 | + if ($name === '.file') { |
|
| 61 | + return true; |
|
| 62 | + } |
|
| 63 | + return $this->node->childExists($name); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - function delete() { |
|
| 67 | - $this->node->delete(); |
|
| 68 | - } |
|
| 66 | + function delete() { |
|
| 67 | + $this->node->delete(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - function getName() { |
|
| 71 | - return $this->node->getName(); |
|
| 72 | - } |
|
| 70 | + function getName() { |
|
| 71 | + return $this->node->getName(); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - function setName($name) { |
|
| 75 | - throw new Forbidden('Permission denied to rename this folder'); |
|
| 76 | - } |
|
| 74 | + function setName($name) { |
|
| 75 | + throw new Forbidden('Permission denied to rename this folder'); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - function getLastModified() { |
|
| 79 | - return $this->node->getLastModified(); |
|
| 80 | - } |
|
| 78 | + function getLastModified() { |
|
| 79 | + return $this->node->getLastModified(); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function createDirectory($name) { |
| 43 | - throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
| 43 | + throw new Forbidden('Permission denied to create file (filename '.$name.')'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | function getChild($name) { |