summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-03-21 14:05:08 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-03-21 14:05:08 +0100
commit6ff96b34ad0462ad05c34633ccd08236b93bf195 (patch)
tree1acd7eb869d512b5a3fc9502961a98591ea20cfa /apps/files_trashbin
parente139f7c863d5971a6386070148496cb0f70ad04e (diff)
parent37af74efb3e3511b2d6eacef67dc90f22a685bd3 (diff)
downloadnextcloud-server-6ff96b34ad0462ad05c34633ccd08236b93bf195.tar.gz
nextcloud-server-6ff96b34ad0462ad05c34633ccd08236b93bf195.zip
Merge branch 'master' into load-apps-proper-master
Conflicts: apps/files/ajax/rawlist.php cron.php ocs/v1.php
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/ajax/delete.php16
-rw-r--r--apps/files_trashbin/ajax/list.php6
-rw-r--r--apps/files_trashbin/ajax/preview.php2
-rw-r--r--apps/files_trashbin/ajax/undelete.php31
-rw-r--r--apps/files_trashbin/appinfo/database.xml4
-rw-r--r--apps/files_trashbin/appinfo/update.php2
-rw-r--r--apps/files_trashbin/appinfo/version2
-rw-r--r--apps/files_trashbin/index.php13
-rw-r--r--apps/files_trashbin/js/filelist.js32
-rw-r--r--apps/files_trashbin/js/trash.js141
-rw-r--r--apps/files_trashbin/l10n/ar.php1
-rw-r--r--apps/files_trashbin/l10n/ca.php1
-rw-r--r--apps/files_trashbin/l10n/cs_CZ.php1
-rw-r--r--apps/files_trashbin/l10n/cy_GB.php1
-rw-r--r--apps/files_trashbin/l10n/da.php1
-rw-r--r--apps/files_trashbin/l10n/de.php1
-rw-r--r--apps/files_trashbin/l10n/de_AT.php3
-rw-r--r--apps/files_trashbin/l10n/de_CH.php1
-rw-r--r--apps/files_trashbin/l10n/de_DE.php1
-rw-r--r--apps/files_trashbin/l10n/el.php1
-rw-r--r--apps/files_trashbin/l10n/en_GB.php1
-rw-r--r--apps/files_trashbin/l10n/eo.php1
-rw-r--r--apps/files_trashbin/l10n/es.php1
-rw-r--r--apps/files_trashbin/l10n/es_AR.php1
-rw-r--r--apps/files_trashbin/l10n/es_CL.php5
-rw-r--r--apps/files_trashbin/l10n/es_MX.php1
-rw-r--r--apps/files_trashbin/l10n/et_EE.php1
-rw-r--r--apps/files_trashbin/l10n/eu.php1
-rw-r--r--apps/files_trashbin/l10n/eu_ES.php5
-rw-r--r--apps/files_trashbin/l10n/fa.php1
-rw-r--r--apps/files_trashbin/l10n/fi_FI.php1
-rw-r--r--apps/files_trashbin/l10n/fr.php1
-rw-r--r--apps/files_trashbin/l10n/gl.php1
-rw-r--r--apps/files_trashbin/l10n/he.php2
-rw-r--r--apps/files_trashbin/l10n/hu_HU.php1
-rw-r--r--apps/files_trashbin/l10n/id.php1
-rw-r--r--apps/files_trashbin/l10n/it.php1
-rw-r--r--apps/files_trashbin/l10n/ja.php15
-rw-r--r--apps/files_trashbin/l10n/ja_JP.php5
-rw-r--r--apps/files_trashbin/l10n/ka_GE.php1
-rw-r--r--apps/files_trashbin/l10n/km.php3
-rw-r--r--apps/files_trashbin/l10n/ko.php1
-rw-r--r--apps/files_trashbin/l10n/lt_LT.php1
-rw-r--r--apps/files_trashbin/l10n/lv.php1
-rw-r--r--apps/files_trashbin/l10n/mk.php1
-rw-r--r--apps/files_trashbin/l10n/nb_NO.php4
-rw-r--r--apps/files_trashbin/l10n/nl.php1
-rw-r--r--apps/files_trashbin/l10n/nn_NO.php1
-rw-r--r--apps/files_trashbin/l10n/pl.php1
-rw-r--r--apps/files_trashbin/l10n/pt_BR.php1
-rw-r--r--apps/files_trashbin/l10n/pt_PT.php1
-rw-r--r--apps/files_trashbin/l10n/ro.php1
-rw-r--r--apps/files_trashbin/l10n/ru.php1
-rw-r--r--apps/files_trashbin/l10n/sk_SK.php1
-rw-r--r--apps/files_trashbin/l10n/sl.php1
-rw-r--r--apps/files_trashbin/l10n/sq.php1
-rw-r--r--apps/files_trashbin/l10n/sr.php1
-rw-r--r--apps/files_trashbin/l10n/sv.php1
-rw-r--r--apps/files_trashbin/l10n/tr.php1
-rw-r--r--apps/files_trashbin/l10n/ug.php1
-rw-r--r--apps/files_trashbin/l10n/uk.php1
-rw-r--r--apps/files_trashbin/l10n/vi.php4
-rw-r--r--apps/files_trashbin/l10n/zh_CN.php1
-rw-r--r--apps/files_trashbin/l10n/zh_TW.php1
-rw-r--r--apps/files_trashbin/lib/helper.php70
-rw-r--r--apps/files_trashbin/lib/trashbin.php175
66 files changed, 334 insertions, 251 deletions
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php
index 75d481768ad..ebabc5bc7a2 100644
--- a/apps/files_trashbin/ajax/delete.php
+++ b/apps/files_trashbin/ajax/delete.php
@@ -2,42 +2,38 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
+$folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
// "empty trash" command
if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
$deleteAll = true;
- $folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
if ($folder === '/' || $folder === '') {
OCA\Files_Trashbin\Trashbin::deleteAll();
$list = array();
} else {
- $dirname = dirname($folder);
- if ( $dirname !== '/' && $dirname !== '.' ) {
- $dirlisting = '1';
- } else {
- $dirlisting = '0';
- }
$list[] = $folder;
+ $folder = dirname($folder);
}
}
else {
$deleteAll = false;
$files = $_POST['files'];
- $dirlisting = $_POST['dirlisting'];
$list = json_decode($files);
}
+
+$folder = rtrim($folder, '/') . '/';
$error = array();
$success = array();
$i = 0;
foreach ($list as $file) {
- if ( $dirlisting === '0') {
+ if ($folder === '/') {
$file = ltrim($file, '/');
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
} else {
- $filename = $file;
+ $filename = $folder . '/' . $file;
$timestamp = null;
}
diff --git a/apps/files_trashbin/ajax/list.php b/apps/files_trashbin/ajax/list.php
index 1ade4c7933d..cec18c46525 100644
--- a/apps/files_trashbin/ajax/list.php
+++ b/apps/files_trashbin/ajax/list.php
@@ -20,9 +20,9 @@ if($doBreadcrumb) {
}
// make filelist
-$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
-
-if ($files === null){
+try {
+ $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
+} catch (Exception $e) {
header("HTTP/1.0 404 Not Found");
exit();
}
diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php
index 44738734b19..ce64d9ecc9f 100644
--- a/apps/files_trashbin/ajax/preview.php
+++ b/apps/files_trashbin/ajax/preview.php
@@ -11,7 +11,7 @@ if(!\OC_App::isEnabled('files_trashbin')){
exit;
}
-$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
+$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php
index 876ad269a70..9c3ccba7ed8 100644
--- a/apps/files_trashbin/ajax/undelete.php
+++ b/apps/files_trashbin/ajax/undelete.php
@@ -4,15 +4,36 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$files = $_POST['files'];
-$dirlisting = $_POST['dirlisting'];
-$list = json_decode($files);
+$dir = '/';
+if (isset($_POST['dir'])) {
+ $dir = rtrim($_POST['dir'], '/'). '/';
+}
+$allFiles = false;
+if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true') {
+ $allFiles = true;
+ $list = array();
+ $dirListing = true;
+ if ($dir === '' || $dir === '/') {
+ $dirListing = false;
+ }
+ foreach (OCA\Files_Trashbin\Helper::getTrashFiles($dir) as $file) {
+ $fileName = $file['name'];
+ if (!$dirListing) {
+ $fileName .= '.d' . $file['timestamp'];
+ }
+ $list[] = $fileName;
+ }
+} else {
+ $list = json_decode($files);
+}
$error = array();
$success = array();
$i = 0;
foreach ($list as $file) {
- if ( $dirlisting === '0') {
+ $path = $dir . '/' . $file;
+ if ($dir === '/') {
$file = ltrim($file, '/');
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
@@ -23,9 +44,9 @@ foreach ($list as $file) {
$timestamp = null;
}
- if ( !OCA\Files_Trashbin\Trashbin::restore($file, $filename, $timestamp) ) {
+ if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
$error[] = $filename;
- OC_Log::write('trashbin','can\'t restore ' . $filename, OC_Log::ERROR);
+ OC_Log::write('trashbin', 'can\'t restore ' . $filename, OC_Log::ERROR);
} else {
$success[$i]['filename'] = $file;
$success[$i]['timestamp'] = $timestamp;
diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml
index d08c3469b02..db104ee9298 100644
--- a/apps/files_trashbin/appinfo/database.xml
+++ b/apps/files_trashbin/appinfo/database.xml
@@ -49,7 +49,7 @@
<name>type</name>
<type>text</type>
<default></default>
- <notnull>true</notnull>
+ <notnull>false</notnull>
<length>4</length>
</field>
@@ -57,7 +57,7 @@
<name>mime</name>
<type>text</type>
<default></default>
- <notnull>true</notnull>
+ <notnull>false</notnull>
<length>255</length>
</field>
diff --git a/apps/files_trashbin/appinfo/update.php b/apps/files_trashbin/appinfo/update.php
index 0ca232668d7..ca7b87a8681 100644
--- a/apps/files_trashbin/appinfo/update.php
+++ b/apps/files_trashbin/appinfo/update.php
@@ -2,7 +2,7 @@
$installedVersion=OCP\Config::getAppValue('files_trashbin', 'installed_version');
-if (version_compare($installedVersion, '0.4', '<')) {
+if (version_compare($installedVersion, '0.6', '<')) {
//size of the trash bin could be incorrect, remove it for all users to
//enforce a recalculation during next usage.
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trashsize`');
diff --git a/apps/files_trashbin/appinfo/version b/apps/files_trashbin/appinfo/version
index 2eb3c4fe4ee..5a2a5806df6 100644
--- a/apps/files_trashbin/appinfo/version
+++ b/apps/files_trashbin/appinfo/version
@@ -1 +1 @@
-0.5
+0.6
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php
index 93f385dd30b..f0c5b0508b8 100644
--- a/apps/files_trashbin/index.php
+++ b/apps/files_trashbin/index.php
@@ -37,19 +37,18 @@ if ($isIE8 && isset($_GET['dir'])){
$ajaxLoad = false;
if (!$isIE8){
- $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
+ try {
+ $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
+ } catch (Exception $e) {
+ header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php'));
+ exit();
+ }
}
else{
$files = array();
$ajaxLoad = true;
}
-// Redirect if directory does not exist
-if ($files === null){
- header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php'));
- exit();
-}
-
$dirlisting = false;
if ($dir && $dir !== '/') {
$dirlisting = true;
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index f42abb6d029..a88459b0a9a 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -1,3 +1,4 @@
+/* globals OC, FileList, t */
// override reload with own ajax call
FileList.reload = function(){
FileList.showMask();
@@ -17,7 +18,36 @@ FileList.reload = function(){
FileList.reloadCallback(result);
}
});
-}
+};
+
+FileList.appName = t('files_trashbin', 'Deleted files');
+
+FileList._deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/);
+
+/**
+ * Convert a file name in the format filename.d12345 to the real file name.
+ * This will use basename.
+ * The name will not be changed if it has no ".d12345" suffix.
+ * @param name file name
+ * @return converted file name
+ */
+FileList.getDeletedFileName = function(name) {
+ name = OC.basename(name);
+ var match = FileList._deletedRegExp.exec(name);
+ if (match && match.length > 1) {
+ name = match[1];
+ }
+ return name;
+};
+var oldSetCurrentDir = FileList.setCurrentDir;
+FileList.setCurrentDir = function(targetDir) {
+ oldSetCurrentDir.apply(this, arguments);
+
+ var baseDir = OC.basename(targetDir);
+ if (baseDir !== '') {
+ FileList.setPageTitle(FileList.getDeletedFileName(baseDir));
+ }
+};
FileList.linkTo = function(dir){
return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
index 46d8b56308c..6aade210505 100644
--- a/apps/files_trashbin/js/trash.js
+++ b/apps/files_trashbin/js/trash.js
@@ -1,5 +1,29 @@
+/*
+ * Copyright (c) 2014
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+/* global OC, t, FileList, FileActions */
$(document).ready(function() {
+ function removeCallback(result) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(result.data.message, t('core', 'Error'));
+ }
+
+ var files = result.data.success;
+ for (var i = 0; i < files.length; i++) {
+ FileList.findFileEl(OC.basename(files[i].filename)).remove();
+ }
+ FileList.updateFileSummary();
+ FileList.updateEmptyContent();
+ enableActions();
+ }
if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
@@ -7,22 +31,12 @@ $(document).ready(function() {
var deleteAction = tr.children("td.date").children(".action.delete");
deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
- $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
- {files: JSON.stringify([$('#dir').val() + '/' + filename]), dirlisting: tr.attr('data-dirlisting')},
- function(result) {
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
- }
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('core', 'Error'));
- }
- enableActions();
- FileList.updateFileSummary();
- FileList.updateEmptyContent();
- }
+ $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'), {
+ files: JSON.stringify([filename]),
+ dir: FileList.getCurrentDirectory()
+ },
+ removeCallback
);
-
});
};
@@ -34,22 +48,12 @@ $(document).ready(function() {
var deleteAction = tr.children("td.date").children(".action.delete");
deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
- $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
- {files: JSON.stringify([$('#dir').val() + '/' +filename]), dirlisting: tr.attr('data-dirlisting')},
- function(result) {
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
- }
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('core', 'Error'));
- }
- enableActions();
- FileList.updateFileSummary();
- FileList.updateEmptyContent();
- }
+ $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), {
+ files: JSON.stringify([filename]),
+ dir: FileList.getCurrentDirectory()
+ },
+ removeCallback
);
-
});
// Sets the select_all checkbox behaviour :
@@ -68,29 +72,45 @@ $(document).ready(function() {
$('.undelete').click('click', function(event) {
event.preventDefault();
- var files = getSelectedFiles('file');
- var fileslist = JSON.stringify(files);
- var dirlisting = getSelectedFiles('dirlisting')[0];
+ var allFiles = $('#select_all').is(':checked');
+ var files = [];
+ var params = {};
disableActions();
- for (var i = 0; i < files.length; i++) {
- var deleteAction = FileList.findFileEl(files[i]).children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ if (allFiles) {
+ FileList.showMask();
+ params = {
+ allfiles: true,
+ dir: FileList.getCurrentDirectory()
+ };
+ }
+ else {
+ files = getSelectedFiles('name');
+ for (var i = 0; i < files.length; i++) {
+ var deleteAction = FileList.findFileEl(files[i]).children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ }
+ params = {
+ files: JSON.stringify(files),
+ dir: FileList.getCurrentDirectory()
+ };
}
$.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
- {files: fileslist, dirlisting: dirlisting},
- function(result) {
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
- }
+ params,
+ function(result) {
+ if (allFiles) {
if (result.status !== 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
}
+ FileList.hideMask();
+ // simply remove all files
+ FileList.update('');
enableActions();
- FileList.updateFileSummary();
- FileList.updateEmptyContent();
}
+ else {
+ removeCallback(result);
+ }
+ }
);
});
@@ -101,17 +121,17 @@ $(document).ready(function() {
var params = {};
if (allFiles) {
params = {
- allfiles: true,
- dir: $('#dir').val()
+ allfiles: true,
+ dir: FileList.getCurrentDirectory()
};
}
else {
- files = getSelectedFiles('file');
+ files = getSelectedFiles('name');
params = {
files: JSON.stringify(files),
- dirlisting: getSelectedFiles('dirlisting')[0]
+ dir: FileList.getCurrentDirectory()
};
- };
+ }
disableActions();
if (allFiles) {
@@ -128,22 +148,17 @@ $(document).ready(function() {
params,
function(result) {
if (allFiles) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(result.data.message, t('core', 'Error'));
+ }
FileList.hideMask();
// simply remove all files
- $('#fileList').empty();
+ FileList.update('');
+ enableActions();
}
else {
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
- }
+ removeCallback(result);
}
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('core', 'Error'));
- }
- enableActions();
- FileList.updateFileSummary();
- FileList.updateEmptyContent();
}
);
@@ -208,11 +223,9 @@ function getSelectedFiles(property){
var files=[];
elements.each(function(i,element){
var file={
- name:$(element).attr('data-filename'),
- file:$('#dir').val() + "/" + $(element).attr('data-file'),
+ name:$(element).attr('data-file'),
timestamp:$(element).attr('data-timestamp'),
- type:$(element).attr('data-type'),
- dirlisting:$(element).attr('data-dirlisting')
+ type:$(element).attr('data-type')
};
if(property){
files.push(file[property]);
diff --git a/apps/files_trashbin/l10n/ar.php b/apps/files_trashbin/l10n/ar.php
index 9733e6b100e..68c51d1cc7d 100644
--- a/apps/files_trashbin/l10n/ar.php
+++ b/apps/files_trashbin/l10n/ar.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "تعذّر حذف%s بشكل دائم",
"Couldn't restore %s" => "تعذّر استرجاع %s ",
+"Deleted files" => "حذف الملفات",
"Error" => "خطأ",
"Nothing in here. Your trash bin is empty!" => "لا يوجد شيء هنا. سلة المهملات خاليه.",
"Name" => "اسم",
diff --git a/apps/files_trashbin/l10n/ca.php b/apps/files_trashbin/l10n/ca.php
index fa3f63ddb22..c99b414c7a8 100644
--- a/apps/files_trashbin/l10n/ca.php
+++ b/apps/files_trashbin/l10n/ca.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No s'ha pogut esborrar permanentment %s",
"Couldn't restore %s" => "No s'ha pogut restaurar %s",
+"Deleted files" => "Fitxers esborrats",
"Error" => "Error",
"restored" => "restaurat",
"Nothing in here. Your trash bin is empty!" => "La paperera està buida!",
diff --git a/apps/files_trashbin/l10n/cs_CZ.php b/apps/files_trashbin/l10n/cs_CZ.php
index ff0a69572f5..e0c46c5137d 100644
--- a/apps/files_trashbin/l10n/cs_CZ.php
+++ b/apps/files_trashbin/l10n/cs_CZ.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nelze trvale odstranit %s",
"Couldn't restore %s" => "Nelze obnovit %s",
+"Deleted files" => "Odstraněné soubory",
"Error" => "Chyba",
"restored" => "obnoveno",
"Nothing in here. Your trash bin is empty!" => "Žádný obsah. Váš koš je prázdný.",
diff --git a/apps/files_trashbin/l10n/cy_GB.php b/apps/files_trashbin/l10n/cy_GB.php
index f2eb81d67d2..bc8a318733b 100644
--- a/apps/files_trashbin/l10n/cy_GB.php
+++ b/apps/files_trashbin/l10n/cy_GB.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Methwyd dileu %s yn barhaol",
"Couldn't restore %s" => "Methwyd adfer %s",
+"Deleted files" => "Ffeiliau ddilewyd",
"Error" => "Gwall",
"Nothing in here. Your trash bin is empty!" => "Does dim byd yma. Mae eich bin sbwriel yn wag!",
"Name" => "Enw",
diff --git a/apps/files_trashbin/l10n/da.php b/apps/files_trashbin/l10n/da.php
index c396706d152..831ba6067da 100644
--- a/apps/files_trashbin/l10n/da.php
+++ b/apps/files_trashbin/l10n/da.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunne ikke slette %s permanent",
"Couldn't restore %s" => "Kunne ikke gendanne %s",
+"Deleted files" => "Slettede filer",
"Error" => "Fejl",
"restored" => "Gendannet",
"Nothing in here. Your trash bin is empty!" => "Intet at se her. Din papirkurv er tom!",
diff --git a/apps/files_trashbin/l10n/de.php b/apps/files_trashbin/l10n/de.php
index 2b6703dd058..fd00b4c433f 100644
--- a/apps/files_trashbin/l10n/de.php
+++ b/apps/files_trashbin/l10n/de.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
+"Deleted files" => "Gelöschte Dateien",
"Error" => "Fehler",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, der Papierkorb ist leer!",
diff --git a/apps/files_trashbin/l10n/de_AT.php b/apps/files_trashbin/l10n/de_AT.php
index 0acad00e8b5..afa3eff001c 100644
--- a/apps/files_trashbin/l10n/de_AT.php
+++ b/apps/files_trashbin/l10n/de_AT.php
@@ -1,6 +1,5 @@
<?php
$TRANSLATIONS = array(
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("","")
+"Delete" => "Löschen"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_trashbin/l10n/de_CH.php b/apps/files_trashbin/l10n/de_CH.php
index ec9f0b5309d..665be5d5ee7 100644
--- a/apps/files_trashbin/l10n/de_CH.php
+++ b/apps/files_trashbin/l10n/de_CH.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
+"Deleted files" => "Gelöschte Dateien",
"Error" => "Fehler",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, Ihr Papierkorb ist leer!",
diff --git a/apps/files_trashbin/l10n/de_DE.php b/apps/files_trashbin/l10n/de_DE.php
index ec9f0b5309d..665be5d5ee7 100644
--- a/apps/files_trashbin/l10n/de_DE.php
+++ b/apps/files_trashbin/l10n/de_DE.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
+"Deleted files" => "Gelöschte Dateien",
"Error" => "Fehler",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, Ihr Papierkorb ist leer!",
diff --git a/apps/files_trashbin/l10n/el.php b/apps/files_trashbin/l10n/el.php
index b4ee30c578d..567958de900 100644
--- a/apps/files_trashbin/l10n/el.php
+++ b/apps/files_trashbin/l10n/el.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Αδύνατη η μόνιμη διαγραφή του %s",
"Couldn't restore %s" => "Αδυναμία επαναφοράς %s",
+"Deleted files" => "Διαγραμμένα αρχεία",
"Error" => "Σφάλμα",
"restored" => "επαναφέρθηκαν",
"Nothing in here. Your trash bin is empty!" => "Δεν υπάρχει τίποτα εδώ. Ο κάδος σας είναι άδειος!",
diff --git a/apps/files_trashbin/l10n/en_GB.php b/apps/files_trashbin/l10n/en_GB.php
index 6b179c86532..04abf2d6f23 100644
--- a/apps/files_trashbin/l10n/en_GB.php
+++ b/apps/files_trashbin/l10n/en_GB.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Couldn't delete %s permanently",
"Couldn't restore %s" => "Couldn't restore %s",
+"Deleted files" => "Deleted files",
"Error" => "Error",
"restored" => "restored",
"Nothing in here. Your trash bin is empty!" => "Nothing in here. Your recycle bin is empty!",
diff --git a/apps/files_trashbin/l10n/eo.php b/apps/files_trashbin/l10n/eo.php
index b8f999eaafa..b3248406f52 100644
--- a/apps/files_trashbin/l10n/eo.php
+++ b/apps/files_trashbin/l10n/eo.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Ne povis foriĝi %s por ĉiam",
"Couldn't restore %s" => "Ne povis restaŭriĝi %s",
+"Deleted files" => "Forigitaj dosieroj",
"Error" => "Eraro",
"restored" => "restaŭrita",
"Nothing in here. Your trash bin is empty!" => "Nenio estas ĉi tie. Via rubujo malplenas!",
diff --git a/apps/files_trashbin/l10n/es.php b/apps/files_trashbin/l10n/es.php
index db7a617729b..79f122ad35b 100644
--- a/apps/files_trashbin/l10n/es.php
+++ b/apps/files_trashbin/l10n/es.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No se puede eliminar %s permanentemente",
"Couldn't restore %s" => "No se puede restaurar %s",
+"Deleted files" => "Archivos eliminados",
"Error" => "Error",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada aquí. ¡Tu papelera esta vacía!",
diff --git a/apps/files_trashbin/l10n/es_AR.php b/apps/files_trashbin/l10n/es_AR.php
index 842101d33be..50b337b8144 100644
--- a/apps/files_trashbin/l10n/es_AR.php
+++ b/apps/files_trashbin/l10n/es_AR.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No fue posible borrar %s de manera permanente",
"Couldn't restore %s" => "No se pudo restaurar %s",
+"Deleted files" => "Archivos borrados",
"Error" => "Error",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada acá. ¡La papelera está vacía!",
diff --git a/apps/files_trashbin/l10n/es_CL.php b/apps/files_trashbin/l10n/es_CL.php
new file mode 100644
index 00000000000..45584ff7c42
--- /dev/null
+++ b/apps/files_trashbin/l10n/es_CL.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"Error" => "Error"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_trashbin/l10n/es_MX.php b/apps/files_trashbin/l10n/es_MX.php
index db7a617729b..79f122ad35b 100644
--- a/apps/files_trashbin/l10n/es_MX.php
+++ b/apps/files_trashbin/l10n/es_MX.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No se puede eliminar %s permanentemente",
"Couldn't restore %s" => "No se puede restaurar %s",
+"Deleted files" => "Archivos eliminados",
"Error" => "Error",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada aquí. ¡Tu papelera esta vacía!",
diff --git a/apps/files_trashbin/l10n/et_EE.php b/apps/files_trashbin/l10n/et_EE.php
index 56eebc79f0b..69ed5cee767 100644
--- a/apps/files_trashbin/l10n/et_EE.php
+++ b/apps/files_trashbin/l10n/et_EE.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s jäädavalt kustutamine ebaõnnestus",
"Couldn't restore %s" => "%s ei saa taastada",
+"Deleted files" => "Kustutatud failid",
"Error" => "Viga",
"restored" => "taastatud",
"Nothing in here. Your trash bin is empty!" => "Siin pole midagi. Sinu prügikast on tühi!",
diff --git a/apps/files_trashbin/l10n/eu.php b/apps/files_trashbin/l10n/eu.php
index 04d92e01b36..648aaaf7383 100644
--- a/apps/files_trashbin/l10n/eu.php
+++ b/apps/files_trashbin/l10n/eu.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Ezin izan da %s betirako ezabatu",
"Couldn't restore %s" => "Ezin izan da %s berreskuratu",
+"Deleted files" => "Ezabatutako fitxategiak",
"Error" => "Errorea",
"restored" => "Berrezarrita",
"Nothing in here. Your trash bin is empty!" => "Ez dago ezer ez. Zure zakarrontzia hutsik dago!",
diff --git a/apps/files_trashbin/l10n/eu_ES.php b/apps/files_trashbin/l10n/eu_ES.php
new file mode 100644
index 00000000000..8612c8609bb
--- /dev/null
+++ b/apps/files_trashbin/l10n/eu_ES.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"Delete" => "Ezabatu"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_trashbin/l10n/fa.php b/apps/files_trashbin/l10n/fa.php
index 8409987b897..40cdec8a484 100644
--- a/apps/files_trashbin/l10n/fa.php
+++ b/apps/files_trashbin/l10n/fa.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s را نمی توان برای همیشه حذف کرد",
"Couldn't restore %s" => "%s را نمی توان بازگرداند",
+"Deleted files" => "فایل های حذف شده",
"Error" => "خطا",
"Nothing in here. Your trash bin is empty!" => "هیچ چیزی اینجا نیست. سطل زباله ی شما خالی است.",
"Name" => "نام",
diff --git a/apps/files_trashbin/l10n/fi_FI.php b/apps/files_trashbin/l10n/fi_FI.php
index b956c1c1e4c..e7b62dbb437 100644
--- a/apps/files_trashbin/l10n/fi_FI.php
+++ b/apps/files_trashbin/l10n/fi_FI.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kohdetta %s ei voitu poistaa pysyvästi",
"Couldn't restore %s" => "Kohteen %s palautus epäonnistui",
+"Deleted files" => "Poistetut tiedostot",
"Error" => "Virhe",
"restored" => "palautettu",
"Nothing in here. Your trash bin is empty!" => "Tyhjää täynnä! Roskakorissa ei ole mitään.",
diff --git a/apps/files_trashbin/l10n/fr.php b/apps/files_trashbin/l10n/fr.php
index 593310e2c32..9e74657fc10 100644
--- a/apps/files_trashbin/l10n/fr.php
+++ b/apps/files_trashbin/l10n/fr.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Impossible d'effacer %s de façon permanente",
"Couldn't restore %s" => "Impossible de restaurer %s",
+"Deleted files" => "Fichiers supprimés",
"Error" => "Erreur",
"restored" => "restauré",
"Nothing in here. Your trash bin is empty!" => "Il n'y a rien ici. Votre corbeille est vide !",
diff --git a/apps/files_trashbin/l10n/gl.php b/apps/files_trashbin/l10n/gl.php
index ae7ef8b319b..bf26936be0b 100644
--- a/apps/files_trashbin/l10n/gl.php
+++ b/apps/files_trashbin/l10n/gl.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Non foi posíbel eliminar %s permanente",
"Couldn't restore %s" => "Non foi posíbel restaurar %s",
+"Deleted files" => "Ficheiros eliminados",
"Error" => "Erro",
"restored" => "restaurado",
"Nothing in here. Your trash bin is empty!" => "Aquí non hai nada. O cesto do lixo está baleiro!",
diff --git a/apps/files_trashbin/l10n/he.php b/apps/files_trashbin/l10n/he.php
index d0bcb327d4a..6d2d184bec2 100644
--- a/apps/files_trashbin/l10n/he.php
+++ b/apps/files_trashbin/l10n/he.php
@@ -2,7 +2,9 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "לא ניתן למחוק את %s לצמיתות",
"Couldn't restore %s" => "לא ניתן לשחזר את %s",
+"Deleted files" => "קבצים שנמחקו",
"Error" => "שגיאה",
+"restored" => "שוחזר",
"Nothing in here. Your trash bin is empty!" => "אין כאן שום דבר. סל המיחזור שלך ריק!",
"Name" => "שם",
"Restore" => "שחזור",
diff --git a/apps/files_trashbin/l10n/hu_HU.php b/apps/files_trashbin/l10n/hu_HU.php
index aa8b45a7d65..69a2f5d5d45 100644
--- a/apps/files_trashbin/l10n/hu_HU.php
+++ b/apps/files_trashbin/l10n/hu_HU.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nem sikerült %s végleges törlése",
"Couldn't restore %s" => "Nem sikerült %s visszaállítása",
+"Deleted files" => "Törölt fájlok",
"Error" => "Hiba",
"restored" => "visszaállítva",
"Nothing in here. Your trash bin is empty!" => "Itt nincs semmi. Az Ön szemetes mappája üres!",
diff --git a/apps/files_trashbin/l10n/id.php b/apps/files_trashbin/l10n/id.php
index a55520fc117..11e1675074c 100644
--- a/apps/files_trashbin/l10n/id.php
+++ b/apps/files_trashbin/l10n/id.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Tidak dapat menghapus permanen %s",
"Couldn't restore %s" => "Tidak dapat memulihkan %s",
+"Deleted files" => "Berkas yang dihapus",
"Error" => "Galat",
"Nothing in here. Your trash bin is empty!" => "Tempat sampah anda kosong!",
"Name" => "Nama",
diff --git a/apps/files_trashbin/l10n/it.php b/apps/files_trashbin/l10n/it.php
index b631e0c9e4f..739dda24564 100644
--- a/apps/files_trashbin/l10n/it.php
+++ b/apps/files_trashbin/l10n/it.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Impossibile eliminare %s definitivamente",
"Couldn't restore %s" => "Impossibile ripristinare %s",
+"Deleted files" => "File eliminati",
"Error" => "Errore",
"restored" => "ripristinati",
"Nothing in here. Your trash bin is empty!" => "Qui non c'è niente. Il tuo cestino è vuoto.",
diff --git a/apps/files_trashbin/l10n/ja.php b/apps/files_trashbin/l10n/ja.php
new file mode 100644
index 00000000000..0aab7d05754
--- /dev/null
+++ b/apps/files_trashbin/l10n/ja.php
@@ -0,0 +1,15 @@
+<?php
+$TRANSLATIONS = array(
+"Couldn't delete %s permanently" => "%s を完全に削除できませんでした",
+"Couldn't restore %s" => "%s を復元できませんでした",
+"Deleted files" => "ゴミ箱",
+"Error" => "エラー",
+"restored" => "復元済",
+"Nothing in here. Your trash bin is empty!" => "ここには何もありません。ゴミ箱は空です!",
+"Name" => "名前",
+"Restore" => "復元",
+"Deleted" => "削除済み",
+"Delete" => "削除",
+"Deleted Files" => "ゴミ箱"
+);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_trashbin/l10n/ja_JP.php b/apps/files_trashbin/l10n/ja_JP.php
index 8d896625b52..0aab7d05754 100644
--- a/apps/files_trashbin/l10n/ja_JP.php
+++ b/apps/files_trashbin/l10n/ja_JP.php
@@ -1,7 +1,8 @@
<?php
$TRANSLATIONS = array(
-"Couldn't delete %s permanently" => "%s を完全に削除出来ませんでした",
-"Couldn't restore %s" => "%s を復元出来ませんでした",
+"Couldn't delete %s permanently" => "%s を完全に削除できませんでした",
+"Couldn't restore %s" => "%s を復元できませんでした",
+"Deleted files" => "ゴミ箱",
"Error" => "エラー",
"restored" => "復元済",
"Nothing in here. Your trash bin is empty!" => "ここには何もありません。ゴミ箱は空です!",
diff --git a/apps/files_trashbin/l10n/ka_GE.php b/apps/files_trashbin/l10n/ka_GE.php
index 7440171deef..f36bbea59bc 100644
--- a/apps/files_trashbin/l10n/ka_GE.php
+++ b/apps/files_trashbin/l10n/ka_GE.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "ფაილი %s–ის სრულად წაშლა ვერ მოხერხდა",
"Couldn't restore %s" => "%s–ის აღდგენა ვერ მოხერხდა",
+"Deleted files" => "წაშლილი ფაილები",
"Error" => "შეცდომა",
"Nothing in here. Your trash bin is empty!" => "აქ არაფერი არ არის. სანაგვე ყუთი ცარიელია!",
"Name" => "სახელი",
diff --git a/apps/files_trashbin/l10n/km.php b/apps/files_trashbin/l10n/km.php
index f7d9faa38c5..1df805de2d6 100644
--- a/apps/files_trashbin/l10n/km.php
+++ b/apps/files_trashbin/l10n/km.php
@@ -1,5 +1,8 @@
<?php
$TRANSLATIONS = array(
+"Error" => "កំហុស",
+"Name" => "ឈ្មោះ",
+"Restore" => "ស្ដារ​មក​វិញ",
"Delete" => "លុប"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_trashbin/l10n/ko.php b/apps/files_trashbin/l10n/ko.php
index 9c3cd2de15f..f95d1432451 100644
--- a/apps/files_trashbin/l10n/ko.php
+++ b/apps/files_trashbin/l10n/ko.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s을(를_ 영구적으로 삭제할 수 없습니다",
"Couldn't restore %s" => "%s을(를) 복원할 수 없습니다",
+"Deleted files" => "삭제된 파일",
"Error" => "오류",
"restored" => "복원됨",
"Nothing in here. Your trash bin is empty!" => "휴지통이 비어 있습니다!",
diff --git a/apps/files_trashbin/l10n/lt_LT.php b/apps/files_trashbin/l10n/lt_LT.php
index c4a8463fd0e..07325665d78 100644
--- a/apps/files_trashbin/l10n/lt_LT.php
+++ b/apps/files_trashbin/l10n/lt_LT.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nepavyko negrįžtamai ištrinti %s",
"Couldn't restore %s" => "Nepavyko atkurti %s",
+"Deleted files" => "Ištrinti failai",
"Error" => "Klaida",
"restored" => "atstatyta",
"Nothing in here. Your trash bin is empty!" => "Nieko nėra. Jūsų šiukšliadėžė tuščia!",
diff --git a/apps/files_trashbin/l10n/lv.php b/apps/files_trashbin/l10n/lv.php
index 5c04a0c97d1..d356b344377 100644
--- a/apps/files_trashbin/l10n/lv.php
+++ b/apps/files_trashbin/l10n/lv.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nevarēja pilnībā izdzēst %s",
"Couldn't restore %s" => "Nevarēja atjaunot %s",
+"Deleted files" => "Dzēstās datnes",
"Error" => "Kļūda",
"restored" => "atjaunots",
"Nothing in here. Your trash bin is empty!" => "Šeit nekā nav. Jūsu miskaste ir tukša!",
diff --git a/apps/files_trashbin/l10n/mk.php b/apps/files_trashbin/l10n/mk.php
index 06a9dcfb241..f025a13db1a 100644
--- a/apps/files_trashbin/l10n/mk.php
+++ b/apps/files_trashbin/l10n/mk.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Не можеше трајно да се избрише %s",
"Couldn't restore %s" => "Не можеше да се поврати %s",
+"Deleted files" => "Избришани датотеки",
"Error" => "Грешка",
"restored" => "повратени",
"Nothing in here. Your trash bin is empty!" => "Тука нема ништо. Вашата корпа за отпадоци е празна!",
diff --git a/apps/files_trashbin/l10n/nb_NO.php b/apps/files_trashbin/l10n/nb_NO.php
index eb917e3dde6..66e61ee72a1 100644
--- a/apps/files_trashbin/l10n/nb_NO.php
+++ b/apps/files_trashbin/l10n/nb_NO.php
@@ -2,12 +2,14 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunne ikke slette %s fullstendig",
"Couldn't restore %s" => "Kunne ikke gjenopprette %s",
+"Deleted files" => "Slettede filer",
"Error" => "Feil",
+"restored" => "gjenopprettet",
"Nothing in here. Your trash bin is empty!" => "Ingenting her. Søppelkassen din er tom!",
"Name" => "Navn",
"Restore" => "Gjenopprett",
"Deleted" => "Slettet",
"Delete" => "Slett",
-"Deleted Files" => "Slettet filer"
+"Deleted Files" => "Slettede filer"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_trashbin/l10n/nl.php b/apps/files_trashbin/l10n/nl.php
index 37a8ca65409..533571fd9e1 100644
--- a/apps/files_trashbin/l10n/nl.php
+++ b/apps/files_trashbin/l10n/nl.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kon %s niet permanent verwijderen",
"Couldn't restore %s" => "Kon %s niet herstellen",
+"Deleted files" => "Verwijderde bestanden",
"Error" => "Fout",
"restored" => "hersteld",
"Nothing in here. Your trash bin is empty!" => "Niets te vinden. Uw prullenbak is leeg!",
diff --git a/apps/files_trashbin/l10n/nn_NO.php b/apps/files_trashbin/l10n/nn_NO.php
index 39e2d5cda91..9282d9d49d4 100644
--- a/apps/files_trashbin/l10n/nn_NO.php
+++ b/apps/files_trashbin/l10n/nn_NO.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Klarte ikkje sletta %s for godt",
"Couldn't restore %s" => "Klarte ikkje gjenoppretta %s",
+"Deleted files" => "Sletta filer",
"Error" => "Feil",
"restored" => "gjenoppretta",
"Nothing in here. Your trash bin is empty!" => "Ingenting her. Papirkorga di er tom!",
diff --git a/apps/files_trashbin/l10n/pl.php b/apps/files_trashbin/l10n/pl.php
index 961b7727824..5075dad271a 100644
--- a/apps/files_trashbin/l10n/pl.php
+++ b/apps/files_trashbin/l10n/pl.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nie można trwale usunąć %s",
"Couldn't restore %s" => "Nie można przywrócić %s",
+"Deleted files" => "Pliki usunięte",
"Error" => "Błąd",
"restored" => "przywrócony",
"Nothing in here. Your trash bin is empty!" => "Nic tu nie ma. Twój kosz jest pusty!",
diff --git a/apps/files_trashbin/l10n/pt_BR.php b/apps/files_trashbin/l10n/pt_BR.php
index c2100efe96e..300235452b4 100644
--- a/apps/files_trashbin/l10n/pt_BR.php
+++ b/apps/files_trashbin/l10n/pt_BR.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Não foi possível excluir %s permanentemente",
"Couldn't restore %s" => "Não foi possível restaurar %s",
+"Deleted files" => "Arquivos apagados",
"Error" => "Erro",
"restored" => "restaurado",
"Nothing in here. Your trash bin is empty!" => "Nada aqui. Sua lixeira está vazia!",
diff --git a/apps/files_trashbin/l10n/pt_PT.php b/apps/files_trashbin/l10n/pt_PT.php
index 89e84a84d28..69f83e8a0e4 100644
--- a/apps/files_trashbin/l10n/pt_PT.php
+++ b/apps/files_trashbin/l10n/pt_PT.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Não foi possível eliminar %s de forma permanente",
"Couldn't restore %s" => "Não foi possível restaurar %s",
+"Deleted files" => "Ficheiros eliminados",
"Error" => "Erro",
"restored" => "Restaurado",
"Nothing in here. Your trash bin is empty!" => "Não hà ficheiros. O lixo está vazio!",
diff --git a/apps/files_trashbin/l10n/ro.php b/apps/files_trashbin/l10n/ro.php
index f285dcc164e..b00f37615f8 100644
--- a/apps/files_trashbin/l10n/ro.php
+++ b/apps/files_trashbin/l10n/ro.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"Deleted files" => "Sterge fisierele",
"Error" => "Eroare",
"Name" => "Nume",
"Delete" => "Șterge"
diff --git a/apps/files_trashbin/l10n/ru.php b/apps/files_trashbin/l10n/ru.php
index 06a4f864c67..3210ad7290b 100644
--- a/apps/files_trashbin/l10n/ru.php
+++ b/apps/files_trashbin/l10n/ru.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s не может быть удалён навсегда",
"Couldn't restore %s" => "%s не может быть восстановлен",
+"Deleted files" => "Удалённые файлы",
"Error" => "Ошибка",
"restored" => "восстановлен",
"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!",
diff --git a/apps/files_trashbin/l10n/sk_SK.php b/apps/files_trashbin/l10n/sk_SK.php
index b23383c1214..6bb39bb89dd 100644
--- a/apps/files_trashbin/l10n/sk_SK.php
+++ b/apps/files_trashbin/l10n/sk_SK.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nemožno zmazať %s navždy",
"Couldn't restore %s" => "Nemožno obnoviť %s",
+"Deleted files" => "Zmazané súbory",
"Error" => "Chyba",
"restored" => "obnovené",
"Nothing in here. Your trash bin is empty!" => "Žiadny obsah. Kôš je prázdny!",
diff --git a/apps/files_trashbin/l10n/sl.php b/apps/files_trashbin/l10n/sl.php
index 9f164ae709c..ca69c8d2784 100644
--- a/apps/files_trashbin/l10n/sl.php
+++ b/apps/files_trashbin/l10n/sl.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Datoteke %s ni mogoče trajno izbrisati.",
"Couldn't restore %s" => "Ni mogoče obnoviti %s",
+"Deleted files" => "Izbrisane datoteke",
"Error" => "Napaka",
"restored" => "obnovljeno",
"Nothing in here. Your trash bin is empty!" => "Mapa smeti je prazna.",
diff --git a/apps/files_trashbin/l10n/sq.php b/apps/files_trashbin/l10n/sq.php
index 63957080f37..10354e45408 100644
--- a/apps/files_trashbin/l10n/sq.php
+++ b/apps/files_trashbin/l10n/sq.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nuk munda ta eliminoj përfundimisht %s",
"Couldn't restore %s" => "Nuk munda ta rivendos %s",
+"Deleted files" => "Skedarë të fshirë ",
"Error" => "Veprim i gabuar",
"restored" => "rivendosur",
"Nothing in here. Your trash bin is empty!" => "Këtu nuk ka asgjë. Koshi juaj është bosh!",
diff --git a/apps/files_trashbin/l10n/sr.php b/apps/files_trashbin/l10n/sr.php
index c893dba118b..7fb4c85ab63 100644
--- a/apps/files_trashbin/l10n/sr.php
+++ b/apps/files_trashbin/l10n/sr.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"Deleted files" => "Обрисане датотеке",
"Error" => "Грешка",
"Nothing in here. Your trash bin is empty!" => "Овде нема ништа. Корпа за отпатке је празна.",
"Name" => "Име",
diff --git a/apps/files_trashbin/l10n/sv.php b/apps/files_trashbin/l10n/sv.php
index 21d4d15e9cc..ec9de3acaa2 100644
--- a/apps/files_trashbin/l10n/sv.php
+++ b/apps/files_trashbin/l10n/sv.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunde inte radera %s permanent",
"Couldn't restore %s" => "Kunde inte återställa %s",
+"Deleted files" => "Raderade filer",
"Error" => "Fel",
"restored" => "återställd",
"Nothing in here. Your trash bin is empty!" => "Ingenting här. Din papperskorg är tom!",
diff --git a/apps/files_trashbin/l10n/tr.php b/apps/files_trashbin/l10n/tr.php
index 00a3b4d32a5..c1234cdfb0c 100644
--- a/apps/files_trashbin/l10n/tr.php
+++ b/apps/files_trashbin/l10n/tr.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s alıcı olarak silinemedi",
"Couldn't restore %s" => "%s eri yüklenemedi",
+"Deleted files" => "Silinmiş dosyalar",
"Error" => "Hata",
"restored" => "geri yüklendi",
"Nothing in here. Your trash bin is empty!" => "Burada hiçbir şey yok. Çöp kutunuz tamamen boş!",
diff --git a/apps/files_trashbin/l10n/ug.php b/apps/files_trashbin/l10n/ug.php
index 54c040c88a7..f52f28db49b 100644
--- a/apps/files_trashbin/l10n/ug.php
+++ b/apps/files_trashbin/l10n/ug.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"Deleted files" => "ئۆچۈرۈلگەن ھۆججەتلەر",
"Error" => "خاتالىق",
"Nothing in here. Your trash bin is empty!" => "بۇ جايدا ھېچنېمە يوق. Your trash bin is empty!",
"Name" => "ئاتى",
diff --git a/apps/files_trashbin/l10n/uk.php b/apps/files_trashbin/l10n/uk.php
index c54d45aaa82..19d4bda97c7 100644
--- a/apps/files_trashbin/l10n/uk.php
+++ b/apps/files_trashbin/l10n/uk.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Неможливо видалити %s назавжди",
"Couldn't restore %s" => "Неможливо відновити %s",
+"Deleted files" => "Видалено файлів",
"Error" => "Помилка",
"restored" => "відновлено",
"Nothing in here. Your trash bin is empty!" => "Нічого немає. Ваший кошик для сміття пустий!",
diff --git a/apps/files_trashbin/l10n/vi.php b/apps/files_trashbin/l10n/vi.php
index c5e899392bf..81a0cf14bcc 100644
--- a/apps/files_trashbin/l10n/vi.php
+++ b/apps/files_trashbin/l10n/vi.php
@@ -1,8 +1,10 @@
<?php
$TRANSLATIONS = array(
-"Couldn't delete %s permanently" => "Không thể óa %s vĩnh viễn",
+"Couldn't delete %s permanently" => "Không thể xóa %s vĩnh viễn",
"Couldn't restore %s" => "Không thể khôi phục %s",
+"Deleted files" => "File đã bị xóa",
"Error" => "Lỗi",
+"restored" => "khôi phục",
"Nothing in here. Your trash bin is empty!" => "Không có gì ở đây. Thùng rác của bạn rỗng!",
"Name" => "Tên",
"Restore" => "Khôi phục",
diff --git a/apps/files_trashbin/l10n/zh_CN.php b/apps/files_trashbin/l10n/zh_CN.php
index 24d9002adcb..4c61aef33b1 100644
--- a/apps/files_trashbin/l10n/zh_CN.php
+++ b/apps/files_trashbin/l10n/zh_CN.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "无法彻底删除文件%s",
"Couldn't restore %s" => "无法恢复%s",
+"Deleted files" => "已删除文件",
"Error" => "错误",
"restored" => "已恢复",
"Nothing in here. Your trash bin is empty!" => "这里没有东西. 你的回收站是空的!",
diff --git a/apps/files_trashbin/l10n/zh_TW.php b/apps/files_trashbin/l10n/zh_TW.php
index 1f05a2687b6..65b954e2c63 100644
--- a/apps/files_trashbin/l10n/zh_TW.php
+++ b/apps/files_trashbin/l10n/zh_TW.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "無法永久刪除 %s",
"Couldn't restore %s" => "無法還原 %s",
+"Deleted files" => "回收桶",
"Error" => "錯誤",
"restored" => "已還原",
"Nothing in here. Your trash bin is empty!" => "您的回收桶是空的!",
diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php
index c454b35a5f2..9c24332a964 100644
--- a/apps/files_trashbin/lib/helper.php
+++ b/apps/files_trashbin/lib/helper.php
@@ -2,55 +2,67 @@
namespace OCA\Files_Trashbin;
+use OC\Files\FileInfo;
+
class Helper
{
/**
* Retrieves the contents of a trash bin directory.
* @param string $dir path to the directory inside the trashbin
* or empty to retrieve the root of the trashbin
- * @return array of files
+ * @return \OCP\Files\FileInfo[]
*/
public static function getTrashFiles($dir){
$result = array();
+ $timestamp = null;
$user = \OCP\User::getUser();
- if ($dir && $dir !== '/') {
- $view = new \OC_Filesystemview('/'.$user.'/files_trashbin/files');
- $dirContent = $view->opendir($dir);
- if ($dirContent === false){
- return null;
- }
- if(is_resource($dirContent)){
- while(($entryName = readdir($dirContent)) !== false) {
- if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) {
- $pos = strpos($dir.'/', '/', 1);
- $tmp = substr($dir, 0, $pos);
- $pos = strrpos($tmp, '.d');
- $timestamp = substr($tmp, $pos+2);
- $result[] = array(
- 'id' => $entryName,
- 'timestamp' => $timestamp,
- 'mime' => $view->getMimeType($dir.'/'.$entryName),
- 'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file',
- 'location' => $dir,
- );
+ $view = new \OC_Filesystemview('/' . $user . '/files_trashbin/files');
+
+ if (ltrim($dir, '/') !== '' && !$view->is_dir($dir)) {
+ throw new \Exception('Directory does not exists');
+ }
+
+ $dirContent = $view->opendir($dir);
+ if ($dirContent === false) {
+ return $result;
+ }
+ if (is_resource($dirContent)) {
+ while (($entryName = readdir($dirContent)) !== false) {
+ if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) {
+ $id = $entryName;
+ if ($dir === '' || $dir === '/') {
+ $pathparts = pathinfo($entryName);
+ $timestamp = substr($pathparts['extension'], 1);
+ $id = $pathparts['filename'];
+ } else if ($timestamp === null) {
+ // for subfolders we need to calculate the timestamp only once
+ $parts = explode('/', ltrim($dir, '/'));
+ $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1);
}
+ $result[] = array(
+ 'id' => $id,
+ 'timestamp' => $timestamp,
+ 'mime' => \OC_Helper::getFileNameMimeType($id),
+ 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file',
+ 'location' => $dir,
+ );
}
- closedir($dirContent);
}
- } else {
- $query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE `user` = ?');
- $result = $query->execute(array($user))->fetchAll();
+ closedir($dirContent);
}
$files = array();
$id = 0;
+ list($storage, $internalPath) = $view->resolvePath($dir);
+ $absoluteDir = $view->getAbsolutePath($dir);
foreach ($result as $r) {
$i = array();
$i['id'] = $id++;
$i['name'] = $r['id'];
$i['date'] = \OCP\Util::formatDate($r['timestamp']);
$i['timestamp'] = $r['timestamp'];
+ $i['etag'] = $r['timestamp']; // add fake etag, it is only needed to identify the preview image
$i['mimetype'] = $r['mime'];
$i['type'] = $r['type'];
if ($i['type'] === 'file') {
@@ -63,9 +75,13 @@ class Helper
$i['directory'] = '';
}
$i['permissions'] = \OCP\PERMISSION_READ;
- $i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($r['mime']);
+ if (\OCP\App::isEnabled('files_encryption')) {
+ $i['isPreviewAvailable'] = false;
+ } else {
+ $i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($r['mime']);
+ }
$i['icon'] = \OCA\Files\Helper::determineIcon($i);
- $files[] = $i;
+ $files[] = new FileInfo($absoluteDir . '/' . $i['name'], $storage, $internalPath . '/' . $i['name'], $i);
}
usort($files, array('\OCA\Files\Helper', 'fileCmp'));
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 7544980e071..7e91f8a59ff 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -61,7 +61,14 @@ class Trashbin {
}
- private static function copyFilesToOwner($sourcePath, $owner, $ownerPath, $timestamp, $type, $mime) {
+ /**
+ * @brief copy file to owners trash
+ * @param string $sourcePath
+ * @param string $owner
+ * @param string $ownerPath
+ * @param integer $timestamp
+ */
+ private static function copyFilesToOwner($sourcePath, $owner, $ownerPath, $timestamp) {
self::setUpTrash($owner);
$ownerFilename = basename($ownerPath);
@@ -77,12 +84,10 @@ class Trashbin {
if ($view->file_exists($target)) {
- $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`type`,`mime`,`user`) VALUES (?,?,?,?,?,?)");
- $result = $query->execute(array($ownerFilename, $timestamp, $ownerLocation, $type, $mime, $owner));
- if (!$result) { // if file couldn't be added to the database than also don't store it in the trash bin.
- $view->deleteAll($owner.'/files_trashbin/files/' . $ownerFilename . '.d' . $timestamp);
+ $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
+ $result = $query->execute(array($ownerFilename, $timestamp, $ownerLocation, $owner));
+ if (!$result) {
\OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated for the files owner', \OC_log::ERROR);
- return;
}
}
}
@@ -105,18 +110,8 @@ class Trashbin {
$filename = $path_parts['basename'];
$location = $path_parts['dirname'];
$timestamp = time();
- $mime = $view->getMimeType('files' . $file_path);
-
- if ($view->is_dir('files' . $file_path)) {
- $type = 'dir';
- } else {
- $type = 'file';
- }
$userTrashSize = self::getTrashbinSize($user);
- if ($userTrashSize === false || $userTrashSize < 0) {
- $userTrashSize = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
- }
// disable proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -127,12 +122,10 @@ class Trashbin {
if ($view->file_exists('files_trashbin/files/' . $filename . '.d' . $timestamp)) {
$size = $sizeOfAddedFiles;
- $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`type`,`mime`,`user`) VALUES (?,?,?,?,?,?)");
- $result = $query->execute(array($filename, $timestamp, $location, $type, $mime, $user));
- if (!$result) { // if file couldn't be added to the database than also don't store it in the trash bin.
- $view->deleteAll('files_trashbin/files/' . $filename . '.d' . $timestamp);
+ $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
+ $result = $query->execute(array($filename, $timestamp, $location, $user));
+ if (!$result) {
\OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR);
- return;
}
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
@@ -142,7 +135,7 @@ class Trashbin {
// if owner !== user we need to also add a copy to the owners trash
if ($user !== $owner) {
- self::copyFilesToOwner($file_path, $owner, $ownerPath, $timestamp, $type, $mime);
+ self::copyFilesToOwner($file_path, $owner, $ownerPath, $timestamp);
}
} else {
\OC_Log::write('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR);
@@ -150,17 +143,12 @@ class Trashbin {
$userTrashSize += $size;
$userTrashSize -= self::expire($userTrashSize, $user);
- self::setTrashbinSize($user, $userTrashSize);
// if owner !== user we also need to update the owners trash size
if($owner !== $user) {
$ownerTrashSize = self::getTrashbinSize($owner);
- if ($ownerTrashSize === false || $ownerTrashSize < 0) {
- $ownerTrashSize = self::calculateSize(new \OC\Files\View('/' . $owner . '/files_trashbin'));
- }
$ownerTrashSize += $size;
$ownerTrashSize -= self::expire($ownerTrashSize, $owner);
- self::setTrashbinSize($owner, $ownerTrashSize);
}
}
@@ -169,7 +157,7 @@ class Trashbin {
*
* @param $file_path path to original file
* @param $filename of deleted file
- * @param $timestamp when the file was deleted
+ * @param integer $timestamp when the file was deleted
*
* @return size of stored versions
*/
@@ -214,7 +202,7 @@ class Trashbin {
*
* @param $file_path path to original file
* @param $filename of deleted file
- * @param $timestamp when the file was deleted
+ * @param integer $timestamp when the file was deleted
*
* @return size of encryption keys
*/
@@ -321,33 +309,22 @@ class Trashbin {
$user = \OCP\User::getUser();
$view = new \OC\Files\View('/' . $user);
- $trashbinSize = self::getTrashbinSize($user);
- if ($trashbinSize === false || $trashbinSize < 0) {
- $trashbinSize = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
- }
+ $location = '';
if ($timestamp) {
- $query = \OC_DB::prepare('SELECT `location`,`type` FROM `*PREFIX*files_trash`'
- . ' WHERE `user`=? AND `id`=? AND `timestamp`=?');
+ $query = \OC_DB::prepare('SELECT `location` FROM `*PREFIX*files_trash`'
+ . ' WHERE `user`=? AND `id`=? AND `timestamp`=?');
$result = $query->execute(array($user, $filename, $timestamp))->fetchAll();
if (count($result) !== 1) {
\OC_Log::write('files_trashbin', 'trash bin database inconsistent!', \OC_Log::ERROR);
- return false;
- }
-
- // if location no longer exists, restore file in the root directory
- $location = $result[0]['location'];
- if ($result[0]['location'] !== '/' &&
- (!$view->is_dir('files' . $result[0]['location']) ||
- !$view->isUpdatable('files' . $result[0]['location']))) {
- $location = '';
+ } else {
+ $location = $result[0]['location'];
+ // if location no longer exists, restore file in the root directory
+ if ($location !== '/' &&
+ (!$view->is_dir('files' . $location) ||
+ !$view->isUpdatable('files' . $location))) {
+ $location = '';
+ }
}
- } else {
- $path_parts = pathinfo($file);
- $result[] = array(
- 'location' => $path_parts['dirname'],
- 'type' => $view->is_dir('/files_trashbin/files/' . $file) ? 'dir' : 'files',
- );
- $location = '';
}
// we need a extension in case a file/dir with the same name already exists
@@ -372,22 +349,15 @@ class Trashbin {
$view->chroot($fakeRoot);
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => \OC\Files\Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename),
'trashPath' => \OC\Files\Filesystem::normalizePath($file)));
- if ($view->is_dir($target)) {
- $trashbinSize -= self::calculateSize(new \OC\Files\View('/' . $user . '/' . $target));
- } else {
- $trashbinSize -= $view->filesize($target);
- }
- $trashbinSize -= self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
- $trashbinSize -= self::restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp);
+ self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
+ self::restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp);
if ($timestamp) {
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
$query->execute(array($user, $filename, $timestamp));
}
- self::setTrashbinSize($user, $trashbinSize);
-
// enable proxy
\OC_FileProxy::$enabled = $proxyStatus;
@@ -406,14 +376,12 @@ class Trashbin {
* @param \OC\Files\View $view file view
* @param $file complete path to file
* @param $filename name of file once it was deleted
- * @param $uniqueFilename new file name to restore the file without overwriting existing files
+ * @param string $uniqueFilename new file name to restore the file without overwriting existing files
* @param $location location if file
* @param $timestamp deleteion time
*
- * @return size of restored versions
*/
private static function restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp) {
- $size = 0;
if (\OCP\App::isEnabled('files_versions')) {
// disable proxy to prevent recursive calls
@@ -434,15 +402,12 @@ class Trashbin {
}
if ($view->is_dir('/files_trashbin/versions/' . $file)) {
- $size += self::calculateSize(new \OC\Files\View('/' . $user . '/' . 'files_trashbin/versions/' . $file));
$rootView->rename(\OC\Files\Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), \OC\Files\Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath));
} else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp)) {
foreach ($versions as $v) {
if ($timestamp) {
- $size += $view->filesize('files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp);
$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
} else {
- $size += $view->filesize('files_trashbin/versions/' . $versionedFile . '.v' . $v);
$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
}
}
@@ -451,7 +416,6 @@ class Trashbin {
// enable proxy
\OC_FileProxy::$enabled = $proxyStatus;
}
- return $size;
}
/**
@@ -460,15 +424,13 @@ class Trashbin {
* @param \OC\Files\View $view
* @param $file complete path to file
* @param $filename name of file
- * @param $uniqueFilename new file name to restore the file without overwriting existing files
+ * @param string $uniqueFilename new file name to restore the file without overwriting existing files
* @param $location location of file
* @param $timestamp deleteion time
*
- * @return size of restored encrypted file
*/
private static function restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp) {
// Take care of encryption keys TODO! Get '.key' in file between file name and delete date (also for permanent delete!)
- $size = 0;
if (\OCP\App::isEnabled('files_encryption')) {
$user = \OCP\User::getUser();
$rootView = new \OC\Files\View('/');
@@ -513,18 +475,15 @@ class Trashbin {
if ($rootView->is_dir($keyfile)) {
// handle keyfiles
- $size += self::calculateSize(new \OC\Files\View($keyfile));
$rootView->rename($keyfile, $baseDir . '/keyfiles/' . $ownerPath);
// handle share-keys
if ($timestamp) {
$sharekey .= '.d' . $timestamp;
}
- $size += self::calculateSize(new \OC\Files\View($sharekey));
$rootView->rename($sharekey, $baseDir . '/share-keys/' . $ownerPath);
} else {
// handle keyfiles
- $size += $rootView->filesize($keyfile);
$rootView->rename($keyfile, $baseDir . '/keyfiles/' . $ownerPath . '.key');
// handle share-keys
@@ -533,8 +492,6 @@ class Trashbin {
$ownerShareKey .= '.d' . $timestamp;
}
- $size += $rootView->filesize($ownerShareKey);
-
// move only owners key
$rootView->rename($ownerShareKey, $baseDir . '/share-keys/' . $ownerPath . '.' . $user . '.shareKey');
@@ -561,7 +518,6 @@ class Trashbin {
// enable proxy
\OC_FileProxy::$enabled = $proxyStatus;
}
- return $size;
}
/**
@@ -571,7 +527,6 @@ class Trashbin {
$user = \OCP\User::getUser();
$view = new \OC\Files\View('/' . $user);
$view->deleteAll('files_trashbin');
- self::setTrashbinSize($user, 0);
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
$query->execute(array($user));
@@ -592,11 +547,6 @@ class Trashbin {
$view = new \OC\Files\View('/' . $user);
$size = 0;
- $trashbinSize = self::getTrashbinSize($user);
- if ($trashbinSize === false || $trashbinSize < 0) {
- $trashbinSize = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
- }
-
if ($timestamp) {
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
$query->execute(array($user, $filename, $timestamp));
@@ -613,14 +563,16 @@ class Trashbin {
} else {
$size += $view->filesize('/files_trashbin/files/' . $file);
}
+ \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => '/files_trashbin/files/' . $file));
$view->unlink('/files_trashbin/files/' . $file);
\OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => '/files_trashbin/files/' . $file));
- $trashbinSize -= $size;
- self::setTrashbinSize($user, $trashbinSize);
return $size;
}
+ /**
+ * @param \OC\Files\View $view
+ */
private static function deleteVersions($view, $file, $filename, $timestamp) {
$size = 0;
if (\OCP\App::isEnabled('files_versions')) {
@@ -643,6 +595,9 @@ class Trashbin {
return $size;
}
+ /**
+ * @param \OC\Files\View $view
+ */
private static function deleteEncryptionKeys($view, $file, $filename, $timestamp) {
$size = 0;
if (\OCP\App::isEnabled('files_encryption')) {
@@ -713,7 +668,7 @@ class Trashbin {
/**
* calculate remaining free space for trash bin
*
- * @param $trashbinSize current size of the trash bin
+ * @param integer $trashbinSize current size of the trash bin
* @return available free space for trash bin
*/
private static function calculateFreeSpace($trashbinSize) {
@@ -722,7 +677,7 @@ class Trashbin {
$quota = \OC_Preferences::getValue($user, 'files', 'quota');
$view = new \OC\Files\View('/' . $user);
if ($quota === null || $quota === 'default') {
- $quota = \OC_Appconfig::getValue('files', 'default_quota');
+ $quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota');
}
if ($quota === null || $quota === 'none') {
$quota = \OC\Files\Filesystem::free_space('/');
@@ -756,17 +711,10 @@ class Trashbin {
$size = self::getTrashbinSize($user);
- if ($size === false || $size < 0) {
- $size = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
- }
-
$freeSpace = self::calculateFreeSpace($size);
if ($freeSpace < 0) {
- $newSize = $size - self::expire($size, $user);
- if ($newSize !== $size) {
- self::setTrashbinSize($user, $newSize);
- }
+ self::expire($size, $user);
}
}
@@ -826,9 +774,9 @@ class Trashbin {
/**
* recursive copy to copy a whole directory
*
- * @param $source source path, relative to the users files directory
- * @param $destination destination path relative to the users root directoy
- * @param $view file view for the users root directory
+ * @param string $source source path, relative to the users files directory
+ * @param string $destination destination path relative to the users root directoy
+ * @param \OC\Files\View $view file view for the users root directory
*/
private static function copy_recursive($source, $destination, $view) {
$size = 0;
@@ -887,7 +835,7 @@ class Trashbin {
* find unique extension for restored file if a file with the same name already exists
* @param $location where the file should be restored
* @param $filename name of the file
- * @param $view filesystem view relative to users root directory
+ * @param \OC\Files\View $view filesystem view relative to users root directory
* @return string with unique extension
*/
private static function getUniqueFilename($location, $filename, $view) {
@@ -916,8 +864,8 @@ class Trashbin {
/**
* @brief get the size from a given root folder
- * @param $view file view on the root folder
- * @return size of the folder
+ * @param \OC\Files\View $view file view on the root folder
+ * @return integer size of the folder
*/
private static function calculateSize($view) {
$root = \OCP\Config::getSystemValue('datadirectory') . $view->getAbsolutePath('');
@@ -943,28 +891,9 @@ class Trashbin {
* @return mixed trash bin size or false if no trash bin size is stored
*/
private static function getTrashbinSize($user) {
- $query = \OC_DB::prepare('SELECT `size` FROM `*PREFIX*files_trashsize` WHERE `user`=?');
- $result = $query->execute(array($user))->fetchAll();
-
- if ($result) {
- return (int)$result[0]['size'];
- }
- return false;
- }
-
- /**
- * write to the database how much space is in use for the trash bin
- *
- * @param $user owner of the trash bin
- * @param $size size of the trash bin
- */
- private static function setTrashbinSize($user, $size) {
- if (self::getTrashbinSize($user) === false) {
- $query = \OC_DB::prepare('INSERT INTO `*PREFIX*files_trashsize` (`size`, `user`) VALUES (?, ?)');
- } else {
- $query = \OC_DB::prepare('UPDATE `*PREFIX*files_trashsize` SET `size`=? WHERE `user`=?');
- }
- $query->execute(array($size, $user));
+ $view = new \OC\Files\View('/' . $user);
+ $fileInfo = $view->getFileInfo('/files_trashbin');
+ return $fileInfo['size'];
}
/**
@@ -996,6 +925,6 @@ class Trashbin {
}
public static function preview_icon($path) {
- return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) ));
+ return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => $path ));
}
}