|
Clone Information
|
SabreDAV with Amazon S3 supportAccess Amazon S3 via WebDAV protocol from a simple PHP Hosting ServerUp- and downloads are passed through stream to stream without temporarily storing GETs and PUTs on the hosting server first. New files and folders inherit storage redundancy ['STANDARD', 'REDUCED_REDUNDANCY'] and some basic ACL ['private', 'public-read', 'public-read-write', 'authenticated-read'] settings from their parents. RequirementsYou need a Web Server with PHP Version >= 5.3 and < 6 for all features to work. PHP Version >= 5.2 and < 6 works without using the Persistence Entity Manager (cache). PHP v6 does not seem to work with SabreDAV yet. Be sure to get the amazons3 branch from this repository. $ hg clone https://1meref-sabredav-amazons3.googlecode.com/hg/ 1meref-sabredav-amazons3 $ cd 1meref-sabredav-amazons3 $ hg update amazons3 The Amazon SDK for PHP v1.2.2 is included with this repository. Example setupAssuming you have installed this SabreDAV clone in "SabreDAV/" in your web server's htdocs directory and set up an apache server (.htaccess) like this... RewriteEngine on RewriteBase / RewriteRule ^(.*)$ server.php [L] This is the most basic example for a "server.php" to list all buckets from the account in the root folder: <?php
require_once('SabreDAV/lib/AWS/sdk.class.php');
require_once('SabreDAV/lib/Sabre.autoload.php');
date_default_timezone_set('YOUR_TIME_ZONE'); // like 'GMT'
$server = new Sabre_DAV_Server(
new Sabre_DAV_S3_Tree(
new Sabre_DAV_S3_Account(),
new AmazonS3(
'YOUR_KEY',
'YOUR_SECRET_KEY'
)));
$server->setBaseUri('/');
$server->exec();This is an example "server.php" to set up a bucket as the root node, support node caching (Entity Manager) to the local filesystem and automatically update the cache after node access (Plugin) with a minimum entity lifetime of 300s, a maximum of 2 simultaneously working update threads, which have a processing time limit of 120s, and an unlimited number of threads (requests) allowed to add to the queue at the same time: <?php
require_once('SabreDAV/lib/AWS/sdk.class.php');
require_once('SabreDAV/lib/Sabre.autoload.php');
date_default_timezone_set('YOUR_TIME_ZONE'); // like 'GMT'
$server = new Sabre_DAV_Server(
new Sabre_DAV_S3_Tree(
new Sabre_DAV_S3_Bucket(
'YOUR_BUCKET_NAME'),
new AmazonS3(
'YOUR_KEY',
'YOUR_SECRET_KEY'),
new Sabre_DAV_S3_EntityManagerFS(
'YOUR_CACHE_DIR')
));
$server->addPlugin(
new Sabre_DAV_S3_Plugin(
new Sabre_DAV_S3_Plugin_Queue_FS(
'YOUR_QUEUE_FILENAME',
2,
-1),
300,
120
));
$server->setBaseUri('/');
$server->exec();There is no separate documentation yet. You need to look at the source code for PHP Doc comments. Also head over to the SabreDAV project home for more information on how to customize your server and set up authentication for example. If you use the web server's authentication, be sure to allow unauthenticated access from the loopback device (127.0.0.1) for the update plugin to work. Known issues
Further development
|