summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/ajax/addRootCertificate.php12
-rw-r--r--apps/files_external/appinfo/app.php16
-rw-r--r--apps/files_external/lib/amazons3.php20
-rwxr-xr-xapps/files_external/lib/config.php22
-rwxr-xr-xapps/files_external/lib/dropbox.php60
-rw-r--r--apps/files_external/lib/ftp.php17
-rw-r--r--apps/files_external/lib/google.php33
-rw-r--r--apps/files_external/lib/smb.php9
-rw-r--r--apps/files_external/lib/streamwrapper.php5
-rw-r--r--apps/files_external/lib/swift.php84
-rw-r--r--apps/files_external/lib/webdav.php48
-rwxr-xr-xapps/files_external/personal.php2
-rw-r--r--apps/files_external/tests/amazons3.php8
-rw-r--r--apps/files_external/tests/config.php2
-rw-r--r--apps/files_external/tests/dropbox.php6
-rw-r--r--apps/files_external/tests/ftp.php8
-rw-r--r--apps/files_external/tests/google.php5
-rw-r--r--apps/files_external/tests/smb.php9
-rw-r--r--apps/files_external/tests/swift.php6
-rw-r--r--apps/files_external/tests/webdav.php7
20 files changed, 219 insertions, 160 deletions
diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php
index e0a0239c954..6fef9aac1ed 100644
--- a/apps/files_external/ajax/addRootCertificate.php
+++ b/apps/files_external/ajax/addRootCertificate.php
@@ -3,23 +3,23 @@
OCP\JSON::checkAppEnabled('files_external');
if ( !($filename = $_FILES['rootcert_import']['name']) ) {
- header("Location: settings/personal.php");
+ header("Location: settings/personal.php");
exit;
}
-$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r');
-$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name']));
+$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r');
+$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name']));
fclose($fh);
$filename = $_FILES['rootcert_import']['name'];
-
-$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_external/uploads');
+
+$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files_external/uploads');
if (!$view->file_exists('')) $view->mkdir('');
$isValid = openssl_pkey_get_public($data);
//maybe it was just the wrong file format, try to convert it...
if ($isValid == false) {
- $data = chunk_split(base64_encode($data), 64, "\n");
+ $data = chunk_split(base64_encode($data), 64, "\n");
$data = "-----BEGIN CERTIFICATE-----\n".$data."-----END CERTIFICATE-----\n";
$isValid = openssl_pkey_get_public($data);
}
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..832127d3e79 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -20,20 +20,24 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace OC\Files\Storage;
+
require_once 'aws-sdk/sdk.class.php';
-class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
+class AmazonS3 extends \OC\Files\Storage\Common {
private $s3;
private $bucket;
private $objects = array();
+ private $id;
private static $tempFiles = array();
// 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->id = 'amazon::'.$params['key'] . md5($params['secret']);
+ $this->s3 = new \AmazonS3(array('key' => $params['key'], 'secret' => $params['secret']));
$this->bucket = $params['bucket'];
}
@@ -57,6 +61,10 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
return false;
}
+ public function getId(){
+ return $this->id;
+ }
+
public function mkdir($path) {
// Folders in Amazon S3 are 0 byte objects with a '/' at the end of the name
if (substr($path, -1) != '/') {
@@ -96,7 +104,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 +168,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 +192,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 0a576f06f1f..3ba86cf148b 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://'))
);
}
@@ -139,14 +139,14 @@ 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;
}
- $view = new OC_FilesystemView('/'.OCP\User::getUser().'/files');
+ $view = new \OC\Files\View('/'.OCP\User::getUser().'/files');
self::addMountPointDirectory($view, ltrim($mountPoint, '/'));
$mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/');
} else {
- $view = new OC_FilesystemView('/');
+ $view = new \OC\Files\View('/');
switch ($mountType) {
case 'user':
if ($applicable == "all") {
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index c8220832702..0f7593162e4 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -20,25 +20,29 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace OC\Files\Storage;
+
require_once 'Dropbox/autoload.php';
-class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
+class Dropbox extends \OC\Files\Storage\Common {
private $dropbox;
private $root;
+ private $id;
private $metaData = array();
private static $tempFiles = array();
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'])) {
+ $this->id = 'dropbox::'.$params['app_key'] . $params['token']. '/' . $params['root'];
$this->root=isset($params['root'])?$params['root']:'';
- $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');
$this->mkdir('');
} else {
- throw new Exception('Creating OC_Filestorage_Dropbox storage failed');
+ throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed');
}
}
@@ -50,8 +54,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
if ($list) {
try {
$response = $this->dropbox->getMetaData($path);
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
if ($response && isset($response['contents'])) {
@@ -71,21 +75,25 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
$response = $this->dropbox->getMetaData($path, 'false');
$this->metaData[$path] = $response;
return $response;
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
}
}
+ public function getId(){
+ return $this->id;
+ }
+
public function mkdir($path) {
$path = $this->root.$path;
try {
$this->dropbox->createFolder($path);
return true;
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
@@ -100,7 +108,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;
@@ -153,8 +161,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
try {
$this->dropbox->delete($path);
return true;
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
@@ -165,8 +173,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
try {
$this->dropbox->move($path1, $path2);
return true;
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
@@ -177,8 +185,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
try {
$this->dropbox->copy($path1, $path2);
return true;
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
@@ -188,13 +196,13 @@ 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);
return fopen($tmpFile, 'r');
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
case 'w':
@@ -214,8 +222,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);
@@ -232,8 +240,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
try {
$this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle);
unlink($tmpFile);
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
}
}
}
@@ -251,8 +259,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
try {
$info = $this->dropbox->getAccountInfo();
return $info['quota_info']['quota'] - $info['quota_info']['normal'];
- } catch (Exception $exception) {
- OCP\Util::writeLog('files_external', $exception->getMessage(), OCP\Util::ERROR);
+ } catch (\Exception $exception) {
+ \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
}
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index 261141455cc..dea44728f3c 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;
@@ -24,15 +26,19 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
if(!$this->root || $this->root[0]!='/') {
$this->root='/'.$this->root;
}
- //create the root folder if necesary
+ //create the root folder if necessary
if (!$this->is_dir('')) {
$this->mkdir('');
}
}
+ public function getId(){
+ return 'ftp::' . $this->user . '@' . $this->host . '/' . $this->root;
+ }
+
/**
* construct the ftp url
- * @param string path
+ * @param string $path
* @return string
*/
public function constructUrl($path) {
@@ -68,14 +74,15 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
}else{
$ext='';
}
- $tmpFile=OCP\Files::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ $tmpFile=\OCP\Files::tmpFile($ext);
+ \OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
if($this->file_exists($path)) {
$this->getFile($path,$tmpFile);
}
self::$tempFiles[$tmpFile]=$path;
return fopen('close://'.$tmpFile,$mode);
}
+ return false;
}
public function writeBack($tmpFile) {
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 9b83dcee537..141fc619e35 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -20,14 +20,17 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace OC\Files\Storage;
+
require_once 'Google/common.inc.php';
-class OC_Filestorage_Google extends OC_Filestorage_Common {
+class Google extends \OC\Files\Storage\Common {
private $consumer;
private $oauth_token;
private $sig_method;
private $entries;
+ private $id;
private static $tempFiles = array();
@@ -35,12 +38,13 @@ 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->id = 'google::' . $consumer_key . $consumer_secret;
+ $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');
}
}
@@ -58,7 +62,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
$tempStr .= '&' . urlencode($key) . '=' . urlencode($value);
}
$uri = preg_replace('/&/', '?', $tempStr, 1);
- $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->oauth_token, $httpMethod, $uri, $params);
+ $request = \OAuthRequest::from_consumer_and_token($this->consumer, $this->oauth_token, $httpMethod, $uri, $params);
$request->sign_request($this->sig_method, $this->consumer, $this->oauth_token);
$auth_header = $request->to_header();
$headers = array($auth_header, 'GData-Version: 3.0');
@@ -96,7 +100,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);
}
@@ -125,7 +129,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
private function getFeed($feedUri, $httpMethod, $postData = null) {
$result = $this->sendRequest($feedUri, $httpMethod, $postData);
if ($result) {
- $dom = new DOMDocument();
+ $dom = new \DOMDocument();
$dom->loadXML($result);
return $dom;
}
@@ -175,6 +179,9 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
}
}
+ public function getId(){
+ return $this->id;
+ }
public function mkdir($path) {
$collection = dirname($path);
@@ -241,7 +248,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
$this->entries[$name] = $entry;
}
}
- OC_FakeDirStream::$dirs['google'.$path] = $files;
+ \OC_FakeDirStream::$dirs['google'.$path] = $files;
return opendir('fakedir://google'.$path);
}
@@ -399,8 +406,8 @@ class OC_Filestorage_Google 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);
@@ -438,7 +445,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"?>';
@@ -537,4 +544,4 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
}
-} \ No newline at end of file
+}
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index eed2582dc99..dfba3105ecb 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -6,9 +6,11 @@
* See the COPYING-README file.
*/
+namespace OC\Files\Storage;
+
require_once 'smb4php/smb.php';
-class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
+class SMB extends \OC\Files\Storage\StreamWrapper{
private $password;
private $user;
private $host;
@@ -40,6 +42,10 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
}
}
+ public function getId(){
+ return 'smb::' . $this->user . '@' . $this->host . '/' . $this->share . '/' . $this->root;
+ }
+
public function constructUrl($path) {
if(substr($path,-1)=='/') {
$path=substr($path,0,-1);
@@ -64,6 +70,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
/**
* check if a file or folder has been updated since $time
+ * @param string $path
* @param int $time
* @return bool
*/
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 4b0b8c25fda..4b3f38166dc 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -6,24 +6,27 @@
* See the COPYING-README file.
*/
+namespace OC\Files\Storage;
+
require_once 'php-cloudfiles/cloudfiles.php';
-class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
+class SWIFT extends \OC\Files\Storage\Common{
+ private $id;
private $host;
private $root;
private $user;
private $token;
private $secure;
/**
- * @var CF_Authentication auth
+ * @var \CF_Authentication auth
*/
private $auth;
/**
- * @var CF_Connection conn
+ * @var \CF_Connection conn
*/
private $conn;
/**
- * @var CF_Container rootContainer
+ * @var \CF_Container rootContainer
*/
private $rootContainer;
@@ -35,7 +38,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* translate directory path to container name
- * @param string path
+ * @param string $path
* @return string
*/
private function getContainerName($path) {
@@ -45,8 +48,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* get container by path
- * @param string path
- * @return CF_Container
+ * @param string $path
+ * @return \CF_Container
*/
private function getContainer($path) {
if($path=='' or $path=='/') {
@@ -59,15 +62,15 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$container=$this->conn->get_container($this->getContainerName($path));
$this->containers[$path]=$container;
return $container;
- }catch(NoSuchContainerException $e) {
+ }catch(\NoSuchContainerException $e) {
return null;
}
}
/**
* create container
- * @param string path
- * @return CF_Container
+ * @param string $path
+ * @return \CF_Container
*/
private function createContainer($path) {
if($path=='' or $path=='/' or $path=='.') {
@@ -89,8 +92,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* get object by path
- * @param string path
- * @return CF_Object
+ * @param string $path
+ * @return \CF_Object
*/
private function getObject($path) {
if(isset($this->objects[$path])) {
@@ -107,7 +110,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$obj=$container->get_object(basename($path));
$this->objects[$path]=$obj;
return $obj;
- }catch(NoSuchObjectException $e) {
+ }catch(\NoSuchObjectException $e) {
return null;
}
}
@@ -132,8 +135,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* create object
- * @param string path
- * @return CF_Object
+ * @param string $path
+ * @return \CF_Object
*/
private function createObject($path) {
$container=$this->getContainer(dirname($path));
@@ -154,7 +157,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* check if container for path exists
- * @param string path
+ * @param string $path
* @return bool
*/
private function containerExists($path) {
@@ -163,15 +166,15 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* get the list of emulated sub containers
- * @param CF_Container container
+ * @param \CF_Container $container
* @return array
*/
private function getSubContainers($container) {
- $tmpFile=OCP\Files::tmpFile();
+ $tmpFile=\OCP\Files::tmpFile();
$obj=$this->getSubContainerFile($container);
try{
$obj->save_to_filename($tmpFile);
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return array();
}
$obj->save_to_filename($tmpFile);
@@ -185,15 +188,15 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* add an emulated sub container
- * @param CF_Container container
- * @param string name
+ * @param CF_Container $container
+ * @param string $name
* @return bool
*/
private function addSubContainer($container,$name) {
if(!$name) {
return false;
}
- $tmpFile=OCP\Files::tmpFile();
+ $tmpFile=\OCP\Files::tmpFile();
$obj=$this->getSubContainerFile($container);
try{
$obj->save_to_filename($tmpFile);
@@ -208,8 +211,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$fh=fopen($tmpFile,'a');
fwrite($fh,$name."\n");
}
- }catch(Exception $e) {
- $containers=array();
+ }catch(\Exception $e) {
file_put_contents($tmpFile,$name."\n");
}
@@ -220,20 +222,20 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* remove an emulated sub container
- * @param CF_Container container
- * @param string name
+ * @param CF_Container $container
+ * @param string $name
* @return bool
*/
private function removeSubContainer($container,$name) {
if(!$name) {
return false;
}
- $tmpFile=OCP\Files::tmpFile();
+ $tmpFile=\OCP\Files::tmpFile();
$obj=$this->getSubContainerFile($container);
try{
$obj->save_to_filename($tmpFile);
$containers=file($tmpFile);
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return false;
}
foreach($containers as &$sub) {
@@ -255,13 +257,13 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* ensure a subcontainer file exists and return it's object
- * @param CF_Container container
- * @return CF_Object
+ * @param \CF_Container $container
+ * @return \CF_Object
*/
private function getSubContainerFile($container) {
try{
return $container->get_object(self::SUBCONTAINER_FILE);
- }catch(NoSuchObjectException $e) {
+ }catch(\NoSuchObjectException $e) {
return $container->create_object(self::SUBCONTAINER_FILE);
}
}
@@ -272,13 +274,15 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$this->user=$params['user'];
$this->root=isset($params['root'])?$params['root']:'/';
$this->secure=isset($params['secure'])?(bool)$params['secure']:true;
+
+ $this->id = 'swift::' . $this->user . '@' . $this->host . '/' . $this->root;
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->rootContainer=$this->createContainer('/');
@@ -287,6 +291,10 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
}
+ public function getId(){
+ return $this->id;
+ }
+
public function mkdir($path) {
if($this->containerExists($path)) {
@@ -344,7 +352,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);
}
@@ -432,7 +440,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);
}
@@ -517,11 +525,11 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
private function getTmpFile($path) {
$obj=$this->getObject($path);
if(!is_null($obj)) {
- $tmpFile=OCP\Files::tmpFile();
+ $tmpFile=\OCP\Files::tmpFile();
$obj->save_to_filename($tmpFile);
return $tmpFile;
}else{
- return OCP\Files::tmpFile();
+ return \OCP\Files::tmpFile();
}
}
@@ -536,7 +544,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
/**
* remove custom mtime metadata
- * @param CF_Object obj
+ * @param \CF_Object $obj
*/
private function resetMTime($obj) {
if(isset($obj->metadata['Mtime'])) {
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 5e185839158..73231b6ad81 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -6,14 +6,16 @@
* 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;
private $secure;
private $root;
/**
- * @var Sabre_DAV_Client
+ * @var \Sabre_DAV_Client
*/
private $client;
@@ -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';
@@ -54,6 +56,10 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$this->mkdir('');
}
+ public function getId(){
+ return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root;
+ }
+
private function createBaseUri() {
$baseUri='http';
if($this->secure) {
@@ -78,15 +84,15 @@ 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) {
+ }catch(\Exception $e) {
return false;
}
}
@@ -97,7 +103,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$response=$this->client->propfind($path, array('{DAV:}resourcetype'));
$responseType=$response["{DAV:}resourcetype"]->resourceType;
return (count($responseType)>0 and $responseType[0]=="{DAV:}collection")?'dir':'file';
- }catch(Exception $e) {
+ }catch(\Exception $e) {
error_log($e->getMessage());
\OCP\Util::writeLog("webdav client", \OCP\Util::sanitizeHTML($e->getMessage()), \OCP\Util::ERROR);
return false;
@@ -117,7 +123,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
try{
$this->client->propfind($path, array('{DAV:}resourcetype'));
return true;//no 404 exception
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return false;
}
}
@@ -163,8 +169,8 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}else{
$ext='';
}
- $tmpFile=OCP\Files::tmpFile($ext);
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
+ $tmpFile=\OCP\Files::tmpFile($ext);
+ \OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
if($this->file_exists($path)) {
$this->getFile($path,$tmpFile);
}
@@ -189,7 +195,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}else{
return 0;
}
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return 0;
}
}
@@ -225,12 +231,9 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2);
try{
- $response=$this->client->request('MOVE',$path1,null,array('Destination'=>$path2));
+ $this->client->request('MOVE',$path1,null,array('Destination'=>$path2));
return true;
- }catch(Exception $e) {
- echo $e;
- echo 'fail';
- var_dump($response);
+ }catch(\Exception $e) {
return false;
}
}
@@ -239,12 +242,9 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path1=$this->cleanPath($path1);
$path2=$this->root.$this->cleanPath($path2);
try{
- $response=$this->client->request('COPY',$path1,null,array('Destination'=>$path2));
+ $this->client->request('COPY',$path1,null,array('Destination'=>$path2));
return true;
- }catch(Exception $e) {
- echo $e;
- echo 'fail';
- var_dump($response);
+ }catch(\Exception $e) {
return false;
}
}
@@ -258,7 +258,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
'ctime'=>-1,
);
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return array();
}
}
@@ -276,7 +276,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}else{
return false;
}
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return false;
}
}
@@ -294,7 +294,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
try{
$response=$this->client->request($method,$path,$body);
return $response['statusCode']==$expected;
- }catch(Exception $e) {
+ }catch(\Exception $e) {
return false;
}
}
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 725f4ba05da..9fb377af3ba 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -20,7 +20,9 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Filestorage_AmazonS3 extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class AmazonS3 extends Storage {
private $config;
private $id;
@@ -32,12 +34,12 @@ class Test_Filestorage_AmazonS3 extends Test_FileStorage {
$this->markTestSkipped('AmazonS3 backend not configured');
}
$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() {
if ($this->instance) {
- $s3 = new AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
+ $s3 = new \AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
if ($s3->delete_all_objects($this->id)) {
$s3->delete_bucket($this->id);
}
diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php
index ff16b1c1d8a..5af317675cb 100644
--- a/apps/files_external/tests/config.php
+++ b/apps/files_external/tests/config.php
@@ -8,7 +8,7 @@ return array(
'root'=>'/test',
),
'webdav'=>array(
- 'run'=>false,
+ 'run'=>true,
'host'=>'localhost',
'user'=>'test',
'password'=>'test',
diff --git a/apps/files_external/tests/dropbox.php b/apps/files_external/tests/dropbox.php
index 56319b9f5d7..c517ef4cbb7 100644
--- a/apps/files_external/tests/dropbox.php
+++ b/apps/files_external/tests/dropbox.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_Filestorage_Dropbox extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class Dropbox extends Storage {
private $config;
public function setUp() {
@@ -16,7 +18,7 @@ class Test_Filestorage_Dropbox extends Test_FileStorage {
$this->markTestSkipped('Dropbox backend not configured');
}
$this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
- $this->instance = new OC_Filestorage_Dropbox($this->config['dropbox']);
+ $this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
}
public function tearDown() {
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index 4549c420410..3e6208e4a0d 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_Filestorage_FTP extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class FTP extends Storage {
private $config;
public function setUp() {
@@ -16,12 +18,12 @@ class Test_Filestorage_FTP extends Test_FileStorage {
$this->markTestSkipped('FTP backend not configured');
}
$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() {
if ($this->instance) {
- OCP\Files::rmdirr($this->instance->constructUrl(''));
+ \OCP\Files::rmdirr($this->instance->constructUrl(''));
}
}
}
diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php
index 46e622cc180..87b3ae4e4cc 100644
--- a/apps/files_external/tests/google.php
+++ b/apps/files_external/tests/google.php
@@ -20,8 +20,9 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Filestorage_Google extends Test_FileStorage {
+namespace Test\Files\Storage;
+class Google extends Storage {
private $config;
public function setUp() {
@@ -31,7 +32,7 @@ class Test_Filestorage_Google extends Test_FileStorage {
$this->markTestSkipped('Google backend not configured');
}
$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 2c03ef5dbd0..b4ac6db1187 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -6,7 +6,10 @@
* See the COPYING-README file.
*/
-class Test_Filestorage_SMB extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class SMB extends Storage {
+
private $config;
public function setUp() {
@@ -16,12 +19,12 @@ class Test_Filestorage_SMB extends Test_FileStorage {
$this->markTestSkipped('Samba backend not configured');
}
$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() {
if ($this->instance) {
- OCP\Files::rmdirr($this->instance->constructUrl(''));
+ \OCP\Files::rmdirr($this->instance->constructUrl(''));
}
}
}
diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php
index 8cf2a3abc76..4899d44acad 100644
--- a/apps/files_external/tests/swift.php
+++ b/apps/files_external/tests/swift.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_Filestorage_SWIFT extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class SWIFT extends Storage {
private $config;
public function setUp() {
@@ -16,7 +18,7 @@ class Test_Filestorage_SWIFT extends Test_FileStorage {
$this->markTestSkipped('OpenStack SWIFT backend not configured');
}
$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 2da88f63edd..13e3be42948 100644
--- a/apps/files_external/tests/webdav.php
+++ b/apps/files_external/tests/webdav.php
@@ -6,7 +6,10 @@
* See the COPYING-README file.
*/
-class Test_Filestorage_DAV extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class DAV extends Storage {
+
private $config;
public function setUp() {
@@ -16,7 +19,7 @@ class Test_Filestorage_DAV extends Test_FileStorage {
$this->markTestSkipped('WebDAV backend not configured');
}
$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() {