summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-07 18:30:48 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-07 18:30:48 +0200
commitbd834220959bf7edcc4cce4bfe6c77e0a4649b8b (patch)
tree6bf7987e57de953924f47f06b3018f14e0807934 /apps
parentedcd29747692ff1ffbec927b9f31ac239c5e192d (diff)
downloadnextcloud-server-bd834220959bf7edcc4cce4bfe6c77e0a4649b8b.tar.gz
nextcloud-server-bd834220959bf7edcc4cce4bfe6c77e0a4649b8b.zip
put filestorages in a namespace
Diffstat (limited to 'apps')
-rw-r--r--apps/files_encryption/tests/proxy.php2
-rw-r--r--apps/files_external/appinfo/app.php16
-rw-r--r--apps/files_external/lib/amazons3.php14
-rwxr-xr-xapps/files_external/lib/config.php18
-rwxr-xr-xapps/files_external/lib/dropbox.php18
-rw-r--r--apps/files_external/lib/ftp.php6
-rw-r--r--apps/files_external/lib/google.php18
-rw-r--r--apps/files_external/lib/smb.php4
-rw-r--r--apps/files_external/lib/streamwrapper.php5
-rw-r--r--apps/files_external/lib/swift.php12
-rw-r--r--apps/files_external/lib/webdav.php12
-rwxr-xr-xapps/files_external/personal.php2
-rw-r--r--apps/files_external/tests/amazons3.php2
-rw-r--r--apps/files_external/tests/ftp.php2
-rw-r--r--apps/files_external/tests/google.php2
-rw-r--r--apps/files_external/tests/smb.php2
-rw-r--r--apps/files_external/tests/swift.php2
-rw-r--r--apps/files_external/tests/webdav.php2
-rw-r--r--apps/files_sharing/appinfo/app.php4
-rw-r--r--apps/files_sharing/lib/sharedstorage.php68
20 files changed, 113 insertions, 98 deletions
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
index 042011a6c87..d600bbc4071 100644
--- a/apps/files_encryption/tests/proxy.php
+++ b/apps/files_encryption/tests/proxy.php
@@ -30,7 +30,7 @@ class Test_CryptProxy extends UnitTestCase {
//set up temporary storage
OC_Filesystem::clearMounts();
- OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
+ OC_Filesystem::mount('\OC\Files\Storage\Temporary',array(),'/');
OC_Filesystem::init('/'.$user.'/files');
diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php
index 837d35c9c63..c58cfcd0f5e 100644
--- a/apps/files_external/appinfo/app.php
+++ b/apps/files_external/appinfo/app.php
@@ -6,14 +6,14 @@
* See the COPYING-README file.
*/
-OC::$CLASSPATH['OC_FileStorage_StreamWrapper']='apps/files_external/lib/streamwrapper.php';
-OC::$CLASSPATH['OC_Filestorage_FTP']='apps/files_external/lib/ftp.php';
-OC::$CLASSPATH['OC_Filestorage_DAV']='apps/files_external/lib/webdav.php';
-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\Files\Storage\StreamWrapper']='apps/files_external/lib/streamwrapper.php';
+OC::$CLASSPATH['OC\Files\Storage\FTP']='apps/files_external/lib/ftp.php';
+OC::$CLASSPATH['OC\Files\Storage\DAV']='apps/files_external/lib/webdav.php';
+OC::$CLASSPATH['OC\Files\Storage\Google']='apps/files_external/lib/google.php';
+OC::$CLASSPATH['OC\Files\Storage\SWIFT']='apps/files_external/lib/swift.php';
+OC::$CLASSPATH['OC\Files\Storage\SMB']='apps/files_external/lib/smb.php';
+OC::$CLASSPATH['OC\Files\Storage\AmazonS3']='apps/files_external/lib/amazons3.php';
+OC::$CLASSPATH['OC\Files\Storage\Dropbox']='apps/files_external/lib/dropbox.php';
OC::$CLASSPATH['OC_Mount_Config']='apps/files_external/lib/config.php';
OCP\App::registerAdmin('files_external', 'settings');
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 41ec3c70b45..a17a70ed38b 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -22,7 +22,9 @@
require_once 'aws-sdk/sdk.class.php';
-class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
+namespace OC\Files\Storage;
+
+class AmazonS3 extends \OC\Files\Storage\Common {
private $s3;
private $bucket;
@@ -33,7 +35,7 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
// TODO options: storage class, encryption server side, encrypt before upload?
public function __construct($params) {
- $this->s3 = new AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
+ $this->s3 = new \AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
$this->bucket = $params['bucket'];
}
@@ -96,7 +98,7 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
foreach ($response->body->CommonPrefixes as $object) {
$files[] = basename($object->Prefix);
}
- OC_FakeDirStream::$dirs['amazons3'.$path] = $files;
+ \OC_FakeDirStream::$dirs['amazons3'.$path] = $files;
return opendir('fakedir://amazons3'.$path);
}
return false;
@@ -160,7 +162,7 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
switch ($mode) {
case 'r':
case 'rb':
- $tmpFile = OC_Helper::tmpFile();
+ $tmpFile = \OC_Helper::tmpFile();
$handle = fopen($tmpFile, 'w');
$response = $this->s3->get_object($this->bucket, $path, array('fileDownload' => $handle));
if ($response->isOK()) {
@@ -184,8 +186,8 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
} else {
$ext = '';
}
- $tmpFile = OC_Helper::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile] = array($this, 'writeBack');
+ $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);
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index eec31ec2ef9..db09fbdd82b 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -39,14 +39,14 @@ class OC_Mount_Config {
*/
public static function getBackends() {
return array(
- 'OC_Filestorage_Local' => array('backend' => 'Local', 'configuration' => array('datadir' => 'Location')),
- 'OC_Filestorage_AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('key' => 'Key', 'secret' => '*Secret', 'bucket' => 'Bucket')),
- 'OC_Filestorage_Dropbox' => array('backend' => 'Dropbox', 'configuration' => array('configured' => '#configured','app_key' => 'App key', 'app_secret' => 'App secret', 'token' => '#token', 'token_secret' => '#token_secret'), 'custom' => 'dropbox'),
- 'OC_Filestorage_FTP' => array('backend' => 'FTP', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure ftps://')),
- 'OC_Filestorage_Google' => array('backend' => 'Google Drive', 'configuration' => array('configured' => '#configured', 'token' => '#token', 'token_secret' => '#token secret'), 'custom' => 'google'),
- 'OC_Filestorage_SWIFT' => array('backend' => 'OpenStack Swift', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'token' => '*Token', 'root' => '&Root', 'secure' => '!Secure ftps://')),
- 'OC_Filestorage_SMB' => array('backend' => 'SMB', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'share' => 'Share', 'root' => '&Root')),
- 'OC_Filestorage_DAV' => array('backend' => 'WebDAV', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure https://'))
+ '\OC\Files\Storage\Local' => array('backend' => 'Local', 'configuration' => array('datadir' => 'Location')),
+ '\OC\Files\Storage\AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('key' => 'Key', 'secret' => '*Secret', 'bucket' => 'Bucket')),
+ '\OC\Files\Storage\Dropbox' => array('backend' => 'Dropbox', 'configuration' => array('configured' => '#configured','app_key' => 'App key', 'app_secret' => 'App secret', 'token' => '#token', 'token_secret' => '#token_secret'), 'custom' => 'dropbox'),
+ '\OC\Files\Storage\FTP' => array('backend' => 'FTP', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure ftps://')),
+ '\OC\Files\Storage\Google' => array('backend' => 'Google Drive', 'configuration' => array('configured' => '#configured', 'token' => '#token', 'token_secret' => '#token secret'), 'custom' => 'google'),
+ '\OC\Files\Storage\SWIFT' => array('backend' => 'OpenStack Swift', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'token' => '*Token', 'root' => '&Root', 'secure' => '!Secure ftps://')),
+ '\OC\Files\Storage\SMB' => array('backend' => 'SMB', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'share' => 'Share', 'root' => '&Root')),
+ '\OC\Files\Storage\DAV' => array('backend' => 'WebDAV', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure https://'))
);
}
@@ -124,7 +124,7 @@ class OC_Mount_Config {
if ($isPersonal) {
// Verify that the mount point applies for the current user
// Prevent non-admin users from mounting local storage
- if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') {
+ if ($applicable != OCP\User::getUser() || $class == '\OC\Files\Storage\Local') {
return false;
}
$mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/');
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index bb86894e55e..746364668f0 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -22,7 +22,9 @@
require_once 'Dropbox/autoload.php';
-class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
+namespace OC\Files\Storage;
+
+class Dropbox extends \OC\Files\Storage\Common {
private $dropbox;
private $metaData = array();
@@ -31,11 +33,11 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
public function __construct($params) {
if (isset($params['configured']) && $params['configured'] == 'true' && isset($params['app_key']) && isset($params['app_secret']) && isset($params['token']) && isset($params['token_secret'])) {
- $oauth = new Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']);
+ $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');
+ $this->dropbox = new \Dropbox_API($oauth, 'dropbox');
} else {
- throw new Exception('Creating OC_Filestorage_Dropbox storage failed');
+ throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed');
}
}
@@ -95,7 +97,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
foreach ($contents as $file) {
$files[] = basename($file['path']);
}
- OC_FakeDirStream::$dirs['dropbox'.$path] = $files;
+ \OC_FakeDirStream::$dirs['dropbox'.$path] = $files;
return opendir('fakedir://dropbox'.$path);
}
return false;
@@ -177,7 +179,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
switch ($mode) {
case 'r':
case 'rb':
- $tmpFile = OC_Helper::tmpFile();
+ $tmpFile = \OC_Helper::tmpFile();
try {
$data = $this->dropbox->getFile($path);
file_put_contents($tmpFile, $data);
@@ -203,8 +205,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
} else {
$ext = '';
}
- $tmpFile = OC_Helper::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile] = array($this, 'writeBack');
+ $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);
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index 261141455cc..140a21ffe13 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/ftp.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
+namespace OC\Files\Storage;
+
+class FTP extends \OC\Files\Storage\StreamWrapper{
private $password;
private $user;
private $host;
@@ -69,7 +71,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
$ext='';
}
$tmpFile=OCP\Files::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ \OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
if($this->file_exists($path)) {
$this->getFile($path,$tmpFile);
}
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 9b83dcee537..51c5d219aae 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -22,7 +22,9 @@
require_once 'Google/common.inc.php';
-class OC_Filestorage_Google extends OC_Filestorage_Common {
+namespace OC\Files\Storage;
+
+class Google extends \OC\Files\Storage\Common {
private $consumer;
private $oauth_token;
@@ -35,12 +37,12 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
if (isset($params['configured']) && $params['configured'] == 'true' && isset($params['token']) && isset($params['token_secret'])) {
$consumer_key = isset($params['consumer_key']) ? $params['consumer_key'] : 'anonymous';
$consumer_secret = isset($params['consumer_secret']) ? $params['consumer_secret'] : 'anonymous';
- $this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
- $this->oauth_token = new OAuthToken($params['token'], $params['token_secret']);
- $this->sig_method = new OAuthSignatureMethod_HMAC_SHA1();
+ $this->consumer = new \OAuthConsumer($consumer_key, $consumer_secret);
+ $this->oauth_token = new \OAuthToken($params['token'], $params['token_secret']);
+ $this->sig_method = new \OAuthSignatureMethod_HMAC_SHA1();
$this->entries = array();
} else {
- throw new Exception('Creating OC_Filestorage_Google storage failed');
+ throw new \Exception('Creating \OC\Files\Storage\Google storage failed');
}
}
@@ -96,7 +98,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
if ($isDownload) {
- $tmpFile = OC_Helper::tmpFile();
+ $tmpFile = \OC_Helper::tmpFile();
$handle = fopen($tmpFile, 'w');
curl_setopt($curl, CURLOPT_FILE, $handle);
}
@@ -399,7 +401,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
} else {
$ext = '';
}
- $tmpFile = OC_Helper::tmpFile($ext);
+ $tmpFile = \OC_Helper::tmpFile($ext);
OC_CloseStreamWrapper::$callBacks[$tmpFile] = array($this, 'writeBack');
if ($this->file_exists($path)) {
$source = $this->fopen($path, 'r');
@@ -438,7 +440,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
}
if (isset($uploadUri) && $handle = fopen($path, 'r')) {
$uploadUri .= '?convert=false';
- $mimetype = OC_Helper::getMimeType($path);
+ $mimetype = \OC_Helper::getMimeType($path);
$size = filesize($path);
$headers = array('X-Upload-Content-Type: ' => $mimetype, 'X-Upload-Content-Length: ' => $size);
$postData = '<?xml version="1.0" encoding="UTF-8"?>';
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index e5ba7a17743..d4882ed0249 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -8,7 +8,9 @@
require_once 'smb4php/smb.php';
-class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
+namespace OC\Files\Storage;
+
+class SMB extends \OC\Files\Storage\StreamWrapper{
private $password;
private $user;
private $host;
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php
index 7263ef23253..750bdbaf4d4 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/streamwrapper.php
@@ -6,8 +6,9 @@
* See the COPYING-README file.
*/
+namespace OC\Files\Storage;
-abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{
+abstract class StreamWrapper extends \OC\Files\Storage\Common{
abstract public function constructUrl($path);
public function mkdir($path) {
@@ -84,6 +85,4 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{
return stat($this->constructUrl($path));
}
-
-
}
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index c29d28b44c1..c67cf59df6b 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -8,7 +8,9 @@
require_once 'php-cloudfiles/cloudfiles.php';
-class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
+namespace OC\Files\Storage;
+
+class SWIFT extends \OC\Files\Storage\Common{
private $host;
private $root;
private $user;
@@ -272,10 +274,10 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
if(!$this->root || $this->root[0]!='/') {
$this->root='/'.$this->root;
}
- $this->auth = new CF_Authentication($this->user, $this->token, null, $this->host);
+ $this->auth = new \CF_Authentication($this->user, $this->token, null, $this->host);
$this->auth->authenticate();
- $this->conn = new CF_Connection($this->auth);
+ $this->conn = new \CF_Connection($this->auth);
if(!$this->containerExists($this->root)) {
$this->rootContainer=$this->createContainer('/');
@@ -341,7 +343,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$subContainers=$this->getSubContainers($container);
$files=array_merge($files,$subContainers);
$id=$this->getContainerName($path);
- OC_FakeDirStream::$dirs[$id]=$files;
+ \OC_FakeDirStream::$dirs[$id]=$files;
return opendir('fakedir://'.$id);
}
@@ -426,7 +428,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
case 'c':
case 'c+':
$tmpFile=$this->getTmpFile($path);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ \OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
self::$tempFiles[$tmpFile]=$path;
return fopen('close://'.$tmpFile,$mode);
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 3c18b227fa6..70210b49ee7 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class OC_FileStorage_DAV extends OC_Filestorage_Common{
+namespace OC\Files\Storage;
+
+class DAV extends \OC\Files\Storage\Common{
private $password;
private $user;
private $host;
@@ -42,7 +44,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
'password' => $this->password,
);
- $this->client = new OC_Connector_Sabre_Client($settings);
+ $this->client = new \OC_Connector_Sabre_Client($settings);
if($caview = \OCP\Files::getStorage('files_external')) {
$certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt';
@@ -78,12 +80,12 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
try{
$response=$this->client->propfind($path, array(),1);
$id=md5('webdav'.$this->root.$path);
- OC_FakeDirStream::$dirs[$id]=array();
+ \OC_FakeDirStream::$dirs[$id]=array();
$files=array_keys($response);
array_shift($files);//the first entry is the current directory
foreach($files as $file) {
$file = urldecode(basename($file));
- OC_FakeDirStream::$dirs[$id][]=$file;
+ \OC_FakeDirStream::$dirs[$id][]=$file;
}
return opendir('fakedir://'.$id);
}catch(Exception $e) {
@@ -161,7 +163,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$ext='';
}
$tmpFile=OCP\Files::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ \OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
if($this->file_exists($path)) {
$this->getFile($path,$tmpFile);
}
diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php
index f0d76460f54..a678f345c8e 100755
--- a/apps/files_external/personal.php
+++ b/apps/files_external/personal.php
@@ -24,7 +24,7 @@ OCP\Util::addScript('files_external', 'settings');
OCP\Util::addStyle('files_external', 'settings');
$backends = OC_Mount_Config::getBackends();
// Remove local storage
-unset($backends['OC_Filestorage_Local']);
+unset($backends['\OC\Files\Storage\Local']);
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', false, false);
$tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints());
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index b9b4cf65bd6..ad1c453abb7 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -34,7 +34,7 @@ if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['r
$id = uniqid();
$this->config = include('apps/files_external/tests/config.php');
$this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in
- $this->instance = new OC_Filestorage_AmazonS3($this->config['amazons3']);
+ $this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']);
}
public function tearDown() {
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index 12f3ec3908d..105f7b485bd 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -18,7 +18,7 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']) {
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
$this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in
- $this->instance=new OC_Filestorage_FTP($this->config['ftp']);
+ $this->instance=new \OC\Files\Storage\FTP($this->config['ftp']);
}
public function tearDown() {
diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php
index d2a6358ade4..e96c2263e1c 100644
--- a/apps/files_external/tests/google.php
+++ b/apps/files_external/tests/google.php
@@ -33,7 +33,7 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run'])
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
$this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in
- $this->instance=new OC_Filestorage_Google($this->config['google']);
+ $this->instance=new \OC\Files\Storage\Google($this->config['google']);
}
public function tearDown() {
diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php
index 7de4fddbb34..a0c5d834736 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -19,7 +19,7 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) {
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
$this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in
- $this->instance=new OC_Filestorage_SMB($this->config['smb']);
+ $this->instance=new \OC\Files\Storage\SMB($this->config['smb']);
}
public function tearDown() {
diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php
index a6f5eace1c8..3e1485b0f3a 100644
--- a/apps/files_external/tests/swift.php
+++ b/apps/files_external/tests/swift.php
@@ -18,7 +18,7 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']) {
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
$this->config['swift']['root'].='/'.$id;//make sure we have an new empty folder to work in
- $this->instance=new OC_Filestorage_SWIFT($this->config['swift']);
+ $this->instance=new \OC\Files\Storage\SWIFT($this->config['swift']);
}
diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php
index 74d980aa3f1..6b1121c9d0c 100644
--- a/apps/files_external/tests/webdav.php
+++ b/apps/files_external/tests/webdav.php
@@ -18,7 +18,7 @@ if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run'])
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
$this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in
- $this->instance=new OC_Filestorage_DAV($this->config['webdav']);
+ $this->instance=new \OC\Files\Storage\DAV($this->config['webdav']);
}
public function tearDown() {
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 109f86b2e87..210c78ad174 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -2,8 +2,8 @@
OC::$CLASSPATH['OC_Share_Backend_File'] = "apps/files_sharing/lib/share/file.php";
OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'apps/files_sharing/lib/share/folder.php';
-OC::$CLASSPATH['OC_Filestorage_Shared'] = "apps/files_sharing/lib/sharedstorage.php";
-OCP\Util::connectHook('OC_Filesystem', 'setup', 'OC_Filestorage_Shared', 'setup');
+OC::$CLASSPATH['OC\Files\Storage\Shared'] = "apps/files_sharing/lib/sharedstorage.php";
+OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
OCP\Util::addScript('files_sharing', 'share');
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 6dba76955a0..f1539610b02 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -20,10 +20,12 @@
*
*/
+namespace OC\Files\Storage;
+
/**
* Convert target path to source path and pass the function call to the correct storage provider
*/
-class OC_Filestorage_Shared extends OC_Filestorage_Common {
+class Shared extends \OC\Files\Storage\Common {
private $sharedFolder;
private $files = array();
@@ -50,7 +52,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if (isset($this->files[$folder])) {
$file = $this->files[$folder];
} else {
- $file = OCP\Share::getItemSharedWith('folder', $folder, OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
+ $file = OCP\Share::getItemSharedWith('folder', $folder, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
}
if ($file) {
$this->files[$target]['path'] = $file['path'].substr($target, strlen($folder));
@@ -58,7 +60,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
return $this->files[$target];
}
} else {
- $file = OCP\Share::getItemSharedWith('file', $target, OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
+ $file = OCP\Share::getItemSharedWith('file', $target, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
if ($file) {
$this->files[$target] = $file;
return $this->files[$target];
@@ -78,7 +80,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
$file = $this->getFile($target);
if (isset($file['path'])) {
$uid = substr($file['path'], 1, strpos($file['path'], '/', 1) - 1);
- OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => OC_User::getHome($uid)), $uid);
+ \OC_Filesystem::mount('\OC\Files\Storage\Local', array('datadir' => \OC_User::getHome($uid)), $uid);
return $file['path'];
}
return false;
@@ -103,7 +105,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
* @return Source file path with mount point stripped out
*/
private function getInternalPath($path) {
- $mountPoint = OC_Filesystem::getMountPoint($path);
+ $mountPoint = \OC_Filesystem::getMountPoint($path);
$internalPath = substr($path, strlen($mountPoint));
return $internalPath;
}
@@ -112,7 +114,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) {
return false;
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->mkdir($this->getInternalPath($source));
}
return false;
@@ -120,7 +122,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function rmdir($path) {
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->rmdir($this->getInternalPath($source));
}
return false;
@@ -128,11 +130,11 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function opendir($path) {
if ($path == '' || $path == '/') {
- $files = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_Folder::FORMAT_OPENDIR);
- OC_FakeDirStream::$dirs['shared'] = $files;
+ $files = OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_Folder::FORMAT_OPENDIR);
+ \OC_FakeDirStream::$dirs['shared'] = $files;
return opendir('fakedir://shared');
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->opendir($this->getInternalPath($source));
}
return false;
@@ -142,7 +144,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '' || $path == '/') {
return true;
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->is_dir($this->getInternalPath($source));
}
return false;
@@ -150,7 +152,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function is_file($path) {
if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->is_file($this->getInternalPath($source));
}
return false;
@@ -163,7 +165,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
$stat['ctime'] = $this->filectime($path);
return $stat;
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->stat($this->getInternalPath($source));
}
return false;
@@ -173,7 +175,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '' || $path == '/') {
return 'dir';
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->filetype($this->getInternalPath($source));
}
return false;
@@ -183,7 +185,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '' || $path == '/' || $this->is_dir($path)) {
return 0;
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->filesize($this->getInternalPath($source));
}
return false;
@@ -225,7 +227,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '' || $path == '/') {
return true;
} else if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->file_exists($this->getInternalPath($source));
}
return false;
@@ -246,7 +248,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
} else {
$source = $this->getSourcePath($path);
if ($source) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->filectime($this->getInternalPath($source));
}
}
@@ -267,7 +269,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
} else {
$source = $this->getSourcePath($path);
if ($source) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->filemtime($this->getInternalPath($source));
}
}
@@ -280,8 +282,8 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
'target' => $this->sharedFolder.$path,
'source' => $source,
);
- OCP\Util::emitHook('OC_Filestorage_Shared', 'file_get_contents', $info);
- $storage = OC_Filesystem::getStorage($source);
+ OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->file_get_contents($this->getInternalPath($source));
}
}
@@ -296,8 +298,8 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
'target' => $this->sharedFolder.$path,
'source' => $source,
);
- OCP\Util::emitHook('OC_Filestorage_Shared', 'file_put_contents', $info);
- $storage = OC_Filesystem::getStorage($source);
+ OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
+ $storage = \OC_Filesystem::getStorage($source);
$result = $storage->file_put_contents($this->getInternalPath($source), $data);
return $result;
}
@@ -308,7 +310,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
// Delete the file if DELETE permission is granted
if ($source = $this->getSourcePath($path)) {
if ($this->isDeletable($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->unlink($this->getInternalPath($source));
} else if (dirname($path) == '/' || dirname($path) == '.') {
// Unshare the file from the user if in the root of the Shared folder
@@ -332,7 +334,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if (dirname($path1) == dirname($path2)) {
// Rename the file if UPDATE permission is granted
if ($this->isUpdatable($path1)) {
- $storage = OC_Filesystem::getStorage($oldSource);
+ $storage = \OC_Filesystem::getStorage($oldSource);
return $storage->rename($this->getInternalPath($oldSource), $this->getInternalPath($newSource));
}
} else {
@@ -347,7 +349,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
return $this->unlink($path1);
}
} else {
- $storage = OC_Filesystem::getStorage($oldSource);
+ $storage = \OC_Filesystem::getStorage($oldSource);
return $storage->rename($this->getInternalPath($oldSource), $this->getInternalPath($newSource));
}
}
@@ -361,7 +363,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($this->isCreatable(dirname($path2))) {
$source = $this->fopen($path1, 'r');
$target = $this->fopen($path2, 'w');
- return OC_Helper::streamCopy($source, $target);
+ return \OC_Helper::streamCopy($source, $target);
}
return false;
}
@@ -392,8 +394,8 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
'source' => $source,
'mode' => $mode,
);
- OCP\Util::emitHook('OC_Filestorage_Shared', 'fopen', $info);
- $storage = OC_Filesystem::getStorage($source);
+ OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode);
}
return false;
@@ -404,7 +406,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
return 'httpd/unix-directory';
}
if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->getMimeType($this->getInternalPath($source));
}
return false;
@@ -413,21 +415,21 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function free_space($path) {
$source = $this->getSourcePath($path);
if ($source) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->free_space($this->getInternalPath($source));
}
}
public function getLocalFile($path) {
if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->getLocalFile($this->getInternalPath($source));
}
return false;
}
public function touch($path, $mtime = null) {
if ($source = $this->getSourcePath($path)) {
- $storage = OC_Filesystem::getStorage($source);
+ $storage = \OC_Filesystem::getStorage($source);
return $storage->touch($this->getInternalPath($source), $mtime);
}
return false;
@@ -435,7 +437,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public static function setup($options) {
$user_dir = $options['user_dir'];
- OC_Filesystem::mount('OC_Filestorage_Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
+ \OC_Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
}
/**