summaryrefslogtreecommitdiffstats
path: root/lib/private/Settings
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-05-17 12:06:51 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 12:36:38 +0200
commit8bd887b2c6e821a5809b5e7eabc29358923c3ca7 (patch)
tree23275850f786d2ab01bc37582c0aed6a248d09a2 /lib/private/Settings
parent9e924d74c96f9d6545ab0d204719c8486c5c8cb7 (diff)
downloadnextcloud-server-8bd887b2c6e821a5809b5e7eabc29358923c3ca7.tar.gz
nextcloud-server-8bd887b2c6e821a5809b5e7eabc29358923c3ca7.zip
add storage info, fix URL generation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Settings')
-rw-r--r--lib/private/Settings/Manager.php2
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php20
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index d6b3398d0fc..41db5be9740 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -368,7 +368,7 @@ class Manager implements IManager {
try {
if ($section === 'personal-info') {
/** @var ISettings $form */
- $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults);
+ $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults, $this->l);
$forms[$form->getPriority()] = [$form];
}
} catch (QueryException $e) {
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
index 605d0c4df60..14c96d2fc4f 100644
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ b/lib/private/Settings/Personal/PersonalInfo.php
@@ -26,9 +26,11 @@ namespace OC\Settings\Personal;
use OC\Accounts\AccountManager;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Files\FileInfo;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\IL10N;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
@@ -52,6 +54,8 @@ class PersonalInfo implements ISettings {
];
/** @var \OC_Defaults */
private $defaults;
+ /** @var IL10N */
+ private $l;
/**
* @param IConfig $config
@@ -60,6 +64,7 @@ class PersonalInfo implements ISettings {
* @param AccountManager $accountManager
* @param IFactory $l10nFactory
* @param \OC_Defaults $defaults
+ * @param IL10N $l
*/
public function __construct(
IConfig $config,
@@ -67,7 +72,8 @@ class PersonalInfo implements ISettings {
IGroupManager $groupManager,
AccountManager $accountManager,
IFactory $l10nFactory,
- \OC_Defaults $defaults
+ \OC_Defaults $defaults,
+ IL10N $l
) {
$this->config = $config;
$this->userManager = $userManager;
@@ -75,6 +81,7 @@ class PersonalInfo implements ISettings {
$this->groupManager = $groupManager;
$this->l10nFactory = $l10nFactory;
$this->defaults = $defaults;
+ $this->l = $l;
}
/**
@@ -89,9 +96,20 @@ class PersonalInfo implements ISettings {
$user = $this->userManager->get($uid);
$userData = $this->accountManager->getUser($user);
+ $storageInfo = \OC_Helper::getStorageInfo('/');
+ if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
+ $totalSpace = $this->l->t('Unlimited');
+ } else {
+ $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
+ }
+
list($activeLanguage, $commonLanguages, $languages) = $this->getLanguages($user);
$parameters = [
+ 'total_space' => $totalSpace,
+ 'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
+ 'usage_relative' => $storageInfo['relative'],
+ 'quota' => $storageInfo['quota'],
'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
'avatar_scope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],