mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-04 01:54:07 +02:00
minor fixes
This commit is contained in:
parent
d3eb42cd90
commit
acb32ab84d
15 changed files with 60 additions and 47 deletions
|
|
@ -97,12 +97,7 @@ class DiscoverHandler {
|
|||
foreach ($propertyDefinitions as $propertyDefinition) {
|
||||
$key = $this->hashDefinition($propertyDefinition);
|
||||
if (!isset($groups[$key])) {
|
||||
$desc = new PropDesc();
|
||||
$desc->dataType = $propertyDefinition->dataType;
|
||||
$desc->sortable = $propertyDefinition->sortable;
|
||||
$desc->selectable = $propertyDefinition->selectable;
|
||||
$desc->searchable = $propertyDefinition->searchable;
|
||||
$groups[$key] = $desc;
|
||||
$groups[$key] = new PropDesc($propertyDefinition);
|
||||
}
|
||||
$groups[$key]->properties[] = $propertyDefinition->name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ use SearchDAV\XML\Literal;
|
|||
use SearchDAV\XML\Operator;
|
||||
use SearchDAV\XML\Order;
|
||||
use SearchDAV\XML\Scope;
|
||||
use function Sabre\Xml\Deserializer\keyValue;
|
||||
use function Sabre\Xml\Deserializer\repeatingElements;
|
||||
|
||||
class QueryParser extends Service {
|
||||
public $namespaceMap = [
|
||||
|
|
@ -46,13 +48,13 @@ class QueryParser extends Service {
|
|||
'{DAV:}query-schema-discovery' => Element\KeyValue::class,
|
||||
'{DAV:}basicsearch' => BasicSearch::class,
|
||||
'{DAV:}select' => function (Reader $reader) {
|
||||
return \Sabre\Xml\Deserializer\keyValue($reader, '{DAV:}scope')['{DAV:}prop'];
|
||||
return keyValue($reader, '{DAV:}scope')['{DAV:}prop'];
|
||||
},
|
||||
'{DAV:}from' => function (Reader $reader) {
|
||||
return \Sabre\Xml\Deserializer\repeatingElements($reader, '{DAV:}scope');
|
||||
return repeatingElements($reader, '{DAV:}scope');
|
||||
},
|
||||
'{DAV:}orderby' => function (Reader $reader) {
|
||||
return \Sabre\Xml\Deserializer\repeatingElements($reader, '{DAV:}order');
|
||||
return repeatingElements($reader, '{DAV:}order');
|
||||
},
|
||||
'{DAV:}scope' => Scope::class,
|
||||
'{DAV:}where' => function (Reader $reader) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class SearchHandler {
|
|||
public function handleSearchRequest($xml, ResponseInterface $response): bool {
|
||||
if (!isset($xml['{DAV:}basicsearch'])) {
|
||||
$response->setStatus(400);
|
||||
$response->setBody('Unexpected xml content for searchrequest, expected basicsearch');
|
||||
$response->setBody('Unexpected xml content for search request, expected basicsearch');
|
||||
return false;
|
||||
}
|
||||
/** @var BasicSearch $query */
|
||||
|
|
|
|||
|
|
@ -34,9 +34,6 @@ use SearchDAV\XML\SupportedQueryGrammar;
|
|||
class SearchPlugin extends ServerPlugin {
|
||||
const SEARCHDAV_NS = 'https://github.com/icewind1991/SearchDAV/ns';
|
||||
|
||||
/** @var Server */
|
||||
private $server;
|
||||
|
||||
/** @var ISearchBackend */
|
||||
private $searchBackend;
|
||||
|
||||
|
|
@ -58,7 +55,6 @@ class SearchPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
public function initialize(Server $server): void {
|
||||
$this->server = $server;
|
||||
$this->pathHelper = new PathHelper($server);
|
||||
$this->search = new SearchHandler($this->searchBackend, $this->pathHelper, $server);
|
||||
$this->discover = new DiscoverHandler($this->searchBackend, $this->pathHelper, $this->queryParser);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue