From 8afa39682c2b637b35fd3722a5aa7e443878fb65 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 26 Jan 2016 13:04:41 +0100 Subject: [PATCH] Revert "utilize elementMap for parsing DateTime string input argument for REPORT method" This reverts commit 2027bf2686ee077fb2ad65f7a91f920c96b3fd85. --- apps/dav/lib/comments/commentsplugin.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/dav/lib/comments/commentsplugin.php b/apps/dav/lib/comments/commentsplugin.php index 15f4aae3ae..2f9b7bab59 100644 --- a/apps/dav/lib/comments/commentsplugin.php +++ b/apps/dav/lib/comments/commentsplugin.php @@ -34,7 +34,6 @@ use Sabre\DAV\Xml\Element\Response; use Sabre\DAV\Xml\Response\MultiStatus; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; -use Sabre\Xml\Reader; use Sabre\Xml\Writer; /** @@ -46,7 +45,7 @@ class CommentsPlugin extends ServerPlugin { const REPORT_PARAM_LIMIT = '{http://owncloud.org/ns}limit'; const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset'; - const REPORT_PARAM_DATETIME = '{http://owncloud.org/ns}datetime'; + const REPORT_PARAM_TIMESTAMP = '{http://owncloud.org/ns}datetime'; /** @var ICommentsManager */ protected $commentsManager; @@ -91,11 +90,6 @@ class CommentsPlugin extends ServerPlugin { $writer->write($value->format('Y-m-d H:m:i')); }; - $this->server->xml->elementMap[self::REPORT_PARAM_DATETIME] = function(Reader $reader) { - $element = $reader->parseInnerTree(); - return empty($element) ? null : new \DateTime($element); - }; - $this->server->on('report', [$this, 'onReport']); $this->server->on('method:POST', [$this, 'httpPost']); } @@ -149,7 +143,7 @@ class CommentsPlugin extends ServerPlugin { $acceptableParameters = [ $this::REPORT_PARAM_LIMIT, $this::REPORT_PARAM_OFFSET, - $this::REPORT_PARAM_DATETIME + $this::REPORT_PARAM_TIMESTAMP ]; $ns = '{' . $this::NS_OWNCLOUD . '}'; foreach($report as $parameter) { @@ -159,6 +153,10 @@ class CommentsPlugin extends ServerPlugin { $args[str_replace($ns, '', $parameter['name'])] = $parameter['value']; } + if(!is_null($args['datetime'])) { + $args['datetime'] = new \DateTime($args['datetime']); + } + $results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']); $responses = [];