summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/delete.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-19 00:31:09 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-19 00:31:09 +0100
commitcdd07b33392897b1b6c7f5707b83874ba06ec363 (patch)
tree1bad04263312d7e799bb8eeb8c59afe90f2733fb /apps/files/ajax/delete.php
parentafb5de955e00490be5762247e817b20722091f37 (diff)
downloadnextcloud-server-cdd07b33392897b1b6c7f5707b83874ba06ec363.tar.gz
nextcloud-server-cdd07b33392897b1b6c7f5707b83874ba06ec363.zip
introducing class OCA/files/lib/Helper with new function to build an array with storage stats
DRYing the code by using \OCA\files\lib\Helper::buildFileStorageStatistics() now returning used space percent on each ajax call
Diffstat (limited to 'apps/files/ajax/delete.php')
-rw-r--r--apps/files/ajax/delete.php23
1 files changed, 7 insertions, 16 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
index 293543c547f..575b8c8d9ea 100644
--- a/apps/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -14,27 +14,18 @@ $files = json_decode($files);
$filesWithError = '';
$success = true;
//Now delete
-foreach($files as $file) {
- if( !OC_Files::delete( $dir, $file )) {
+foreach ($files as $file) {
+ if (!OC_Files::delete($dir, $file)) {
$filesWithError .= $file . "\n";
$success = false;
}
}
-// updated max file size after upload
-$l=new OC_L10N('files');
-$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
-$maxHumanFilesize=OCP\Util::humanFileSize($maxUploadFilesize);
-$maxHumanFilesize=$l->t('Upload') . ' max. '.$maxHumanFilesize;
+// get array with updated storage stats (e.g. max file size) after upload
+$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
-if($success) {
- OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $files,
- 'uploadMaxFilesize'=>$maxUploadFilesize,
- 'maxHumanFilesize'=>$maxHumanFilesize
- )));
+if ($success) {
+ OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));
} else {
- OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError,
- 'uploadMaxFilesize'=>$maxUploadFilesize,
- 'maxHumanFilesize'=>$maxHumanFilesize
- )));
+ OCP\JSON::error(array("data" => array_merge(array("message" => "Could not delete:\n" . $filesWithError), $storageStats)));
}