Loading lib/Dav/BeforeCreateFilePlugin.php +18 −28 Original line number Diff line number Diff line Loading @@ -53,15 +53,11 @@ class BeforeCreateFilePlugin extends ServerPlugin { /** * Assign a Nextcloud Talk room URL as the event location * * @param string $uri target file URI * @param resource $data data * @param INode $parent Sabre Node * @param bool $modified modified * @return * */ public function beforeCreateFile($uri, &$data, INode $parent, &$modified) { $this->logger->debug('beforeCreateFile fired', ['app' => 'calendar', 'uri' => $uri]); public function checkAndProcessData(&$data) { if (is_resource($data)) { $data = stream_get_contents($data); } Loading @@ -70,15 +66,24 @@ class BeforeCreateFilePlugin extends ServerPlugin { $vCalendar = Reader::read($data); } catch (\Exception $e) { // The data is not a valid vCalendar object. $this->logger->debug('beforeCreateFile: payload is not valid vCalendar, skipping', [ 'app' => 'calendar', 'uri' => $uri, 'exception' => $e, ]); return; } $this->processEventData($data, $vCalendar); } /** * Assign a Nextcloud Talk room URL as the event location * * @param string $uri target file URI * @param resource $data data * @param INode $parent Sabre Node * @param bool $modified modified * @return */ public function beforeCreateFile($uri, &$data, INode $parent, &$modified) { $this->logger->debug('beforeCreateFile fired', ['app' => 'calendar', 'uri' => $uri]); $this->checkAndProcessData($data); } /** Loading @@ -93,22 +98,7 @@ class BeforeCreateFilePlugin extends ServerPlugin { public function beforeWriteContent($uri, INode $parent, &$data, &$modified) { $this->logger->debug('beforeWriteContent fired', ['app' => 'calendar', 'uri' => $uri]); if (is_resource($data)) { $data = stream_get_contents($data); } // Parse the data as a vCalendar object using Sabre\VObject. try { $vCalendar = Reader::read($data); } catch (\Exception $e) { // The data is not a valid vCalendar object. $this->logger->debug('beforeWriteContent: payload is not valid vCalendar, skipping', [ 'app' => 'calendar', 'uri' => $uri, 'exception' => $e, ]); return; } $this->processEventData($data, $vCalendar); $this->checkAndProcessData($data); } /** Loading Loading
lib/Dav/BeforeCreateFilePlugin.php +18 −28 Original line number Diff line number Diff line Loading @@ -53,15 +53,11 @@ class BeforeCreateFilePlugin extends ServerPlugin { /** * Assign a Nextcloud Talk room URL as the event location * * @param string $uri target file URI * @param resource $data data * @param INode $parent Sabre Node * @param bool $modified modified * @return * */ public function beforeCreateFile($uri, &$data, INode $parent, &$modified) { $this->logger->debug('beforeCreateFile fired', ['app' => 'calendar', 'uri' => $uri]); public function checkAndProcessData(&$data) { if (is_resource($data)) { $data = stream_get_contents($data); } Loading @@ -70,15 +66,24 @@ class BeforeCreateFilePlugin extends ServerPlugin { $vCalendar = Reader::read($data); } catch (\Exception $e) { // The data is not a valid vCalendar object. $this->logger->debug('beforeCreateFile: payload is not valid vCalendar, skipping', [ 'app' => 'calendar', 'uri' => $uri, 'exception' => $e, ]); return; } $this->processEventData($data, $vCalendar); } /** * Assign a Nextcloud Talk room URL as the event location * * @param string $uri target file URI * @param resource $data data * @param INode $parent Sabre Node * @param bool $modified modified * @return */ public function beforeCreateFile($uri, &$data, INode $parent, &$modified) { $this->logger->debug('beforeCreateFile fired', ['app' => 'calendar', 'uri' => $uri]); $this->checkAndProcessData($data); } /** Loading @@ -93,22 +98,7 @@ class BeforeCreateFilePlugin extends ServerPlugin { public function beforeWriteContent($uri, INode $parent, &$data, &$modified) { $this->logger->debug('beforeWriteContent fired', ['app' => 'calendar', 'uri' => $uri]); if (is_resource($data)) { $data = stream_get_contents($data); } // Parse the data as a vCalendar object using Sabre\VObject. try { $vCalendar = Reader::read($data); } catch (\Exception $e) { // The data is not a valid vCalendar object. $this->logger->debug('beforeWriteContent: payload is not valid vCalendar, skipping', [ 'app' => 'calendar', 'uri' => $uri, 'exception' => $e, ]); return; } $this->processEventData($data, $vCalendar); $this->checkAndProcessData($data); } /** Loading