File: sabredav.php

package info (click to toggle)
php-sabre-dav-2.1 2.1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,544 kB
  • ctags: 8,827
  • sloc: php: 34,243; sql: 445; python: 221; xml: 67; makefile: 46; sh: 1
file content (53 lines) | stat: -rwxr-xr-x 796 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

// SabreDAV test server.

class CliLog {

    protected $stream;

    function __construct() {

        $this->stream = fopen('php://stdout','w');

    }

    function log($msg) {
        fwrite($this->stream, $msg . "\n");
    }

}

$log = new CliLog();

if (php_sapi_name()!=='cli-server') {
    die("This script is intended to run on the built-in php webserver");
}

// Finding composer


$paths = array(
    __DIR__ . '/../lib/autoload.php',
    __DIR__ . '/autoload.php',
);

foreach($paths as $path) {
    if (file_exists($path)) {
        include $path;
        break;
    }
}

use Sabre\DAV;

// Root 
$root = new DAV\FS\Directory(getcwd());

// Setting up server.
$server = new DAV\Server($root);

// Browser plugin
$server->addPlugin(new DAV\Browser\Plugin());

$server->exec();