2012-03-30 16:10:16 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
|
2014-03-21 14:22:48 +00:00
|
|
|
* Copyright (c) 2014 Robin McCorkell <rmccorkell@karoshi.org.uk>
|
2012-03-30 16:10:16 +00:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
2014-08-31 08:05:59 +00:00
|
|
|
$l = \OC::$server->getL10N('files_external');
|
2012-03-30 16:10:16 +00:00
|
|
|
|
2013-03-02 11:12:33 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
|
|
|
|
OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php';
|
2013-10-09 14:54:36 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\OwnCloud'] = 'files_external/lib/owncloud.php';
|
2013-03-02 11:12:33 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\Google'] = 'files_external/lib/google.php';
|
2013-10-22 12:22:03 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\Swift'] = 'files_external/lib/swift.php';
|
2013-03-02 11:12:33 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\SMB'] = 'files_external/lib/smb.php';
|
2014-03-25 13:54:54 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\SMB_OC'] = 'files_external/lib/smb_oc.php';
|
2013-03-02 11:12:33 +00:00
|
|
|
OC::$CLASSPATH['OC\Files\Storage\AmazonS3'] = 'files_external/lib/amazons3.php';
|
|
|
|
OC::$CLASSPATH['OC\Files\Storage\Dropbox'] = 'files_external/lib/dropbox.php';
|
|
|
|
OC::$CLASSPATH['OC\Files\Storage\SFTP'] = 'files_external/lib/sftp.php';
|
|
|
|
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
|
2014-06-06 11:16:47 +00:00
|
|
|
OC::$CLASSPATH['OCA\Files\External\Api'] = 'files_external/lib/api.php';
|
2012-05-24 16:22:33 +00:00
|
|
|
|
2014-10-17 17:47:37 +00:00
|
|
|
OCP\Util::addTranslations('files_external');
|
|
|
|
|
2012-05-24 15:06:03 +00:00
|
|
|
OCP\App::registerAdmin('files_external', 'settings');
|
2012-06-08 15:42:00 +00:00
|
|
|
if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == 'yes') {
|
|
|
|
OCP\App::registerPersonal('files_external', 'personal');
|
|
|
|
}
|
2013-04-18 20:12:53 +00:00
|
|
|
|
2014-06-06 11:16:47 +00:00
|
|
|
\OCA\Files\App::getNavigationManager()->add(
|
|
|
|
array(
|
|
|
|
"id" => 'extstoragemounts',
|
|
|
|
"appname" => 'files_external',
|
|
|
|
"script" => 'list.php',
|
|
|
|
"order" => 30,
|
|
|
|
"name" => $l->t('External storage')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2013-04-18 20:12:53 +00:00
|
|
|
// connecting hooks
|
2014-03-19 11:20:48 +00:00
|
|
|
OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook');
|
2014-03-25 13:54:54 +00:00
|
|
|
OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\SMB_OC', 'login');
|
2013-04-18 20:12:53 +00:00
|
|
|
|
2013-03-08 17:15:20 +00:00
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\Local', array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'backend' => (string)$l->t('Local'),
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 150,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'datadir' => (string)$l->t('Location'))));
|
2013-03-08 17:15:20 +00:00
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'backend' => (string)$l->t('Amazon S3'),
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'key' => (string)$l->t('Key'),
|
|
|
|
'secret' => '*'.$l->t('Secret'),
|
|
|
|
'bucket' => (string)$l->t('Bucket')),
|
2013-06-01 09:28:02 +00:00
|
|
|
'has_dependencies' => true));
|
2013-03-08 17:15:20 +00:00
|
|
|
|
2014-04-03 14:57:26 +00:00
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'backend' => (string)$l->t('Amazon S3 and compliant'),
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2014-04-03 14:57:26 +00:00
|
|
|
'configuration' => array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'key' => (string)$l->t('Access Key'),
|
|
|
|
'secret' => '*'.$l->t('Secret Key'),
|
|
|
|
'bucket' => (string)$l->t('Bucket'),
|
2014-08-14 16:48:34 +00:00
|
|
|
'hostname' => '&'.$l->t('Hostname'),
|
|
|
|
'port' => '&'.$l->t('Port'),
|
|
|
|
'region' => '&'.$l->t('Region'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'use_ssl' => '!'.$l->t('Enable SSL'),
|
|
|
|
'use_path_style' => '!'.$l->t('Enable Path Style')),
|
2014-04-03 14:57:26 +00:00
|
|
|
'has_dependencies' => true));
|
|
|
|
|
2013-03-08 17:15:20 +00:00
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\Dropbox', array(
|
|
|
|
'backend' => 'Dropbox',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
|
|
|
'configured' => '#configured',
|
2014-04-23 15:58:14 +00:00
|
|
|
'app_key' => (string)$l->t('App key'),
|
|
|
|
'app_secret' => '*'.$l->t('App secret'),
|
2013-03-08 17:15:20 +00:00
|
|
|
'token' => '#token',
|
|
|
|
'token_secret' => '#token_secret'),
|
2013-06-01 09:28:02 +00:00
|
|
|
'custom' => 'dropbox',
|
|
|
|
'has_dependencies' => true));
|
2013-03-08 17:15:20 +00:00
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\FTP', array(
|
|
|
|
'backend' => 'FTP',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-05-14 14:56:34 +00:00
|
|
|
'host' => (string)$l->t('Host'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'password' => '*'.$l->t('Password'),
|
2015-01-01 20:06:22 +00:00
|
|
|
'root' => '&'.$l->t('Remote subfolder'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'secure' => '!'.$l->t('Secure ftps://')),
|
2013-03-08 17:15:20 +00:00
|
|
|
'has_dependencies' => true));
|
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\Google', array(
|
|
|
|
'backend' => 'Google Drive',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
|
|
|
'configured' => '#configured',
|
2014-04-23 15:58:14 +00:00
|
|
|
'client_id' => (string)$l->t('Client ID'),
|
|
|
|
'client_secret' => '*'.$l->t('Client secret'),
|
2014-04-03 14:57:26 +00:00
|
|
|
'token' => '#token'),
|
2013-05-25 15:10:20 +00:00
|
|
|
'custom' => 'google',
|
|
|
|
'has_dependencies' => true));
|
2013-03-08 17:15:20 +00:00
|
|
|
|
2014-04-03 14:57:26 +00:00
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'backend' => (string)$l->t('OpenStack Object Storage'),
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-08-14 16:48:34 +00:00
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'bucket' => (string)$l->t('Bucket'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'region' => '&'.$l->t('Region (optional for OpenStack Object Storage)'),
|
2014-09-05 11:22:35 +00:00
|
|
|
'key' => '&*'.$l->t('API Key (required for Rackspace Cloud Files)'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'tenant' => '&'.$l->t('Tenantname (required for OpenStack Object Storage)'),
|
2014-09-05 11:22:35 +00:00
|
|
|
'password' => '&*'.$l->t('Password (required for OpenStack Object Storage)'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'service_name' => '&'.$l->t('Service Name (required for OpenStack Object Storage)'),
|
|
|
|
'url' => '&'.$l->t('URL of identity endpoint (required for OpenStack Object Storage)'),
|
2014-08-14 16:48:34 +00:00
|
|
|
'timeout' => '&'.$l->t('Timeout of HTTP requests in seconds'),
|
2014-04-03 14:57:26 +00:00
|
|
|
),
|
2013-06-01 09:28:02 +00:00
|
|
|
'has_dependencies' => true));
|
2013-03-08 17:15:20 +00:00
|
|
|
|
2014-04-03 14:57:26 +00:00
|
|
|
|
|
|
|
if (!OC_Util::runningOnWindows()) {
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB', array(
|
|
|
|
'backend' => 'SMB / CIFS',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2014-04-03 14:57:26 +00:00
|
|
|
'configuration' => array(
|
2014-05-14 14:56:34 +00:00
|
|
|
'host' => (string)$l->t('Host'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'password' => '*'.$l->t('Password'),
|
|
|
|
'share' => (string)$l->t('Share'),
|
2015-01-01 20:06:22 +00:00
|
|
|
'root' => '&'.$l->t('Remote subfolder')),
|
2014-04-03 14:57:26 +00:00
|
|
|
'has_dependencies' => true));
|
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB_OC', array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'backend' => (string)$l->t('SMB / CIFS using OC login'),
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 90,
|
2014-04-03 14:57:26 +00:00
|
|
|
'configuration' => array(
|
2014-05-14 14:56:34 +00:00
|
|
|
'host' => (string)$l->t('Host'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'username_as_share' => '!'.$l->t('Username as share'),
|
|
|
|
'share' => '&'.$l->t('Share'),
|
2015-01-01 20:06:22 +00:00
|
|
|
'root' => '&'.$l->t('Remote subfolder')),
|
2014-04-03 14:57:26 +00:00
|
|
|
'has_dependencies' => true));
|
|
|
|
}
|
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\DAV', array(
|
|
|
|
'backend' => 'WebDAV',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'host' => (string)$l->t('URL'),
|
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'password' => '*'.$l->t('Password'),
|
2015-01-01 20:06:22 +00:00
|
|
|
'root' => '&'.$l->t('Remote subfolder'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'secure' => '!'.$l->t('Secure https://')),
|
2013-03-08 17:15:20 +00:00
|
|
|
'has_dependencies' => true));
|
|
|
|
|
2014-04-03 14:57:26 +00:00
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\OwnCloud', array(
|
|
|
|
'backend' => 'ownCloud',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-04-23 15:58:14 +00:00
|
|
|
'host' => (string)$l->t('URL'),
|
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'password' => '*'.$l->t('Password'),
|
|
|
|
'root' => '&'.$l->t('Remote subfolder'),
|
|
|
|
'secure' => '!'.$l->t('Secure https://'))));
|
2014-04-03 14:57:26 +00:00
|
|
|
|
2013-03-08 17:15:20 +00:00
|
|
|
|
|
|
|
OC_Mount_Config::registerBackend('\OC\Files\Storage\SFTP', array(
|
|
|
|
'backend' => 'SFTP',
|
2014-03-28 14:24:38 +00:00
|
|
|
'priority' => 100,
|
2013-03-08 17:15:20 +00:00
|
|
|
'configuration' => array(
|
2014-05-14 14:56:34 +00:00
|
|
|
'host' => (string)$l->t('Host'),
|
2014-04-23 15:58:14 +00:00
|
|
|
'user' => (string)$l->t('Username'),
|
|
|
|
'password' => '*'.$l->t('Password'),
|
2015-01-01 20:06:22 +00:00
|
|
|
'root' => '&'.$l->t('Remote subfolder'))));
|
2014-06-06 11:16:47 +00:00
|
|
|
|
2014-12-03 13:14:31 +00:00
|
|
|
$mountProvider = new \OCA\Files_External\Config\ConfigAdapter();
|
|
|
|
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
|