diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-11 08:53:34 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-11 08:53:34 -0800 |
commit | 2afc5abe195551c5ee84658b1a15acbca453d6e0 (patch) | |
tree | 6f2f84b6c41653d3bf5f0c91a942c6631b7a74f1 /apps | |
parent | 728ea711b23c796c670559a02701ce0fd1c5851c (diff) | |
parent | e427197dce2e8e43000e806ca4b13bfbb841436a (diff) | |
download | nextcloud-server-2afc5abe195551c5ee84658b1a15acbca453d6e0.tar.gz nextcloud-server-2afc5abe195551c5ee84658b1a15acbca453d6e0.zip |
Merge pull request #813 from owncloud/check_external_dependencies
Check external dependencies
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/files_external/lib/config.php | 158 | ||||
-rwxr-xr-x | apps/files_external/personal.php | 1 | ||||
-rw-r--r-- | apps/files_external/settings.php | 1 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 3 |
4 files changed, 104 insertions, 59 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 87d6886c51e..c0864dc50d2 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -38,66 +38,74 @@ class OC_Mount_Config { * @return array */ public static function getBackends() { - return array( - 'OC_Filestorage_Local' => array( + + $backends['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://')) - ); + 'datadir' => 'Location')); + + $backends['OC_Filestorage_AmazonS3']=array( + 'backend' => 'Amazon S3', + 'configuration' => array( + 'key' => 'Key', + 'secret' => '*Secret', + 'bucket' => 'Bucket')); + + $backends['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'); + + if(OC_Mount_Config::checkphpftp()) $backends['OC_Filestorage_FTP']=array( + 'backend' => 'FTP', + 'configuration' => array( + 'host' => 'URL', + 'user' => 'Username', + 'password' => '*Password', + 'root' => '&Root', + 'secure' => '!Secure ftps://')); + + $backends['OC_Filestorage_Google']=array( + 'backend' => 'Google Drive', + 'configuration' => array( + 'configured' => '#configured', + 'token' => '#token', + 'token_secret' => '#token secret'), + 'custom' => 'google'); + + $backends['OC_Filestorage_SWIFT']=array( + 'backend' => 'OpenStack Swift', + 'configuration' => array( + 'host' => 'URL', + 'user' => 'Username', + 'token' => '*Token', + 'root' => '&Root', + 'secure' => '!Secure ftps://')); + + if(OC_Mount_Config::checksmbclient()) $backends['OC_Filestorage_SMB']=array( + 'backend' => 'SMB / CIFS', + 'configuration' => array( + 'host' => 'URL', + 'user' => 'Username', + 'password' => '*Password', + 'share' => 'Share', + 'root' => '&Root')); + + $backends['OC_Filestorage_DAV']=array( + 'backend' => 'ownCloud / WebDAV', + 'configuration' => array( + 'host' => 'URL', + 'user' => 'Username', + 'password' => '*Password', + 'root' => '&Root', + 'secure' => '!Secure https://')); + + return($backends); } /** @@ -394,4 +402,38 @@ class OC_Mount_Config { return true; } + /** + * check if smbclient is installed + */ + public static function checksmbclient() { + if(function_exists('shell_exec')) { + $output=shell_exec('which smbclient'); + return (empty($output)?false:true); + }else{ + return(false); + } + } + + /** + * check if php-ftp is installed + */ + public static function checkphpftp() { + if(function_exists('ftp_login')) { + return(true); + }else{ + return(false); + } + } + + /** + * check dependencies + */ + public static function checkDependencies() { + $l= new OC_L10N('files_external'); + $txt=''; + if(!OC_Mount_Config::checksmbclient()) $txt.=$l->t('<b>Warning:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.').'<br />'; + if(!OC_Mount_Config::checkphpftp()) $txt.=$l->t('<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it.').'<br />'; + + return($txt); + } } diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index f0d76460f54..509c2977622 100755 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -29,5 +29,6 @@ $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', false, false); $tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints()); $tmpl->assign('certs', OC_Mount_Config::getCertificates()); +$tmpl->assign('dependencies', OC_Mount_Config::checkDependencies(),false); $tmpl->assign('backends', $backends); return $tmpl->fetchPage(); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index d2be21b7116..94222149a38 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -30,5 +30,6 @@ $tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints()); $tmpl->assign('backends', OC_Mount_Config::getBackends()); $tmpl->assign('groups', OC_Group::getGroups()); $tmpl->assign('users', OCP\User::getUsers()); +$tmpl->assign('dependencies', OC_Mount_Config::checkDependencies(),false); $tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes')); return $tmpl->fetchPage(); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 5b954eeb50a..50f4a16a5ab 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,6 +1,7 @@ <form id="files_external"> <fieldset class="personalblock"> <legend><strong><?php echo $l->t('External Storage'); ?></strong></legend> + <?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) echo ''.$_['dependencies'].''; ?> <table id="externalStorage" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'> <thead> <tr> @@ -157,4 +158,4 @@ <input type="submit" name="cert_import" value="<?php echo $l->t('Import Root Certificate'); ?>" /> <?php endif; ?> </fieldset> -</form>
\ No newline at end of file +</form> |