Add Dropbox storage backend
This commit is contained in:
parent
b46903fa76
commit
ab41b57f62
|
@ -0,0 +1,380 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox API class
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
class Dropbox_API {
|
||||
|
||||
/**
|
||||
* Sandbox root-path
|
||||
*/
|
||||
const ROOT_SANDBOX = 'sandbox';
|
||||
|
||||
/**
|
||||
* Dropbox root-path
|
||||
*/
|
||||
const ROOT_DROPBOX = 'dropbox';
|
||||
|
||||
/**
|
||||
* API URl
|
||||
*/
|
||||
protected $api_url = 'https://api.dropbox.com/1/';
|
||||
|
||||
/**
|
||||
* Content API URl
|
||||
*/
|
||||
protected $api_content_url = 'https://api-content.dropbox.com/1/';
|
||||
|
||||
/**
|
||||
* OAuth object
|
||||
*
|
||||
* @var Dropbox_OAuth
|
||||
*/
|
||||
protected $oauth;
|
||||
|
||||
/**
|
||||
* Default root-path, this will most likely be 'sandbox' or 'dropbox'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $root;
|
||||
protected $useSSL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Dropbox_OAuth Dropbox_Auth object
|
||||
* @param string $root default root path (sandbox or dropbox)
|
||||
*/
|
||||
public function __construct(Dropbox_OAuth $oauth, $root = self::ROOT_DROPBOX, $useSSL = true) {
|
||||
|
||||
$this->oauth = $oauth;
|
||||
$this->root = $root;
|
||||
$this->useSSL = $useSSL;
|
||||
if (!$this->useSSL)
|
||||
{
|
||||
throw new Dropbox_Exception('Dropbox REST API now requires that all requests use SSL');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about the current dropbox account
|
||||
*
|
||||
* @return stdclass
|
||||
*/
|
||||
public function getAccountInfo() {
|
||||
|
||||
$data = $this->oauth->fetch($this->api_url . 'account/info');
|
||||
return json_decode($data['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file's contents
|
||||
*
|
||||
* @param string $path path
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return string
|
||||
*/
|
||||
public function getFile($path = '', $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$result = $this->oauth->fetch($this->api_content_url . 'files/' . $root . '/' . ltrim($path,'/'));
|
||||
return $result['body'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a new file
|
||||
*
|
||||
* @param string $path Target path (including filename)
|
||||
* @param string $file Either a path to a file or a stream resource
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return bool
|
||||
*/
|
||||
public function putFile($path, $file, $root = null) {
|
||||
|
||||
$directory = dirname($path);
|
||||
$filename = basename($path);
|
||||
|
||||
if($directory==='.') $directory = '';
|
||||
$directory = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($directory));
|
||||
// $filename = str_replace('~', '%7E', rawurlencode($filename));
|
||||
if (is_null($root)) $root = $this->root;
|
||||
|
||||
if (is_string($file)) {
|
||||
|
||||
$file = fopen($file,'rb');
|
||||
|
||||
} elseif (!is_resource($file)) {
|
||||
throw new Dropbox_Exception('File must be a file-resource or a string');
|
||||
}
|
||||
$result=$this->multipartFetch($this->api_content_url . 'files/' .
|
||||
$root . '/' . trim($directory,'/'), $file, $filename);
|
||||
|
||||
if(!isset($result["httpStatus"]) || $result["httpStatus"] != 200)
|
||||
throw new Dropbox_Exception("Uploading file to Dropbox failed");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copies a file or directory from one location to another
|
||||
*
|
||||
* This method returns the file information of the newly created file.
|
||||
*
|
||||
* @param string $from source path
|
||||
* @param string $to destination path
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return stdclass
|
||||
*/
|
||||
public function copy($from, $to, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$response = $this->oauth->fetch($this->api_url . 'fileops/copy', array('from_path' => $from, 'to_path' => $to, 'root' => $root));
|
||||
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new folder
|
||||
*
|
||||
* This method returns the information from the newly created directory
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return stdclass
|
||||
*/
|
||||
public function createFolder($path, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
|
||||
// Making sure the path starts with a /
|
||||
// $path = '/' . ltrim($path,'/');
|
||||
|
||||
$response = $this->oauth->fetch($this->api_url . 'fileops/create_folder', array('path' => $path, 'root' => $root),'POST');
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file or folder.
|
||||
*
|
||||
* This method will return the metadata information from the deleted file or folder, if successful.
|
||||
*
|
||||
* @param string $path Path to new folder
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return array
|
||||
*/
|
||||
public function delete($path, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$response = $this->oauth->fetch($this->api_url . 'fileops/delete', array('path' => $path, 'root' => $root));
|
||||
return json_decode($response['body']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a file or directory to a new location
|
||||
*
|
||||
* This method returns the information from the newly created directory
|
||||
*
|
||||
* @param mixed $from Source path
|
||||
* @param mixed $to destination path
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return stdclass
|
||||
*/
|
||||
public function move($from, $to, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$response = $this->oauth->fetch($this->api_url . 'fileops/move', array('from_path' => rawurldecode($from), 'to_path' => rawurldecode($to), 'root' => $root));
|
||||
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns file and directory information
|
||||
*
|
||||
* @param string $path Path to receive information from
|
||||
* @param bool $list When set to true, this method returns information from all files in a directory. When set to false it will only return infromation from the specified directory.
|
||||
* @param string $hash If a hash is supplied, this method simply returns true if nothing has changed since the last request. Good for caching.
|
||||
* @param int $fileLimit Maximum number of file-information to receive
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return array|true
|
||||
*/
|
||||
public function getMetaData($path, $list = true, $hash = null, $fileLimit = null, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
|
||||
$args = array(
|
||||
'list' => $list,
|
||||
);
|
||||
|
||||
if (!is_null($hash)) $args['hash'] = $hash;
|
||||
if (!is_null($fileLimit)) $args['file_limit'] = $fileLimit;
|
||||
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$response = $this->oauth->fetch($this->api_url . 'metadata/' . $root . '/' . ltrim($path,'/'), $args);
|
||||
|
||||
/* 304 is not modified */
|
||||
if ($response['httpStatus']==304) {
|
||||
return true;
|
||||
} else {
|
||||
return json_decode($response['body'],true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A way of letting you keep up with changes to files and folders in a user's Dropbox. You can periodically call /delta to get a list of "delta entries", which are instructions on how to update your local state to match the server's state.
|
||||
*
|
||||
* This method returns the information from the newly created directory
|
||||
*
|
||||
* @param string $cursor A string that is used to keep track of your current state. On the next call pass in this value to return delta entries that have been recorded since the cursor was returned.
|
||||
* @return stdclass
|
||||
*/
|
||||
public function delta($cursor) {
|
||||
|
||||
$arg['cursor'] = $cursor;
|
||||
|
||||
$response = $this->oauth->fetch($this->api_url . 'delta', $arg, 'POST');
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a thumbnail (as a string) for a file path.
|
||||
*
|
||||
* @param string $path Path to file
|
||||
* @param string $size small, medium or large
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @return string
|
||||
*/
|
||||
public function getThumbnail($path, $size = 'small', $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$response = $this->oauth->fetch($this->api_content_url . 'thumbnails/' . $root . '/' . ltrim($path,'/'),array('size' => $size));
|
||||
|
||||
return $response['body'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to generate multipart POST requests for file upload
|
||||
*
|
||||
* @param string $uri
|
||||
* @param array $arguments
|
||||
* @return bool
|
||||
*/
|
||||
protected function multipartFetch($uri, $file, $filename) {
|
||||
|
||||
/* random string */
|
||||
$boundary = 'R50hrfBj5JYyfR3vF3wR96GPCC9Fd2q2pVMERvEaOE3D8LZTgLLbRpNwXek3';
|
||||
|
||||
$headers = array(
|
||||
'Content-Type' => 'multipart/form-data; boundary=' . $boundary,
|
||||
);
|
||||
|
||||
$body="--" . $boundary . "\r\n";
|
||||
$body.="Content-Disposition: form-data; name=file; filename=".rawurldecode($filename)."\r\n";
|
||||
$body.="Content-type: application/octet-stream\r\n";
|
||||
$body.="\r\n";
|
||||
$body.=stream_get_contents($file);
|
||||
$body.="\r\n";
|
||||
$body.="--" . $boundary . "--";
|
||||
|
||||
// Dropbox requires the filename to also be part of the regular arguments, so it becomes
|
||||
// part of the signature.
|
||||
$uri.='?file=' . $filename;
|
||||
|
||||
return $this->oauth->fetch($uri, $body, 'POST', $headers);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* Returns metadata for all files and folders that match the search query.
|
||||
*
|
||||
* @added by: diszo.sasil
|
||||
*
|
||||
* @param string $query
|
||||
* @param string $root Use this to override the default root path (sandbox/dropbox)
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
public function search($query = '', $root = null, $path = ''){
|
||||
if (is_null($root)) $root = $this->root;
|
||||
if(!empty($path)){
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
}
|
||||
$response = $this->oauth->fetch($this->api_url . 'search/' . $root . '/' . ltrim($path,'/'),array('query' => $query));
|
||||
return json_decode($response['body'],true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a shareable link to files or folders.
|
||||
*
|
||||
* Note: Links created by the /shares API call expire after thirty days.
|
||||
*
|
||||
* @param type $path
|
||||
* @param type $root
|
||||
* @return type
|
||||
*/
|
||||
public function share($path, $root = null) {
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$response = $this->oauth->fetch($this->api_url. 'shares/'. $root . '/' . ltrim($path, '/'), array(), 'POST');
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link directly to a file.
|
||||
* Similar to /shares. The difference is that this bypasses the Dropbox webserver, used to provide a preview of the file, so that you can effectively stream the contents of your media.
|
||||
*
|
||||
* Note: The /media link expires after four hours, allotting enough time to stream files, but not enough to leave a connection open indefinitely.
|
||||
*
|
||||
* @param type $path
|
||||
* @param type $root
|
||||
* @return type
|
||||
*/
|
||||
public function media($path, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$response = $this->oauth->fetch($this->api_url. 'media/'. $root . '/' . ltrim($path, '/'), array(), 'POST');
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the from_copy_ref parameter on /fileops/copy.
|
||||
*
|
||||
* @param type $path
|
||||
* @param type $root
|
||||
* @return type
|
||||
*/
|
||||
public function copy_ref($path, $root = null) {
|
||||
|
||||
if (is_null($root)) $root = $this->root;
|
||||
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
|
||||
$response = $this->oauth->fetch($this->api_url. 'copy_ref/'. $root . '/' . ltrim($path, '/'));
|
||||
return json_decode($response['body'],true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox base exception
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base exception class
|
||||
*/
|
||||
class Dropbox_Exception extends Exception { }
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox Forbidden exception
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* This exception is thrown when we receive the 403 forbidden response
|
||||
*/
|
||||
class Dropbox_Exception_Forbidden extends Dropbox_Exception {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox Not Found exception
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* This exception is thrown when a non-existant uri is accessed.
|
||||
*
|
||||
* Basically, this exception is used when we get back a 404.
|
||||
*/
|
||||
class Dropbox_Exception_NotFound extends Dropbox_Exception {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox Over Quota exception
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* This exception is thrown when the operation required more space than the available quota.
|
||||
*
|
||||
* Basically, this exception is used when we get back a 507.
|
||||
*/
|
||||
class Dropbox_Exception_OverQuota extends Dropbox_Exception {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox RequestToken exception
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* This exception is thrown when an error occured during the request_token process.
|
||||
*/
|
||||
class Dropbox_Exception_RequestToken extends Dropbox_Exception {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2010 Rooftop Solutions
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox OAuth
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This class is an abstract OAuth class.
|
||||
*
|
||||
* It must be extended by classes who wish to provide OAuth functionality
|
||||
* using different libraries.
|
||||
*/
|
||||
abstract class Dropbox_OAuth {
|
||||
|
||||
/**
|
||||
* After a user has authorized access, dropbox can redirect the user back
|
||||
* to this url.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $authorizeCallbackUrl = null;
|
||||
|
||||
/**
|
||||
* Uri used to fetch request tokens
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const URI_REQUEST_TOKEN = 'https://api.dropbox.com/1/oauth/request_token';
|
||||
|
||||
/**
|
||||
* Uri used to redirect the user to for authorization.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const URI_AUTHORIZE = 'https://www.dropbox.com/1/oauth/authorize';
|
||||
|
||||
/**
|
||||
* Uri used to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const URI_ACCESS_TOKEN = 'https://api.dropbox.com/1/oauth/access_token';
|
||||
|
||||
/**
|
||||
* An OAuth request token.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauth_token = null;
|
||||
|
||||
/**
|
||||
* OAuth token secret
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauth_token_secret = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $consumerKey
|
||||
* @param string $consumerSecret
|
||||
*/
|
||||
abstract public function __construct($consumerKey, $consumerSecret);
|
||||
|
||||
/**
|
||||
* Sets the request token and secret.
|
||||
*
|
||||
* The tokens can also be passed as an array into the first argument.
|
||||
* The array must have the elements token and token_secret.
|
||||
*
|
||||
* @param string|array $token
|
||||
* @param string $token_secret
|
||||
* @return void
|
||||
*/
|
||||
public function setToken($token, $token_secret = null) {
|
||||
|
||||
if (is_array($token)) {
|
||||
$this->oauth_token = $token['token'];
|
||||
$this->oauth_token_secret = $token['token_secret'];
|
||||
} else {
|
||||
$this->oauth_token = $token;
|
||||
$this->oauth_token_secret = $token_secret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the oauth request tokens as an associative array.
|
||||
*
|
||||
* The array will contain the elements 'token' and 'token_secret'.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getToken() {
|
||||
|
||||
return array(
|
||||
'token' => $this->oauth_token,
|
||||
'token_secret' => $this->oauth_token_secret,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the authorization url
|
||||
*
|
||||
* @param string $callBack Specify a callback url to automatically redirect the user back
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthorizeUrl($callBack = null) {
|
||||
|
||||
// Building the redirect uri
|
||||
$token = $this->getToken();
|
||||
$uri = self::URI_AUTHORIZE . '?oauth_token=' . $token['token'];
|
||||
if ($callBack) $uri.='&oauth_callback=' . $callBack;
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a secured oauth url and returns the response body.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param mixed $arguments
|
||||
* @param string $method
|
||||
* @param array $httpHeaders
|
||||
* @return string
|
||||
*/
|
||||
public abstract function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array());
|
||||
|
||||
/**
|
||||
* Requests the OAuth request token.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getRequestToken();
|
||||
|
||||
/**
|
||||
* Requests the OAuth access tokens.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getAccessToken();
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* HTTP OAuth Consumer
|
||||
*
|
||||
* Adapted from halldirector's code in
|
||||
* http://code.google.com/p/dropbox-php/issues/detail?id=36#c5
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2011 Joe Constant / halldirector. All rights reserved.
|
||||
* @author Joe Constant / halldirector
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
require_once 'HTTP/OAuth.php';
|
||||
require_once 'HTTP/OAuth/Consumer.php';
|
||||
|
||||
/*
|
||||
* This class is to help work around aomw ssl issues.
|
||||
*/
|
||||
class Dropbox_OAuth_Consumer_Dropbox extends HTTP_OAuth_Consumer
|
||||
{
|
||||
public function getOAuthConsumerRequest()
|
||||
{
|
||||
if (!$this->consumerRequest instanceof HTTP_OAuth_Consumer_Request) {
|
||||
$this->consumerRequest = new HTTP_OAuth_Consumer_Request;
|
||||
}
|
||||
|
||||
// TODO: Change this and add in code to validate the SSL cert.
|
||||
// see https://github.com/bagder/curl/blob/master/lib/mk-ca-bundle.pl
|
||||
$this->consumerRequest->setConfig(array(
|
||||
'ssl_verify_peer' => false,
|
||||
'ssl_verify_host' => false
|
||||
));
|
||||
|
||||
return $this->consumerRequest;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,282 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Dropbox OAuth
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2011 Daniel Huesken
|
||||
* @author Daniel Huesken (http://www.danielhuesken.de/)
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is used to sign all requests to dropbox.
|
||||
*
|
||||
* This specific class uses WordPress WP_Http to authenticate.
|
||||
*/
|
||||
class Dropbox_OAuth_Curl extends Dropbox_OAuth {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string ConsumerKey
|
||||
*/
|
||||
protected $consumerKey = null;
|
||||
/**
|
||||
*
|
||||
* @var string ConsumerSecret
|
||||
*/
|
||||
protected $consumerSecret = null;
|
||||
/**
|
||||
*
|
||||
* @var string ProzessCallBack
|
||||
*/
|
||||
public $ProgressFunction = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $consumerKey
|
||||
* @param string $consumerSecret
|
||||
*/
|
||||
public function __construct($consumerKey, $consumerSecret) {
|
||||
if (!function_exists('curl_exec'))
|
||||
throw new Dropbox_Exception('The PHP curl functions not available!');
|
||||
|
||||
$this->consumerKey = $consumerKey;
|
||||
$this->consumerSecret = $consumerSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a secured oauth url and returns the response body.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param mixed $arguments
|
||||
* @param string $method
|
||||
* @param array $httpHeaders
|
||||
* @return string
|
||||
*/
|
||||
public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) {
|
||||
|
||||
$uri=str_replace('http://', 'https://', $uri); // all https, upload makes problems if not
|
||||
if (is_string($arguments) and strtoupper($method) == 'POST') {
|
||||
preg_match("/\?file=(.*)$/i", $uri, $matches);
|
||||
if (isset($matches[1])) {
|
||||
$uri = str_replace($matches[0], "", $uri);
|
||||
$filename = $matches[1];
|
||||
$httpHeaders=array_merge($httpHeaders,$this->getOAuthHeader($uri, array("file" => $filename), $method));
|
||||
}
|
||||
} else {
|
||||
$httpHeaders=array_merge($httpHeaders,$this->getOAuthHeader($uri, $arguments, $method));
|
||||
}
|
||||
$ch = curl_init();
|
||||
if (strtoupper($method) == 'POST') {
|
||||
curl_setopt($ch, CURLOPT_URL, $uri);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
// if (is_array($arguments))
|
||||
// $arguments=http_build_query($arguments);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $arguments);
|
||||
// $httpHeaders['Content-Length']=strlen($arguments);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_URL, $uri.'?'.http_build_query($arguments));
|
||||
curl_setopt($ch, CURLOPT_POST, false);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
// curl_setopt($ch, CURLOPT_CAINFO, "rootca");
|
||||
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
|
||||
//Build header
|
||||
$headers = array();
|
||||
foreach ($httpHeaders as $name => $value) {
|
||||
$headers[] = "{$name}: $value";
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
if (!ini_get('safe_mode') && !ini_get('open_basedir'))
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
|
||||
if (function_exists($this->ProgressFunction) and defined('CURLOPT_PROGRESSFUNCTION')) {
|
||||
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
|
||||
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, $this->ProgressFunction);
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, 512);
|
||||
}
|
||||
$response=curl_exec($ch);
|
||||
$errorno=curl_errno($ch);
|
||||
$error=curl_error($ch);
|
||||
$status=curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
if (!empty($errorno))
|
||||
throw new Dropbox_Exception_NotFound('Curl error: ('.$errorno.') '.$error."\n");
|
||||
|
||||
if ($status>=300) {
|
||||
$body = json_decode($response,true);
|
||||
switch ($status) {
|
||||
// Not modified
|
||||
case 304 :
|
||||
return array(
|
||||
'httpStatus' => 304,
|
||||
'body' => null,
|
||||
);
|
||||
break;
|
||||
case 403 :
|
||||
throw new Dropbox_Exception_Forbidden('Forbidden.
|
||||
This could mean a bad OAuth request, or a file or folder already existing at the target location.
|
||||
' . $body["error"] . "\n");
|
||||
case 404 :
|
||||
throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found. ' .
|
||||
$body["error"] . "\n");
|
||||
case 507 :
|
||||
throw new Dropbox_Exception_OverQuota('This dropbox is full. ' .
|
||||
$body["error"] . "\n");
|
||||
}
|
||||
if (!empty($body["error"]))
|
||||
throw new Dropbox_Exception_RequestToken('Error: ('.$status.') '.$body["error"]."\n");
|
||||
}
|
||||
|
||||
return array(
|
||||
'body' => $response,
|
||||
'httpStatus' => $status
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns named array with oauth parameters for further use
|
||||
* @return array Array with oauth_ parameters
|
||||
*/
|
||||
private function getOAuthBaseParams() {
|
||||
$params['oauth_version'] = '1.0';
|
||||
$params['oauth_signature_method'] = 'HMAC-SHA1';
|
||||
|
||||
$params['oauth_consumer_key'] = $this->consumerKey;
|
||||
$tokens = $this->getToken();
|
||||
if (isset($tokens['token']) && $tokens['token']) {
|
||||
$params['oauth_token'] = $tokens['token'];
|
||||
}
|
||||
$params['oauth_timestamp'] = time();
|
||||
$params['oauth_nonce'] = md5(microtime() . mt_rand());
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates valid Authorization header for OAuth, based on URI and Params
|
||||
*
|
||||
* @param string $uri
|
||||
* @param array $params
|
||||
* @param string $method GET or POST, standard is GET
|
||||
* @param array $oAuthParams optional, pass your own oauth_params here
|
||||
* @return array Array for request's headers section like
|
||||
* array('Authorization' => 'OAuth ...');
|
||||
*/
|
||||
private function getOAuthHeader($uri, $params, $method = 'GET', $oAuthParams = null) {
|
||||
$oAuthParams = $oAuthParams ? $oAuthParams : $this->getOAuthBaseParams();
|
||||
|
||||
// create baseString to encode for the sent parameters
|
||||
$baseString = $method . '&';
|
||||
$baseString .= $this->oauth_urlencode($uri) . "&";
|
||||
|
||||
// OAuth header does not include GET-Parameters
|
||||
$signatureParams = array_merge($params, $oAuthParams);
|
||||
|
||||
// sorting the parameters
|
||||
ksort($signatureParams);
|
||||
|
||||
$encodedParams = array();
|
||||
foreach ($signatureParams as $key => $value) {
|
||||
$encodedParams[] = $this->oauth_urlencode($key) . '=' . $this->oauth_urlencode($value);
|
||||
}
|
||||
|
||||
$baseString .= $this->oauth_urlencode(implode('&', $encodedParams));
|
||||
|
||||
// encode the signature
|
||||
$tokens = $this->getToken();
|
||||
$hash = $this->hash_hmac_sha1($this->consumerSecret.'&'.$tokens['token_secret'], $baseString);
|
||||
$signature = base64_encode($hash);
|
||||
|
||||
// add signature to oAuthParams
|
||||
$oAuthParams['oauth_signature'] = $signature;
|
||||
|
||||
$oAuthEncoded = array();
|
||||
foreach ($oAuthParams as $key => $value) {
|
||||
$oAuthEncoded[] = $key . '="' . $this->oauth_urlencode($value) . '"';
|
||||
}
|
||||
|
||||
return array('Authorization' => 'OAuth ' . implode(', ', $oAuthEncoded));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the OAuth request token.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getRequestToken() {
|
||||
$result = $this->fetch(self::URI_REQUEST_TOKEN, array(), 'POST');
|
||||
if ($result['httpStatus'] == "200") {
|
||||
$tokens = array();
|
||||
parse_str($result['body'], $tokens);
|
||||
$this->setToken($tokens['oauth_token'], $tokens['oauth_token_secret']);
|
||||
return $this->getToken();
|
||||
} else {
|
||||
throw new Dropbox_Exception_RequestToken('We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the OAuth access tokens.
|
||||
*
|
||||
* This method requires the 'unauthorized' request tokens
|
||||
* and, if successful will set the authorized request tokens.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getAccessToken() {
|
||||
$result = $this->fetch(self::URI_ACCESS_TOKEN, array(), 'POST');
|
||||
if ($result['httpStatus'] == "200") {
|
||||
$tokens = array();
|
||||
parse_str($result['body'], $tokens);
|
||||
$this->setToken($tokens['oauth_token'], $tokens['oauth_token_secret']);
|
||||
return $this->getToken();
|
||||
} else {
|
||||
throw new Dropbox_Exception_RequestToken('We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to properly urlencode parameters.
|
||||
* See http://php.net/manual/en/function.oauth-urlencode.php
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
private function oauth_urlencode($string) {
|
||||
return str_replace('%E7', '~', rawurlencode($string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash function for hmac_sha1; uses native function if available.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
private function hash_hmac_sha1($key, $data) {
|
||||
if (function_exists('hash_hmac') && in_array('sha1', hash_algos())) {
|
||||
return hash_hmac('sha1', $data, $key, true);
|
||||
} else {
|
||||
$blocksize = 64;
|
||||
$hashfunc = 'sha1';
|
||||
if (strlen($key) > $blocksize) {
|
||||
$key = pack('H*', $hashfunc($key));
|
||||
}
|
||||
|
||||
$key = str_pad($key, $blocksize, chr(0x00));
|
||||
$ipad = str_repeat(chr(0x36), $blocksize);
|
||||
$opad = str_repeat(chr(0x5c), $blocksize);
|
||||
$hash = pack('H*', $hashfunc(( $key ^ $opad ) . pack('H*', $hashfunc(($key ^ $ipad) . $data))));
|
||||
|
||||
return $hash;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
Dropbox-php
|
||||
===========
|
||||
|
||||
This PHP library allows you to easily integrate dropbox with PHP.
|
||||
|
||||
The following PHP extension is required:
|
||||
|
||||
* json
|
||||
|
||||
The library makes use of OAuth. At the moment you can use either of these libraries:
|
||||
|
||||
[PHP OAuth extension](http://pecl.php.net/package/oauth)
|
||||
[PEAR's HTTP_OAUTH package](http://pear.php.net/package/http_oauth)
|
||||
|
||||
The extension is recommended, but if you can't install php extensions you should go for the pear package.
|
||||
Installing
|
||||
----------
|
||||
|
||||
pear channel-discover pear.dropbox-php.com
|
||||
pear install dropbox-php/Dropbox-alpha
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Check out the [documentation](http://www.dropbox-php.com/docs).
|
||||
|
||||
Questions?
|
||||
----------
|
||||
|
||||
[Dropbox-php Mailing list](http://groups.google.com/group/dropbox-php)
|
||||
[Official Dropbox developer forum](http://forums.dropbox.com/forum.php?id=5)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file registers a new autoload function using spl_autoload_register.
|
||||
*
|
||||
* @package Dropbox
|
||||
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/dropbox-php/wiki/License MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Autoloader function
|
||||
*
|
||||
* @param $className string
|
||||
* @return void
|
||||
*/
|
||||
function Dropbox_autoload($className) {
|
||||
|
||||
if(strpos($className,'Dropbox_')===0) {
|
||||
|
||||
include dirname(__FILE__) . '/' . str_replace('_','/',substr($className,8)) . '.php';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
spl_autoload_register('Dropbox_autoload');
|
||||
|
|
@ -13,6 +13,7 @@ OC::$CLASSPATH['OC_Filestorage_Google']='apps/files_external/lib/google.php';
|
|||
OC::$CLASSPATH['OC_Filestorage_SWIFT']='apps/files_external/lib/swift.php';
|
||||
OC::$CLASSPATH['OC_Filestorage_SMB']='apps/files_external/lib/smb.php';
|
||||
OC::$CLASSPATH['OC_Filestorage_AmazonS3']='apps/files_external/lib/amazons3.php';
|
||||
OC::$CLASSPATH['OC_Filestorage_Dropbox']='apps/files_external/lib/dropbox.php';
|
||||
OC::$CLASSPATH['OC_Mount_Config']='apps/files_external/lib/config.php';
|
||||
|
||||
OCP\App::registerAdmin('files_external', 'settings');
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Michael Gapczynski
|
||||
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once 'Dropbox/autoload.php';
|
||||
|
||||
class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
|
||||
|
||||
private $dropbox;
|
||||
private $metaData = array();
|
||||
|
||||
private static $tempFiles = array();
|
||||
|
||||
public function __construct($params) {
|
||||
$oauth = new Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']);
|
||||
$oauth->setToken($params['token'], $params['token_secret']);
|
||||
$this->dropbox = new Dropbox_API($oauth, 'dropbox');
|
||||
|
||||
}
|
||||
|
||||
private function getMetaData($path, $list = false) {
|
||||
if (!$list && isset($this->metaData[$path])) {
|
||||
return $this->metaData[$path];
|
||||
} else {
|
||||
if ($list) {
|
||||
$response = $this->dropbox->getMetaData($path);
|
||||
if ($response && isset($response['contents'])) {
|
||||
$contents = $response['contents'];
|
||||
// Cache folder's contents
|
||||
foreach ($contents as $file) {
|
||||
$this->metaData[$path.'/'.basename($file['path'])] = $file;
|
||||
}
|
||||
unset($response['contents']);
|
||||
$this->metaData[$path] = $response;
|
||||
}
|
||||
$this->metaData[$path] = $response;
|
||||
// Return contents of folder only
|
||||
return $contents;
|
||||
} else {
|
||||
try {
|
||||
$response = $this->dropbox->getMetaData($path, 'false');
|
||||
$this->metaData[$path] = $response;
|
||||
return $response;
|
||||
} catch (Exception $exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function mkdir($path) {
|
||||
return $this->dropbox->createFolder($path);
|
||||
}
|
||||
|
||||
public function rmdir($path) {
|
||||
return $this->dropbox->delete($path);
|
||||
}
|
||||
|
||||
public function opendir($path) {
|
||||
if ($contents = $this->getMetaData($path, true)) {
|
||||
$files = array();
|
||||
foreach ($contents as $file) {
|
||||
$files[] = basename($file['path']);
|
||||
}
|
||||
OC_FakeDirStream::$dirs['dropbox'] = $files;
|
||||
return opendir('fakedir://dropbox');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stat($path) {
|
||||
if ($metaData = $this->getMetaData($path)) {
|
||||
$stat['size'] = $metaData['bytes'];
|
||||
$stat['atime'] = time();
|
||||
$stat['mtime'] = strtotime($metaData['modified']);
|
||||
$stat['ctime'] = $stat['mtime'];
|
||||
return $stat;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function filetype($path) {
|
||||
if ($path == '' || $path == '/') {
|
||||
return 'dir';
|
||||
} else if ($metaData = $this->getMetaData($path)) {
|
||||
if ($metaData['is_dir'] == 'true') {
|
||||
return 'dir';
|
||||
} else {
|
||||
return 'file';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function is_readable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function is_writable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function file_exists($path) {
|
||||
if ($path == '' || $path == '/') {
|
||||
return true;
|
||||
}
|
||||
if ($this->getMetaData($path)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function unlink($path) {
|
||||
return $this->dropbox->delete($path);
|
||||
}
|
||||
|
||||
public function fopen($path, $mode) {
|
||||
switch ($mode) {
|
||||
case 'r':
|
||||
case 'rb':
|
||||
$tmpFile = OC_Helper::tmpFile();
|
||||
file_put_contents($tmpFile, $this->dropbox->getFile($path));
|
||||
return fopen($tmpFile, 'r');
|
||||
case 'w':
|
||||
case 'wb':
|
||||
case 'a':
|
||||
case 'ab':
|
||||
case 'r+':
|
||||
case 'w+':
|
||||
case 'wb+':
|
||||
case 'a+':
|
||||
case 'x':
|
||||
case 'x+':
|
||||
case 'c':
|
||||
case 'c+':
|
||||
if (strrpos($path, '.') !== false) {
|
||||
$ext = substr($path, strrpos($path, '.'));
|
||||
} else {
|
||||
$ext = '';
|
||||
}
|
||||
$tmpFile = OC_Helper::tmpFile($ext);
|
||||
OC_CloseStreamWrapper::$callBacks[$tmpFile] = array($this, 'writeBack');
|
||||
if ($this->file_exists($path)) {
|
||||
$source = $this->fopen($path, 'r');
|
||||
file_put_contents($tmpFile, $source);
|
||||
}
|
||||
self::$tempFiles[$tmpFile] = $path;
|
||||
return fopen('close://'.$tmpFile, $mode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function writeBack($tmpFile) {
|
||||
if (isset(self::$tempFiles[$tmpFile])) {
|
||||
$handle = fopen($tmpFile, 'r');
|
||||
$response = $this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle);
|
||||
if ($response) {
|
||||
unlink($tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getMimeType($path) {
|
||||
if ($this->filetype($path) == 'dir') {
|
||||
return 'httpd/unix-directory';
|
||||
} else if ($metaData = $this->getMetaData($path)) {
|
||||
return $metaData['mime_type'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function free_space($path) {
|
||||
if ($info = $this->dropbox->getAccountInfo()) {
|
||||
return $info['quota_info']['quota'] - $info['quota_info']['normal'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function touch($path, $mtime = null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue