/** * Returns the property storage for a resource. * * Returns the {@link ezcWebdavPropertyStorage} instance containing the * properties for the resource identified by $path. * * @param string $path * @return ezcWebdavBasicPropertyStorage */ protected function getPropertyStorage($path) { $storagePath = $this->getPropertyStoragePath($path); // If no properties has been stored yet, just return an empty property // storage. if (!is_file($storagePath)) { return new ezcWebdavBasicPropertyStorage(); } // Create handler structure to read properties $handler = new ezcWebdavPropertyHandler($xml = new ezcWebdavXmlTool()); $storage = new ezcWebdavBasicPropertyStorage(); // Read document try { $doc = $xml->createDom(file_get_contents($storagePath)); } catch (ezcWebdavInvalidXmlException $e) { throw new ezcWebdavFileBackendBrokenStorageException("Could not open XML as DOMDocument: '{$storage}'."); } // Get property node from document $properties = $doc->getElementsByTagname('properties')->item(0)->childNodes; // Extract and return properties $handler->extractProperties($properties, $storage); return $storage; }
protected function getPropertyStorage($path) { print_debug('getPropertyStorage ' . $path . "\n"); if (@file_exists($storagePath = $this->options->propertyStoragePath . '/properties-' . md5($path))) { $xml = ezcWebdavServer::getInstance()->xmlTool->createDom(@file_get_contents($storagePath)); } else { $xml = ezcWebdavServer::getInstance()->xmlTool->createDom(); } $handler = new ezcWebdavPropertyHandler(new ezcWebdavXmlTool()); try { $handler->extractProperties($xml->getElementsByTagNameNS('DAV:', '*'), $this->propertyStorage); } catch (Exception $e) { } return $this->propertyStorage; }