summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--lib/base.php3
-rw-r--r--lib/files/storage/common.php (renamed from lib/filestorage/common.php)44
-rw-r--r--lib/files/storage/commontest.php (renamed from lib/filestorage/commontest.php)10
-rw-r--r--lib/files/storage/local.php (renamed from lib/filestorage/local.php)17
-rw-r--r--lib/files/storage/storage.php (renamed from lib/filestorage.php)28
-rw-r--r--lib/files/storage/temporary.php26
-rw-r--r--lib/filestorage/temporary.php17
-rw-r--r--lib/filesystem.php12
-rw-r--r--lib/filesystemview.php12
-rwxr-xr-xlib/util.php4
-rw-r--r--tests/lib/cache/file.php2
-rw-r--r--tests/lib/filestorage.php2
-rw-r--r--tests/lib/filestorage/commontest.php2
-rw-r--r--tests/lib/filestorage/local.php2
-rw-r--r--tests/lib/filesystem.php4
35 files changed, 205 insertions, 191 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/');
}
/**
diff --git a/lib/base.php b/lib/base.php
index 1c6cc70b0e8..3b2ab8d5ebe 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -81,6 +81,9 @@ class OC{
elseif(strpos($className, 'OC_')===0) {
$path = strtolower(str_replace('_', '/', substr($className, 3)) . '.php');
}
+ elseif(strpos($className, 'OC\\')===0) {
+ $path = strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
+ }
elseif(strpos($className, 'OCP\\')===0) {
$path = 'public/'.strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
}
diff --git a/lib/filestorage/common.php b/lib/files/storage/common.php
index 351714437c5..0a60ff757eb 100644
--- a/lib/filestorage/common.php
+++ b/lib/files/storage/common.php
@@ -1,38 +1,26 @@
<?php
-
/**
-* ownCloud
-*
-* @author Michael Gapczynski
-* @copyright 2012 Michael Gapczynski GapczynskiM@gmail.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/>.
-*/
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
/**
* Storage backend class for providing common filesystem operation methods
* which are not storage-backend specific.
*
- * OC_Filestorage_Common is never used directly; it is extended by all other
+ * \OC\Files\Storage\Common is never used directly; it is extended by all other
* storage backends, where its methods may be overridden, and additional
* (backend-specific) methods are defined.
*
- * Some OC_Filestorage_Common methods call functions which are first defined
+ * Some \OC\Files\Storage\Common methods call functions which are first defined
* in classes which extend it, e.g. $this->stat() .
*/
-abstract class OC_Filestorage_Common extends OC_Filestorage {
+abstract class Common extends \OC\Files\Storage\Storage {
public function __construct($parameters) {}
// abstract public function mkdir($path);
@@ -104,7 +92,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
public function copy($path1,$path2) {
$source=$this->fopen($path1,'r');
$target=$this->fopen($path2,'w');
- $count=OC_Helper::streamCopy($source,$target);
+ $count=\OC_Helper::streamCopy($source,$target);
return $count>0;
}
// abstract public function fopen($path,$mode);
@@ -198,9 +186,9 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
}else{
$extension='';
}
- $tmpFile=OC_Helper::tmpFile($extension);
+ $tmpFile=\OC_Helper::tmpFile($extension);
file_put_contents($tmpFile,$head);
- $mime=OC_Helper::getMimeType($tmpFile);
+ $mime=\OC_Helper::getMimeType($tmpFile);
unlink($tmpFile);
return $mime;
}
@@ -227,13 +215,13 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
}else{
$extension='';
}
- $tmpFile=OC_Helper::tmpFile($extension);
+ $tmpFile=\OC_Helper::tmpFile($extension);
$target=fopen($tmpFile,'w');
- OC_Helper::streamCopy($source,$target);
+ \OC_Helper::streamCopy($source,$target);
return $tmpFile;
}
public function getLocalFolder($path) {
- $baseDir=OC_Helper::tmpFolder();
+ $baseDir=\OC_Helper::tmpFolder();
$this->addLocalFolder($path,$baseDir);
return $baseDir;
}
diff --git a/lib/filestorage/commontest.php b/lib/files/storage/commontest.php
index b88bb232c36..773bfffcb49 100644
--- a/lib/filestorage/commontest.php
+++ b/lib/files/storage/commontest.php
@@ -22,18 +22,20 @@
*/
/**
- * test implementation for OC_FileStorage_Common with OC_FileStorage_Local
+ * test implementation for \OC\Files\Storage\Common with \OC\Files\Storage\Local
*/
-class OC_Filestorage_CommonTest extends OC_Filestorage_Common{
+namespace OC\Files\Storage;
+
+class CommonTest extends \OC\Files\Storage\Common{
/**
* underlying local storage used for missing functions
- * @var OC_FileStorage_Local
+ * @var \OC\Files\Storage\Local
*/
private $storage;
public function __construct($params) {
- $this->storage=new OC_Filestorage_Local($params);
+ $this->storage=new \OC\Files\Storage\Local($params);
}
public function mkdir($path) {
diff --git a/lib/filestorage/local.php b/lib/files/storage/local.php
index e26d3d3ef91..e47441499a1 100644
--- a/lib/filestorage/local.php
+++ b/lib/files/storage/local.php
@@ -1,8 +1,17 @@
<?php
/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
+
+/**
* for local filestore, we only have to map the paths
*/
-class OC_Filestorage_Local extends OC_Filestorage_Common{
+class Local extends \OC\Files\Storage\Common{
protected $datadir;
public function __construct($arguments) {
$this->datadir=$arguments['datadir'];
@@ -86,11 +95,11 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
}
public function rename($path1,$path2) {
if (!$this->isUpdatable($path1)) {
- OC_Log::write('core','unable to rename, file is not writable : '.$path1,OC_Log::ERROR);
+ \OC_Log::write('core','unable to rename, file is not writable : '.$path1,\OC_Log::ERROR);
return false;
}
if(! $this->file_exists($path1)) {
- OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR);
+ \OC_Log::write('core','unable to rename, file does not exists : '.$path1,\OC_Log::ERROR);
return false;
}
@@ -129,7 +138,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
public function getMimeType($path) {
if($this->isReadable($path)) {
- return OC_Helper::getMimeType($this->datadir.$path);
+ return \OC_Helper::getMimeType($this->datadir.$path);
}else{
return false;
}
diff --git a/lib/filestorage.php b/lib/files/storage/storage.php
index 5bfd09253d5..a2f6cb7ec34 100644
--- a/lib/filestorage.php
+++ b/lib/files/storage/storage.php
@@ -1,29 +1,17 @@
<?php
-
/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2012 Frank Karlitschek frank@owncloud.org
-*
-* 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/>.
-*/
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
/**
* Provde a common interface to all different storage options
*/
-abstract class OC_Filestorage{
+abstract class Storage{
abstract public function __construct($parameters);
abstract public function mkdir($path);
abstract public function rmdir($path);
diff --git a/lib/files/storage/temporary.php b/lib/files/storage/temporary.php
new file mode 100644
index 00000000000..0e69c9112ac
--- /dev/null
+++ b/lib/files/storage/temporary.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
+
+/**
+ * local storage backnd in temporary folder for testing purpores
+ */
+class Temporary extends OC\Files\Storage\Local{
+ public function __construct($arguments) {
+ $this->datadir=\OC_Helper::tmpFolder();
+ }
+
+ public function cleanUp() {
+ \OC_Helper::rmdirr($this->datadir);
+ }
+
+ public function __destruct() {
+ $this->cleanUp();
+ }
+}
diff --git a/lib/filestorage/temporary.php b/lib/filestorage/temporary.php
deleted file mode 100644
index 876ba045a63..00000000000
--- a/lib/filestorage/temporary.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * local storage backnd in temporary folder for testing purpores
- */
-class OC_Filestorage_Temporary extends OC_Filestorage_Local{
- public function __construct($arguments) {
- $this->datadir=OC_Helper::tmpFolder();
- }
-
- public function cleanUp() {
- OC_Helper::rmdirr($this->datadir);
- }
-
- public function __destruct() {
- $this->cleanUp();
- }
-}
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 92eb4fa4778..9b022d8fef5 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -48,7 +48,7 @@ class OC_Filesystem{
static private $mounts=array();
public static $loaded=false;
/**
- * @var OC_Filestorage $defaultInstance
+ * @var \OC\Files\Storage\Storage $defaultInstance
*/
static private $defaultInstance;
@@ -181,7 +181,7 @@ class OC_Filesystem{
/**
* get the storage object for a path
* @param string path
- * @return OC_Filestorage
+ * @return \OC\Files\Storage\Storage
*/
static public function getStorage($path) {
$mountpoint=self::getMountPoint($path);
@@ -276,7 +276,7 @@ class OC_Filesystem{
* create a new storage of a specific type
* @param string type
* @param array arguments
- * @return OC_Filestorage
+ * @return \OC\Files\Storage\Storage
*/
static private function createStorage($class,$arguments) {
if(class_exists($class)) {
@@ -320,9 +320,9 @@ class OC_Filesystem{
}
/**
- * mount an OC_Filestorage in our virtual filesystem
- * @param OC_Filestorage storage
- * @param string mountpoint
+ * mount an \OC\Files\Storage\Storage in our virtual filesystem
+ * @param \OC\Files\Storage\Storage storage
+ * @param string mountpoint
*/
static public function mount($class,$arguments,$mountpoint) {
if($mountpoint[0]!='/') {
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 743f9403011..36fef485513 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -35,7 +35,7 @@
* are triggered correctly.
*
* Filesystem functions are not called directly; they are passed to the correct
- * OC_Filestorage object
+ * \OC\Files\Storage\Storage object
*/
class OC_FilesystemView {
@@ -115,7 +115,7 @@ class OC_FilesystemView {
/**
* get the storage object for a path
* @param string path
- * @return OC_Filestorage
+ * @return \OC\Files\Storage\Storage
*/
public function getStorage($path) {
if (!isset($this->storage_cache[$path])) {
@@ -161,7 +161,7 @@ class OC_FilesystemView {
/**
* the following functions operate with arguments and return values identical
* to those of their PHP built-in equivalents. Mostly they are merely wrappers
- * for OC_Filestorage via basicOperation().
+ * for \OC\Files\Storage\Storage via basicOperation().
*/
public function mkdir($path) {
return $this->basicOperation('mkdir', $path, array('create', 'write'));
@@ -173,7 +173,7 @@ class OC_FilesystemView {
return $this->basicOperation('opendir', $path, array('read'));
}
public function readdir($handle) {
- $fsLocal= new OC_Filestorage_Local( array( 'datadir' => '/' ) );
+ $fsLocal= new \OC\Files\Storage\Local( array( 'datadir' => '/' ) );
return $fsLocal->readdir( $handle );
}
public function is_dir($path) {
@@ -540,7 +540,7 @@ class OC_FilesystemView {
}
/**
- * @brief abstraction layer for basic filesystem functions: wrapper for OC_Filestorage
+ * @brief abstraction layer for basic filesystem functions: wrapper for \OC\Files\Storage\Storage
* @param string $operation
* @param string #path
* @param array (optional) hooks
@@ -549,7 +549,7 @@ class OC_FilesystemView {
*
* This method takes requests for basic filesystem functions (e.g. reading & writing
* files), processes hooks and proxies, sanitises paths, and finally passes them on to
- * OC_Filestorage for delegation to a storage backend for execution
+ * \OC\Files\Storage\Storage for delegation to a storage backend for execution
*/
private function basicOperation($operation, $path, $hooks=array(), $extraParam=null) {
$postFix=(substr($path,-1,1)==='/')?'/':'';
diff --git a/lib/util.php b/lib/util.php
index 5046550d6a2..78976c96606 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -34,7 +34,7 @@ class OC_Util {
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage
if(!self::$rootMounted) {
- OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY),'/');
+ OC_Filesystem::mount('\OC\Files\Storage\Local',array('datadir'=>$CONFIG_DATADIRECTORY),'/');
self::$rootMounted=true;
}
@@ -46,7 +46,7 @@ class OC_Util {
mkdir( $userdirectory, 0755, true );
}
//jail the user into his "home" directory
- OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $user_root), $user);
+ OC_Filesystem::mount('\OC\Files\Storage\Local', array('datadir' => $user_root), $user);
OC_Filesystem::init($user_dir);
$quotaProxy=new OC_FileProxy_Quota();
OC_FileProxy::register($quotaProxy);
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php
index 00be005d08d..1dd1ff7fa87 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/file.php
@@ -39,7 +39,7 @@ class Test_Cache_File extends Test_Cache {
//set up temporary storage
OC_Filesystem::clearMounts();
- OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
+ OC_Filesystem::mount('\OC\Files\Storage\Temporary',array(),'/');
OC_User::clearBackends();
OC_User::useBackend(new OC_User_Dummy());
diff --git a/tests/lib/filestorage.php b/tests/lib/filestorage.php
index 3f7bb7b62dc..bfb40bcd674 100644
--- a/tests/lib/filestorage.php
+++ b/tests/lib/filestorage.php
@@ -22,7 +22,7 @@
abstract class Test_FileStorage extends UnitTestCase {
/**
- * @var OC_Filestorage instance
+ * @var \OC\Files\Storage\Storage instance
*/
protected $instance;
diff --git a/tests/lib/filestorage/commontest.php b/tests/lib/filestorage/commontest.php
index 89e83589e5d..0e52e916789 100644
--- a/tests/lib/filestorage/commontest.php
+++ b/tests/lib/filestorage/commontest.php
@@ -30,7 +30,7 @@ class Test_Filestorage_CommonTest extends Test_FileStorage {
if(!file_exists($this->tmpDir)) {
mkdir($this->tmpDir);
}
- $this->instance=new OC_Filestorage_CommonTest(array('datadir'=>$this->tmpDir));
+ $this->instance=new \OC\Files\Storage\CommonTest(array('datadir'=>$this->tmpDir));
}
public function tearDown() {
diff --git a/tests/lib/filestorage/local.php b/tests/lib/filestorage/local.php
index f68fb69b97f..7bb27830baa 100644
--- a/tests/lib/filestorage/local.php
+++ b/tests/lib/filestorage/local.php
@@ -27,7 +27,7 @@ class Test_Filestorage_Local extends Test_FileStorage {
private $tmpDir;
public function setUp() {
$this->tmpDir=OC_Helper::tmpFolder();
- $this->instance=new OC_Filestorage_Local(array('datadir'=>$this->tmpDir));
+ $this->instance=new \OC\Files\Storage\Local(array('datadir'=>$this->tmpDir));
}
public function tearDown() {
diff --git a/tests/lib/filesystem.php b/tests/lib/filesystem.php
index 1cfa35e305d..5f5d393ed51 100644
--- a/tests/lib/filesystem.php
+++ b/tests/lib/filesystem.php
@@ -46,13 +46,13 @@ class Test_Filesystem extends UnitTestCase{
}
public function testMount() {
- OC_Filesystem::mount('OC_Filestorage_Local',self::getStorageData(),'/');
+ OC_Filesystem::mount('\OC\Files\Storage\Local',self::getStorageData(),'/');
$this->assertEqual('/',OC_Filesystem::getMountPoint('/'));
$this->assertEqual('/',OC_Filesystem::getMountPoint('/some/folder'));
$this->assertEqual('',OC_Filesystem::getInternalPath('/'));
$this->assertEqual('some/folder',OC_Filesystem::getInternalPath('/some/folder'));
- OC_Filesystem::mount('OC_Filestorage_Local',self::getStorageData(),'/some');
+ OC_Filesystem::mount('\OC\Files\Storage\Local',self::getStorageData(),'/some');
$this->assertEqual('/',OC_Filesystem::getMountPoint('/'));
$this->assertEqual('/some/',OC_Filesystem::getMountPoint('/some/folder'));
$this->assertEqual('/some/',OC_Filesystem::getMountPoint('/some/'));