Revert "utilize elementMap for parsing DateTime string input argument for REPORT method"

This reverts commit 2027bf2686.
This commit is contained in:
Arthur Schiwon 2016-01-26 13:04:41 +01:00
parent 49c8f3d6e4
commit 8afa39682c
1 changed files with 6 additions and 8 deletions

View File

@ -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 = [];