summaryrefslogtreecommitdiffstats
path: root/lib/util.php
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-08-20 17:20:30 +0200
committerkondou <kondou@ts.unde.re>2013-08-20 17:20:30 +0200
commitf1518a54dffb4a309da3952e154b71d4bc9482f8 (patch)
treeb6faeec269eb8904c5c8f42732e5466758fdeb0e /lib/util.php
parent65d802329f8307cd010a306073d2d3ffd7dc7b74 (diff)
parentde949b1caa4491a8016ed5e609fc781526fea54d (diff)
downloadnextcloud-server-f1518a54dffb4a309da3952e154b71d4bc9482f8.tar.gz
nextcloud-server-f1518a54dffb4a309da3952e154b71d4bc9482f8.zip
Merge branch 'master' into clean_up_util
Conflicts: lib/util.php
Diffstat (limited to 'lib/util.php')
-rwxr-xr-xlib/util.php41
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php
index 10b526ef6b3..dbda3ac0ad0 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -52,6 +52,16 @@ class OC_Util {
}
if( $user != "" ) { //if we aren't logged in, there is no use to set up the filesystem
+ $quota = self::getUserQuota($user);
+ if ($quota !== \OC\Files\SPACE_UNLIMITED) {
+ \OC\Files\Filesystem::addStorageWrapper(function($mountPoint, $storage) use ($quota, $user) {
+ if ($mountPoint === '/' . $user . '/'){
+ return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota));
+ } else {
+ return $storage;
+ }
+ });
+ }
$userDir = '/'.$user.'/files';
$userRoot = OC_User::getHome($user);
$userDirectory = $userRoot . '/files';
@@ -61,9 +71,7 @@ class OC_Util {
//jail the user into his "home" directory
\OC\Files\Filesystem::init($user, $userDir);
- $quotaProxy = new OC_FileProxy_Quota();
$fileOperationProxy = new OC_FileProxy_FileOperations();
- OC_FileProxy::register($quotaProxy);
OC_FileProxy::register($fileOperationProxy);
OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
@@ -71,6 +79,18 @@ class OC_Util {
return true;
}
+ public static function getUserQuota($user){
+ $userQuota = OC_Preferences::getValue($user, 'files', 'quota', 'default');
+ if($userQuota === 'default') {
+ $userQuota = OC_AppConfig::getValue('files', 'default_quota', 'none');
+ }
+ if($userQuota === 'none') {
+ return \OC\Files\SPACE_UNLIMITED;
+ }else{
+ return OC_Helper::computerFileSize($userQuota);
+ }
+ }
+
/**
* @return void
*/
@@ -381,6 +401,23 @@ class OC_Util {
}
/**
+ * @brief check if there are still some encrypted files stored
+ * @return boolean
+ */
+ public static function encryptedFiles() {
+ //check if encryption was enabled in the past
+ $encryptedFiles = false;
+ if (OC_App::isEnabled('files_encryption') === false) {
+ $view = new OC\Files\View('/' . OCP\User::getUser());
+ if ($view->file_exists('/files_encryption/keyfiles')) {
+ $encryptedFiles = true;
+ }
+ }
+
+ return $encryptedFiles;
+ }
+
+ /**
* Check for correct file permissions of data directory
* @return array arrays with error messages and hints
*/