"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/DAV/Server.php" between
dav-4.0.2.tar.gz and dav-4.0.3.tar.gz

About: sabre/dav is a WebDAV framework for PHP allowing to create WebDAV, CalDAV and CardDAV servers.

Server.php  (dav-4.0.2):Server.php  (dav-4.0.3)
skipping to change at line 17 skipping to change at line 17
use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait; use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
use Sabre\Event\EmitterInterface; use Sabre\Event\EmitterInterface;
use Sabre\Event\WildcardEmitterTrait; use Sabre\Event\WildcardEmitterTrait;
use Sabre\HTTP; use Sabre\HTTP;
use Sabre\HTTP\RequestInterface; use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface; use Sabre\HTTP\ResponseInterface;
use Sabre\Uri; use Sabre\Uri;
use Sabre\Xml\Writer;
/** /**
* Main DAV server class. * Main DAV server class.
* *
* @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/) * @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License * @license http://sabre.io/license/ Modified BSD License
*/ */
class Server implements LoggerAwareInterface, EmitterInterface class Server implements LoggerAwareInterface, EmitterInterface
{ {
skipping to change at line 188 skipping to change at line 189
* If this setting is turned off, SabreDAV's version number will be hidden * If this setting is turned off, SabreDAV's version number will be hidden
* from various places. * from various places.
* *
* Some people feel this is a good security measure. * Some people feel this is a good security measure.
* *
* @var bool * @var bool
*/ */
public static $exposeVersion = true; public static $exposeVersion = true;
/** /**
* If this setting is turned on, any multi status response on any PROPFIND w
ill be streamed to the output buffer.
* This will be beneficial for large result sets which will no longer consum
e a large amount of memory as well as
* send back data to the client earlier.
*
* @var bool
*/
public static $streamMultiStatus = false;
/**
* Sets up the server. * Sets up the server.
* *
* If a Sabre\DAV\Tree object is passed as an argument, it will * If a Sabre\DAV\Tree object is passed as an argument, it will
* use it as the directory tree. If a Sabre\DAV\INode is passed, it * use it as the directory tree. If a Sabre\DAV\INode is passed, it
* will create a Sabre\DAV\Tree and use the node as the root. * will create a Sabre\DAV\Tree and use the node as the root.
* *
* If nothing is passed, a Sabre\DAV\SimpleCollection is created in * If nothing is passed, a Sabre\DAV\SimpleCollection is created in
* a Sabre\DAV\Tree. * a Sabre\DAV\Tree.
* *
* If an array is passed, we automatically create a root node, and use * If an array is passed, we automatically create a root node, and use
skipping to change at line 1631 skipping to change at line 1641
} }
} }
return $result; return $result;
} }
// }}} // }}}
// {{{ XML Readers & Writers // {{{ XML Readers & Writers
/** /**
* Generates a WebDAV propfind response body based on a list of nodes. * Returns a callback generating a WebDAV propfind response body based on a list of nodes.
* *
* If 'strip404s' is set to true, all 404 responses will be removed. * If 'strip404s' is set to true, all 404 responses will be removed.
* *
* @param array|\Traversable $fileProperties The list with nodes * @param array|\Traversable $fileProperties The list with nodes
* @param bool $strip404s * @param bool $strip404s
* *
* @return string * @return callable|string
*/ */
public function generateMultiStatus($fileProperties, $strip404s = false) public function generateMultiStatus($fileProperties, $strip404s = false)
{ {
$w = $this->xml->getWriter(); $w = $this->xml->getWriter();
if (self::$streamMultiStatus) {
return function () use ($fileProperties, $strip404s, $w) {
$w->openUri('php://output');
$this->writeMultiStatus($w, $fileProperties, $strip404s);
$w->flush();
};
}
$w->openMemory(); $w->openMemory();
$this->writeMultiStatus($w, $fileProperties, $strip404s);
return $w->outputMemory();
}
/**
* @param Writer $w
* @param $fileProperties
* @param bool $strip404s
*/
private function writeMultiStatus(Writer $w, $fileProperties, bool $strip404
s)
{
$w->contextUri = $this->baseUri; $w->contextUri = $this->baseUri;
$w->startDocument(); $w->startDocument();
$w->startElement('{DAV:}multistatus'); $w->startElement('{DAV:}multistatus');
foreach ($fileProperties as $entry) { foreach ($fileProperties as $entry) {
$href = $entry['href']; $href = $entry['href'];
unset($entry['href']); unset($entry['href']);
if ($strip404s) { if ($strip404s) {
unset($entry[404]); unset($entry[404]);
skipping to change at line 1665 skipping to change at line 1694
$response = new Xml\Element\Response( $response = new Xml\Element\Response(
ltrim($href, '/'), ltrim($href, '/'),
$entry $entry
); );
$w->write([ $w->write([
'name' => '{DAV:}response', 'name' => '{DAV:}response',
'value' => $response, 'value' => $response,
]); ]);
} }
$w->endElement(); $w->endElement();
$w->endDocument();
return $w->outputMemory();
} }
} }
 End of changes. 7 change blocks. 
4 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)