[Pkg-owncloud-commits] [php-sabredav] 27/40: Remove simplefsserver.php

David Prévot taffit at moszumanska.debian.org
Sat Sep 5 15:24:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 3.1.0-alpha2
in repository php-sabredav.

commit 211a0776a6fbcd4a7a319f97421bf0921f525b8e
Author: Evert Pot <me at evertpot.com>
Date:   Fri Aug 21 18:51:50 2015 -0400

    Remove simplefsserver.php
---
 CHANGELOG.md                |   1 +
 examples/simplefsserver.php | 123 --------------------------------------------
 2 files changed, 1 insertion(+), 123 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 07b8069..6a53607 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ ChangeLog
 * Fixed a privilege bug in the availability system.
 * #697: Added a "tableName" member to the PropertyStorage PDO backend. (@Frzk).
 * #699: PostgreSQL fix for the Locks PDO backend. (@TCKnet)
+* Removed the `simplefsserver.php` example file. It's not simple enough.
 
 
 3.1.0-alpha1 (2015-07-19)
diff --git a/examples/simplefsserver.php b/examples/simplefsserver.php
deleted file mode 100644
index ad0679b..0000000
--- a/examples/simplefsserver.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-// !!!! Make sure the Sabre directory is in the include_path !!!
-// example:
-// set_include_path('lib/' . PATH_SEPARATOR . get_include_path());
-
-/*
-
-This example demonstrates a simple way to create your own virtual filesystems.
-By extending the _File and Directory classes, you can easily create a tree
-based on various datasources.
-
-The most obvious example is the filesystem itself. A more complete and documented
-example can be found in:
-
-lib/Sabre/DAV/FS/Node.php
-lib/Sabre/DAV/FS/Directory.php
-lib/Sabre/DAV/FS/File.php
-
-*/
-
-// settings
-date_default_timezone_set('Canada/Eastern');
-$publicDir = 'public';
-
-// Files we need
-require_once 'vendor/autoload.php';
-
-class MyCollection extends Sabre\DAV\Collection {
-
-  private $myPath;
-
-  function __construct($myPath) {
-
-    $this->myPath = $myPath;
-
-  }
-
-  function getChildren() {
-
-    $children = [];
-    // Loop through the directory, and create objects for each node
-    foreach (scandir($this->myPath) as $node) {
-
-      // Ignoring files staring with .
-      if ($node[0] === '.') continue;
-
-      $children[] = $this->getChild($node);
-
-    }
-
-    return $children;
-
-  }
-
-    function getChild($name) {
-
-        $path = $this->myPath . '/' . $name;
-
-        // We have to throw a NotFound exception if the file didn't exist
-        if (!file_exists($this->myPath)) throw new \Sabre\DAV\Exception\NotFound('The file with name: ' . $name . ' could not be found');
-        // Some added security
-
-        if ($name[0] == '.')  throw new \Sabre\DAV\Exception\Forbidden('Access denied');
-
-        if (is_dir($path)) {
-
-            return new \MyCollection($name);
-
-        } else {
-
-            return new \MyFile($path);
-
-        }
-
-    }
-
-    function getName() {
-
-        return basename($this->myPath);
-
-    }
-
-}
-
-class MyFile extends \Sabre\DAV\File {
-
-  private $myPath;
-
-  function __construct($myPath) {
-
-    $this->myPath = $myPath;
-
-  }
-
-  function getName() {
-
-      return basename($this->myPath);
-
-  }
-
-  function get() {
-
-    return fopen($this->myPath, 'r');
-
-  }
-
-  function getSize() {
-
-      return filesize($this->myPath);
-
-  }
-
-}
-
-// Make sure there is a directory in your current directory named 'public'. We will be exposing that directory to WebDAV
-$rootNode = new \MyCollection($publicDir);
-
-// The rootNode needs to be passed to the server object.
-$server = new \Sabre\DAV\Server($rootNode);
-
-// And off we go!
-$server->exec();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list