diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-02-27 20:29:19 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-02-27 20:29:19 +0100 |
commit | 429bf42e986c27a974571c474590840f304f7e08 (patch) | |
tree | f257009f83cdad6860ad682e85cafa02c1f7eea6 /apps/files_trashbin | |
parent | f93f9dd50cce6b6e2ed4eeca2d34b2bac82e0350 (diff) | |
parent | 766a301a6b1832f98c30a09e0218a2e00925d401 (diff) | |
download | nextcloud-server-429bf42e986c27a974571c474590840f304f7e08.tar.gz nextcloud-server-429bf42e986c27a974571c474590840f304f7e08.zip |
Merge master into trash_fileactions
Diffstat (limited to 'apps/files_trashbin')
72 files changed, 796 insertions, 223 deletions
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php index 7a6bd1342ea..1834fb54003 100644 --- a/apps/files_trashbin/ajax/delete.php +++ b/apps/files_trashbin/ajax/delete.php @@ -3,22 +3,43 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$file = $_REQUEST['file']; +$files = $_POST['files']; +$dirlisting = $_POST['dirlisting']; +$list = json_decode($files); -$path_parts = pathinfo($file); -if ($path_parts['dirname'] == '.') { - $delimiter = strrpos($file, '.d'); - $filename = substr($file, 0, $delimiter); - $timestamp = substr($file, $delimiter+2); -} else { - $filename = $file; - $timestamp = null; +$error = array(); +$success = array(); + +$i = 0; +foreach ($list as $file) { + if ( $dirlisting=='0') { + $delimiter = strrpos($file, '.d'); + $filename = substr($file, 0, $delimiter); + $timestamp = substr($file, $delimiter+2); + } else { + $filename = $file; + $timestamp = null; + } + + OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp); + if (!OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { + $success[$i]['filename'] = $file; + $success[$i]['timestamp'] = $timestamp; + $i++; + } else { + $error[] = $filename; + } } -if (OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp)) { - OCP\JSON::success(array("data" => array("filename" => $file))); -} else { +if ( $error ) { + $filelist = ''; + foreach ( $error as $e ) { + $filelist .= $e.', '; + } $l = OC_L10N::get('files_trashbin'); - OCP\JSON::error(array("data" => array("message" => $l->t("Couldn't delete %s permanently", array($file))))); + $message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', '))); + OCP\JSON::error(array("data" => array("message" => $message, + "success" => $success, "error" => $error))); +} else { + OCP\JSON::success(array("data" => array("success" => $success))); } - diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php index cc010979c51..80de3c31f91 100644 --- a/apps/files_trashbin/ajax/undelete.php +++ b/apps/files_trashbin/ajax/undelete.php @@ -1,11 +1,11 @@ -<?php +<?php OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$files = $_REQUEST['files']; -$dirlisting = $_REQUEST['dirlisting']; -$list = explode(';', $files); +$files = $_POST['files']; +$dirlisting = $_POST['dirlisting']; +$list = json_decode($files); $error = array(); $success = array(); @@ -21,7 +21,7 @@ foreach ($list as $file) { $filename = $path_parts['basename']; $timestamp = null; } - + if ( !OCA\Files_Trashbin\Trashbin::restore($file, $filename, $timestamp) ) { $error[] = $filename; } else { @@ -38,7 +38,7 @@ if ( $error ) { $filelist .= $e.', '; } $l = OC_L10N::get('files_trashbin'); - $message = $l->t("Couldn't restore %s", array(rtrim($filelist,', '))); + $message = $l->t("Couldn't restore %s", array(rtrim($filelist, ', '))); OCP\JSON::error(array("data" => array("message" => $message, "success" => $success, "error" => $error))); } else { diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php index b1a15cd13d1..7c04e583db1 100644 --- a/apps/files_trashbin/appinfo/app.php +++ b/apps/files_trashbin/appinfo/app.php @@ -1,7 +1,7 @@ <?php -OC::$CLASSPATH['OCA\Files_Trashbin\Hooks'] = 'apps/files_trashbin/lib/hooks.php';
-OC::$CLASSPATH['OCA\Files_Trashbin\Trashbin'] = 'apps/files_trashbin/lib/trash.php';
+OC::$CLASSPATH['OCA\Files_Trashbin\Hooks'] = 'apps/files_trashbin/lib/hooks.php'; +OC::$CLASSPATH['OCA\Files_Trashbin\Trashbin'] = 'apps/files_trashbin/lib/trash.php'; + -
OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Files_Trashbin\Hooks", "remove_hook"); diff --git a/apps/files_trashbin/appinfo/database.xml b/apps/files_trashbin/appinfo/database.xml index 1144a1c9a97..aae334b1489 100644 --- a/apps/files_trashbin/appinfo/database.xml +++ b/apps/files_trashbin/appinfo/database.xml @@ -18,7 +18,7 @@ <type>text</type> <default></default> <notnull>true</notnull> - <length>50</length> + <length>250</length> </field> <field> @@ -26,7 +26,7 @@ <type>text</type> <default></default> <notnull>true</notnull> - <length>50</length> + <length>64</length> </field> <field> @@ -42,7 +42,7 @@ <type>text</type> <default></default> <notnull>true</notnull> - <length>200</length> + <length>512</length> </field> <field> @@ -89,4 +89,30 @@ </table> + <table> + + <name>*dbprefix*files_trashsize</name> + + <declaration> + + <field> + <name>user</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>64</length> + </field> + + <field> + <name>size</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>50</length> + </field> + + </declaration> + + </table> + </database> diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml index 9b486126361..7f807da579e 100644 --- a/apps/files_trashbin/appinfo/info.xml +++ b/apps/files_trashbin/appinfo/info.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <info> <id>files_trashbin</id> - <name>Trash</name> - <description>Trash bin</description> + <name>Deleted files</name> + <description>Keep a copy of deleted files so that they can be restored if needed</description> <licence>AGPL</licence> <author>Bjoern Schiessle</author> <shipped>true</shipped> diff --git a/apps/files_trashbin/appinfo/update.php b/apps/files_trashbin/appinfo/update.php new file mode 100644 index 00000000000..b0bf79cc510 --- /dev/null +++ b/apps/files_trashbin/appinfo/update.php @@ -0,0 +1,40 @@ +<?php + +$installedVersion=OCP\Config::getAppValue('files_trashbin', 'installed_version'); +// move versions to new directory + +if (version_compare($installedVersion, '0.2', '<')) { + $datadir = \OCP\Config::getSystemValue('datadirectory').'/'; + + $users = \OCP\User::getUsers(); + foreach ($users as $user) { + + //create new folders + @mkdir($datadir.$user.'/files_trashbin/files'); + @mkdir($datadir.$user.'/files_trashbin/versions'); + @mkdir($datadir.$user.'/files_trashbin/keyfiles'); + + // move files to the new folders + if ($handle = opendir($datadir.$user.'/files_trashbin')) { + while (false !== ($file = readdir($handle))) { + if ($file != "." && $file != ".." && $file != 'files' && $file != 'versions' && $file != 'keyfiles') { + rename($datadir.$user.'/files_trashbin/'.$file, + $datadir.$user.'/files_trashbin/files/'.$file); + } + } + closedir($handle); + } + + // move versions to the new folder + if ($handle = opendir($datadir.$user.'/versions_trashbin')) { + while (false !== ($file = readdir($handle))) { + rename($datadir.$user.'/versions_trashbin/'.$file, + $datadir.$user.'/files_trashbin/versions/'.$file); + } + closedir($handle); + } + + @rmdir($datadir.$user.'/versions_trashbin'); + + } +}
\ No newline at end of file diff --git a/apps/files_trashbin/appinfo/version b/apps/files_trashbin/appinfo/version index 49d59571fbf..be586341736 100644 --- a/apps/files_trashbin/appinfo/version +++ b/apps/files_trashbin/appinfo/version @@ -1 +1 @@ -0.1 +0.3 diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index a4eb5cd216c..31b46cc2dec 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -11,16 +11,16 @@ OCP\Util::addScript('files', 'fileactions'); $tmpl = new OCP\Template('files_trashbin', 'index', 'user'); $user = \OCP\User::getUser(); -$view = new OC_Filesystemview('/'.$user.'/files_trashbin'); +$view = new OC_Filesystemview('/'.$user.'/files_trashbin/files'); OCP\Util::addStyle('files', 'files'); OCP\Util::addScript('files', 'filelist'); $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; +$result = array(); if ($dir) { $dirlisting = true; - $view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin'); $fullpath = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($dir); $dirContent = opendir($fullpath); $i = 0; @@ -29,7 +29,7 @@ if ($dir) { $pos = strpos($dir.'/', '/', 1); $tmp = substr($dir, 0, $pos); $pos = strrpos($tmp, '.d'); - $timestamp = substr($tmp,$pos+2); + $timestamp = substr($tmp, $pos+2); $result[] = array( 'id' => $entryName, 'timestamp' => $timestamp, @@ -39,11 +39,11 @@ if ($dir) { ); } } - closedir($fullpath); - + closedir($dirContent); + } else { $dirlisting = false; - $query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?'); + $query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE user = ?'); $result = $query->execute(array($user))->fetchAll(); } @@ -81,8 +81,8 @@ function fileCmp($a, $b) { usort($files, "fileCmp"); // Make breadcrumb -$breadcrumb = array(array('dir' => '', 'name' => 'Trash')); $pathtohere = ''; +$breadcrumb = array(); foreach (explode('/', $dir) as $i) { if ($i != '') { if ( preg_match('/^(.+)\.d[0-9]+$/', $i, $match) ) { @@ -107,6 +107,7 @@ $list->assign('disableSharing', true); $list->assign('dirlisting', $dirlisting); $list->assign('disableDownloadActions', true); $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); +$tmpl->assign('dirlisting', $dirlisting); $tmpl->assign('fileList', $list->fetchPage(), false); $tmpl->assign('files', $files); $tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($view->getAbsolutePath())); diff --git a/apps/files_trashbin/js/disableDefaultActions.js b/apps/files_trashbin/js/disableDefaultActions.js index 27c3e13db4d..df08bfb1a50 100644 --- a/apps/files_trashbin/js/disableDefaultActions.js +++ b/apps/files_trashbin/js/disableDefaultActions.js @@ -1,4 +1,4 @@ -/* disable download and sharing actions */
-var disableDownloadActions = true;
-var disableSharing = true;
+/* disable download and sharing actions */ +var disableDownloadActions = true; +var disableSharing = true; var trashBinApp = true;
\ No newline at end of file diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index c3429e7a838..9526859ad00 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -6,9 +6,10 @@ $(document).ready(function() { var tr=$('tr').filterAttr('data-file', filename); var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loader.gif') +'"></a>'; var undeleteAction = $('tr').filterAttr('data-file',filename).children("td.date"); + var files = tr.attr('data-file'); undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; $.post(OC.filePath('files_trashbin','ajax','undelete.php'), - {files:tr.attr('data-file'), dirlisting:tr.attr('data-dirlisting') }, + {files:JSON.stringify([files]), 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); @@ -21,32 +22,33 @@ $(document).ready(function() { }); }; - + FileActions.register('all', 'Delete', OC.PERMISSION_READ, function () { return OC.imagePath('core', 'actions/delete'); }, function (filename) { $('.tipsy').remove(); - + var tr=$('tr').filterAttr('data-file', filename); var deleteAction = $('tr').filterAttr('data-file',filename).children("td.date").children(".action.delete"); var oldHTML = deleteAction[0].outerHTML; var newHTML = '<img class="move2trash" data-action="Delete" title="'+t('files', 'delete file permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>'; + var files = tr.attr('data-file'); deleteAction[0].outerHTML = newHTML; - + $.post(OC.filePath('files_trashbin','ajax','delete.php'), - {file:tr.attr('data-file') }, + {files:JSON.stringify([files]), dirlisting:tr.attr('data-dirlisting') }, function(result){ - if ( result.status == 'success' ) { - var row = document.getElementById(result.data.filename); + for (var i = 0; i < result.data.success.length; i++) { + var row = document.getElementById(result.data.success[i].filename); row.parentNode.removeChild(row); - } else { - deleteAction[0].outerHTML = oldHTML; + } + if (result.status != 'success') { OC.dialogs.alert(result.data.message, 'Error'); } }); - + }); - + // Sets the select_all checkbox behaviour : $('#select_all').click(function() { if($(this).attr('checked')){ @@ -93,10 +95,10 @@ $(document).ready(function() { $('.undelete').click('click',function(event) { var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'perform restore operation')+'" src="'+ OC.imagePath('core', 'loader.gif') +'"></a>'; var files=getSelectedFiles('file'); - var fileslist=files.join(';'); + var fileslist = JSON.stringify(files); var dirlisting=getSelectedFiles('dirlisting')[0]; - for (var i in files) { + for (var i=0; i<files.length; i++) { var undeleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); undeleteAction[0].innerHTML = undeleteAction[0].innerHTML+spinner; } @@ -114,6 +116,31 @@ $(document).ready(function() { }); }); + $('.delete').click('click',function(event) { + console.log("delete selected"); + var spinner = '<img class="move2trash" title="'+t('files_trashbin', 'Delete permanently')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>'; + var files=getSelectedFiles('file'); + var fileslist = JSON.stringify(files); + var dirlisting=getSelectedFiles('dirlisting')[0]; + + for (var i=0; i<files.length; i++) { + var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date"); + deleteAction[0].innerHTML = deleteAction[0].innerHTML+spinner; + } + + $.post(OC.filePath('files_trashbin','ajax','delete.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); + } + if (result.status != 'success') { + OC.dialogs.alert(result.data.message, 'Error'); + } + }); + }); + $('#fileList').on('click', 'td.filename a', function(event) { var filename = $(this).parent().parent().attr('data-file'); var tr = $('tr').filterAttr('data-file',filename); diff --git a/apps/files_trashbin/l10n/ar.php b/apps/files_trashbin/l10n/ar.php index e38130fe2d3..7b2e2863367 100644 --- a/apps/files_trashbin/l10n/ar.php +++ b/apps/files_trashbin/l10n/ar.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "اسم" +"Name" => "اسم", +"Delete" => "إلغاء" ); diff --git a/apps/files_trashbin/l10n/bg_BG.php b/apps/files_trashbin/l10n/bg_BG.php index 681c1dc5802..957f6a45aac 100644 --- a/apps/files_trashbin/l10n/bg_BG.php +++ b/apps/files_trashbin/l10n/bg_BG.php @@ -1,3 +1,15 @@ <?php $TRANSLATIONS = array( -"Name" => "Име" +"Couldn't delete %s permanently" => "Невъзможно изтриване на %s завинаги", +"Couldn't restore %s" => "Невъзможно възтановяване на %s", +"perform restore operation" => "извършване на действие по възтановяване", +"delete file permanently" => "изтриване на файла завинаги", +"Name" => "Име", +"Deleted" => "Изтрито", +"1 folder" => "1 папка", +"{count} folders" => "{count} папки", +"1 file" => "1 файл", +"{count} files" => "{count} файла", +"Nothing in here. Your trash bin is empty!" => "Няма нищо. Кофата е празна!", +"Restore" => "Възтановяване", +"Delete" => "Изтриване" ); diff --git a/apps/files_trashbin/l10n/bn_BD.php b/apps/files_trashbin/l10n/bn_BD.php index c669eff7e1f..d61355c52c2 100644 --- a/apps/files_trashbin/l10n/bn_BD.php +++ b/apps/files_trashbin/l10n/bn_BD.php @@ -3,5 +3,6 @@ "1 folder" => "১টি ফোল্ডার", "{count} folders" => "{count} টি ফোল্ডার", "1 file" => "১টি ফাইল", -"{count} files" => "{count} টি ফাইল" +"{count} files" => "{count} টি ফাইল", +"Delete" => "মুছে" ); diff --git a/apps/files_trashbin/l10n/ca.php b/apps/files_trashbin/l10n/ca.php index 3af33c8a310..894ed6a729d 100644 --- a/apps/files_trashbin/l10n/ca.php +++ b/apps/files_trashbin/l10n/ca.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "No s'ha pogut esborrar permanentment %s", +"Couldn't restore %s" => "No s'ha pogut restaurar %s", "perform restore operation" => "executa l'operació de restauració", +"delete file permanently" => "esborra el fitxer permanentment", +"Delete permanently" => "Esborra permanentment", "Name" => "Nom", "Deleted" => "Eliminat", "1 folder" => "1 carpeta", @@ -7,5 +11,6 @@ "1 file" => "1 fitxer", "{count} files" => "{count} fitxers", "Nothing in here. Your trash bin is empty!" => "La paperera està buida!", -"Restore" => "Recupera" +"Restore" => "Recupera", +"Delete" => "Esborra" ); diff --git a/apps/files_trashbin/l10n/cs_CZ.php b/apps/files_trashbin/l10n/cs_CZ.php index caaaea37436..d32af39877b 100644 --- a/apps/files_trashbin/l10n/cs_CZ.php +++ b/apps/files_trashbin/l10n/cs_CZ.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Nelze trvale odstranit %s", +"Couldn't restore %s" => "Nelze obnovit %s", "perform restore operation" => "provést obnovu", +"delete file permanently" => "trvale odstranit soubor", +"Delete permanently" => "Trvale odstranit", "Name" => "Název", "Deleted" => "Smazáno", "1 folder" => "1 složka", @@ -7,5 +11,6 @@ "1 file" => "1 soubor", "{count} files" => "{count} soubory", "Nothing in here. Your trash bin is empty!" => "Žádný obsah. Váš koš je prázdný.", -"Restore" => "Obnovit" +"Restore" => "Obnovit", +"Delete" => "Smazat" ); diff --git a/apps/files_trashbin/l10n/da.php b/apps/files_trashbin/l10n/da.php index 3343b6fc8f6..ca4a2e8215d 100644 --- a/apps/files_trashbin/l10n/da.php +++ b/apps/files_trashbin/l10n/da.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Kunne ikke slette %s permanent", +"Couldn't restore %s" => "Kunne ikke gendanne %s", +"perform restore operation" => "udfør gendannelsesoperation", +"delete file permanently" => "slet fil permanent", +"Delete permanently" => "Slet permanent", "Name" => "Navn", +"Deleted" => "Slettet", "1 folder" => "1 mappe", "{count} folders" => "{count} mapper", "1 file" => "1 fil", "{count} files" => "{count} filer", -"Restore" => "Gendan" +"Nothing in here. Your trash bin is empty!" => "Intet at se her. Din papirkurv er tom!", +"Restore" => "Gendan", +"Delete" => "Slet" ); diff --git a/apps/files_trashbin/l10n/de.php b/apps/files_trashbin/l10n/de.php index 45dfb9d6057..d1952c9635a 100644 --- a/apps/files_trashbin/l10n/de.php +++ b/apps/files_trashbin/l10n/de.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen", +"Couldn't restore %s" => "Konnte %s nicht wiederherstellen", "perform restore operation" => "Wiederherstellung ausführen", +"delete file permanently" => "Datei dauerhaft löschen", +"Delete permanently" => "Permanent löschen", "Name" => "Name", "Deleted" => "gelöscht", "1 folder" => "1 Ordner", @@ -7,5 +11,6 @@ "1 file" => "1 Datei", "{count} files" => "{count} Dateien", "Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, der Papierkorb ist leer!", -"Restore" => "Wiederherstellen" +"Restore" => "Wiederherstellen", +"Delete" => "Löschen" ); diff --git a/apps/files_trashbin/l10n/de_DE.php b/apps/files_trashbin/l10n/de_DE.php index 45e30d85a3b..269680ca2c3 100644 --- a/apps/files_trashbin/l10n/de_DE.php +++ b/apps/files_trashbin/l10n/de_DE.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( -"perform restore operation" => "Führe die Wiederherstellung aus", +"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen", +"Couldn't restore %s" => "Konnte %s nicht wiederherstellen", +"perform restore operation" => "Wiederherstellung ausführen", +"delete file permanently" => "Datei dauerhaft löschen", +"Delete permanently" => "Endgültig löschen", "Name" => "Name", "Deleted" => "Gelöscht", "1 folder" => "1 Ordner", @@ -7,5 +11,6 @@ "1 file" => "1 Datei", "{count} files" => "{count} Dateien", "Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, Ihr Papierkorb ist leer!", -"Restore" => "Wiederherstellen" +"Restore" => "Wiederherstellen", +"Delete" => "Löschen" ); diff --git a/apps/files_trashbin/l10n/el.php b/apps/files_trashbin/l10n/el.php index 83e359890ea..cf9471780c0 100644 --- a/apps/files_trashbin/l10n/el.php +++ b/apps/files_trashbin/l10n/el.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Αδύνατη η μόνιμη διαγραφή του %s", +"Couldn't restore %s" => "Αδυναμία επαναφοράς %s", +"perform restore operation" => "εκτέλεση λειτουργία επαναφοράς", +"delete file permanently" => "μόνιμη διαγραφή αρχείου", +"Delete permanently" => "Μόνιμη διαγραφή", "Name" => "Όνομα", +"Deleted" => "Διαγράφηκε", "1 folder" => "1 φάκελος", "{count} folders" => "{count} φάκελοι", "1 file" => "1 αρχείο", "{count} files" => "{count} αρχεία", -"Restore" => "Επαναφορά" +"Nothing in here. Your trash bin is empty!" => "Δεν υπάρχει τίποτα εδώ. Ο κάδος σας είναι άδειος!", +"Restore" => "Επαναφορά", +"Delete" => "Διαγραφή" ); diff --git a/apps/files_trashbin/l10n/eo.php b/apps/files_trashbin/l10n/eo.php index f357e3c10c2..e1e5acbb5a8 100644 --- a/apps/files_trashbin/l10n/eo.php +++ b/apps/files_trashbin/l10n/eo.php @@ -4,5 +4,6 @@ "{count} folders" => "{count} dosierujoj", "1 file" => "1 dosiero", "{count} files" => "{count} dosierujoj", -"Restore" => "Restaŭri" +"Restore" => "Restaŭri", +"Delete" => "Forigi" ); diff --git a/apps/files_trashbin/l10n/es.php b/apps/files_trashbin/l10n/es.php index b191ffc4246..ebc01b1d21e 100644 --- a/apps/files_trashbin/l10n/es.php +++ b/apps/files_trashbin/l10n/es.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "No se puede eliminar %s permanentemente", +"Couldn't restore %s" => "No se puede restaurar %s", "perform restore operation" => "Restaurar", +"delete file permanently" => "Eliminar archivo permanentemente", +"Delete permanently" => "Eliminar permanentemente", "Name" => "Nombre", "Deleted" => "Eliminado", "1 folder" => "1 carpeta", @@ -7,5 +11,6 @@ "1 file" => "1 archivo", "{count} files" => "{count} archivos", "Nothing in here. Your trash bin is empty!" => "Nada aqui. La papelera esta vacia!", -"Restore" => "Recuperar" +"Restore" => "Recuperar", +"Delete" => "Eliminar" ); diff --git a/apps/files_trashbin/l10n/es_AR.php b/apps/files_trashbin/l10n/es_AR.php index d2c5f304284..bb78a39d6c3 100644 --- a/apps/files_trashbin/l10n/es_AR.php +++ b/apps/files_trashbin/l10n/es_AR.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "No fue posible borrar %s de manera permanente", +"Couldn't restore %s" => "No se pudo restaurar %s", +"perform restore operation" => "Restaurar", +"delete file permanently" => "Borrar archivo de manera permanente", +"Delete permanently" => "Borrar de manera permanente", "Name" => "Nombre", +"Deleted" => "Borrado", "1 folder" => "1 directorio", "{count} folders" => "{count} directorios", "1 file" => "1 archivo", "{count} files" => "{count} archivos", -"Restore" => "Recuperar" +"Nothing in here. Your trash bin is empty!" => "No hay nada acá. ¡La papelera está vacía!", +"Restore" => "Recuperar", +"Delete" => "Borrar" ); diff --git a/apps/files_trashbin/l10n/et_EE.php b/apps/files_trashbin/l10n/et_EE.php index 4f46f388020..73ae9dbee18 100644 --- a/apps/files_trashbin/l10n/et_EE.php +++ b/apps/files_trashbin/l10n/et_EE.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "%s jäädavalt kustutamine ebaõnnestus", +"Couldn't restore %s" => "%s ei saa taastada", +"perform restore operation" => "soorita taastamine", +"delete file permanently" => "kustuta fail jäädavalt", +"Delete permanently" => "Kustuta jäädavalt", "Name" => "Nimi", +"Deleted" => "Kustutatud", "1 folder" => "1 kaust", "{count} folders" => "{count} kausta", "1 file" => "1 fail", -"{count} files" => "{count} faili" +"{count} files" => "{count} faili", +"Nothing in here. Your trash bin is empty!" => "Siin pole midagi. Sinu prügikast on tühi!", +"Restore" => "Taasta", +"Delete" => "Kustuta" ); diff --git a/apps/files_trashbin/l10n/eu.php b/apps/files_trashbin/l10n/eu.php index a1e3ca53e61..5a565436ede 100644 --- a/apps/files_trashbin/l10n/eu.php +++ b/apps/files_trashbin/l10n/eu.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Ezin izan da %s betirako ezabatu", +"Couldn't restore %s" => "Ezin izan da %s berreskuratu", +"perform restore operation" => "berreskuratu", +"delete file permanently" => "ezabatu fitxategia betirako", +"Delete permanently" => "Ezabatu betirako", "Name" => "Izena", +"Deleted" => "Ezabatuta", "1 folder" => "karpeta bat", "{count} folders" => "{count} karpeta", "1 file" => "fitxategi bat", "{count} files" => "{count} fitxategi", -"Restore" => "Berrezarri" +"Nothing in here. Your trash bin is empty!" => "Ez dago ezer ez. Zure zakarrontzia hutsik dago!", +"Restore" => "Berrezarri", +"Delete" => "Ezabatu" ); diff --git a/apps/files_trashbin/l10n/fa.php b/apps/files_trashbin/l10n/fa.php index 487d1657985..7cc695215e6 100644 --- a/apps/files_trashbin/l10n/fa.php +++ b/apps/files_trashbin/l10n/fa.php @@ -4,5 +4,6 @@ "{count} folders" => "{ شمار} پوشه ها", "1 file" => "1 پرونده", "{count} files" => "{ شمار } فایل ها", -"Restore" => "بازیابی" +"Restore" => "بازیابی", +"Delete" => "حذف" ); diff --git a/apps/files_trashbin/l10n/fi_FI.php b/apps/files_trashbin/l10n/fi_FI.php index de25027f9a8..e18689956d0 100644 --- a/apps/files_trashbin/l10n/fi_FI.php +++ b/apps/files_trashbin/l10n/fi_FI.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Kohdetta %s ei voitu poistaa pysyvästi", +"Couldn't restore %s" => "Kohteen %s palautus epäonnistui", "perform restore operation" => "suorita palautustoiminto", +"delete file permanently" => "poista tiedosto pysyvästi", +"Delete permanently" => "Poista pysyvästi", "Name" => "Nimi", "Deleted" => "Poistettu", "1 folder" => "1 kansio", @@ -7,5 +11,6 @@ "1 file" => "1 tiedosto", "{count} files" => "{count} tiedostoa", "Nothing in here. Your trash bin is empty!" => "Tyhjää täynnä! Roskakorissa ei ole mitään.", -"Restore" => "Palauta" +"Restore" => "Palauta", +"Delete" => "Poista" ); diff --git a/apps/files_trashbin/l10n/fr.php b/apps/files_trashbin/l10n/fr.php index 51ade82d908..0a783785efb 100644 --- a/apps/files_trashbin/l10n/fr.php +++ b/apps/files_trashbin/l10n/fr.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Impossible d'effacer %s de façon permanente", +"Couldn't restore %s" => "Impossible de restaurer %s", "perform restore operation" => "effectuer l'opération de restauration", +"delete file permanently" => "effacer définitivement le fichier", +"Delete permanently" => "Supprimer de façon définitive", "Name" => "Nom", "Deleted" => "Effacé", "1 folder" => "1 dossier", @@ -7,5 +11,6 @@ "1 file" => "1 fichier", "{count} files" => "{count} fichiers", "Nothing in here. Your trash bin is empty!" => "Il n'y a rien ici. Votre corbeille est vide !", -"Restore" => "Restaurer" +"Restore" => "Restaurer", +"Delete" => "Supprimer" ); diff --git a/apps/files_trashbin/l10n/gl.php b/apps/files_trashbin/l10n/gl.php index bdc3187b20b..4e31dd0018a 100644 --- a/apps/files_trashbin/l10n/gl.php +++ b/apps/files_trashbin/l10n/gl.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Non foi posíbel eliminar %s permanente", +"Couldn't restore %s" => "Non foi posíbel restaurar %s", +"perform restore operation" => "realizar a operación de restauración", +"delete file permanently" => "eliminar o ficheiro permanentemente", +"Delete permanently" => "Eliminar permanentemente", "Name" => "Nome", +"Deleted" => "Eliminado", "1 folder" => "1 cartafol", "{count} folders" => "{count} cartafoles", "1 file" => "1 ficheiro", "{count} files" => "{count} ficheiros", -"Restore" => "Restablecer" +"Nothing in here. Your trash bin is empty!" => "Aquí non hai nada. O cesto do lixo está baleiro!", +"Restore" => "Restablecer", +"Delete" => "Eliminar" ); diff --git a/apps/files_trashbin/l10n/he.php b/apps/files_trashbin/l10n/he.php index d026add5d75..9c767d2222c 100644 --- a/apps/files_trashbin/l10n/he.php +++ b/apps/files_trashbin/l10n/he.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "בלתי אפשרי למחוק את %s לצמיתות", +"Couldn't restore %s" => "בלתי אפשרי לשחזר את %s", +"perform restore operation" => "בצע פעולת שחזור", +"delete file permanently" => "מחק קובץ לצמיתות", +"Delete permanently" => "מחק לצמיתות", "Name" => "שם", +"Deleted" => "נמחק", "1 folder" => "תיקייה אחת", "{count} folders" => "{count} תיקיות", "1 file" => "קובץ אחד", -"{count} files" => "{count} קבצים" +"{count} files" => "{count} קבצים", +"Nothing in here. Your trash bin is empty!" => "שום דבר כאן. סל המחזור שלך ריק!", +"Restore" => "שחזר", +"Delete" => "מחיקה" ); diff --git a/apps/files_trashbin/l10n/hr.php b/apps/files_trashbin/l10n/hr.php index 52255c7429a..2cb86adfd40 100644 --- a/apps/files_trashbin/l10n/hr.php +++ b/apps/files_trashbin/l10n/hr.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Ime" +"Name" => "Ime", +"Delete" => "Obriši" ); diff --git a/apps/files_trashbin/l10n/hu_HU.php b/apps/files_trashbin/l10n/hu_HU.php index c4e2b5e2125..9c158c2b9ec 100644 --- a/apps/files_trashbin/l10n/hu_HU.php +++ b/apps/files_trashbin/l10n/hu_HU.php @@ -1,8 +1,16 @@ <?php $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", +"perform restore operation" => "a visszaállítás végrehajtása", +"delete file permanently" => "az állomány végleges törlése", +"Delete permanently" => "Végleges törlés", "Name" => "Név", +"Deleted" => "Törölve", "1 folder" => "1 mappa", "{count} folders" => "{count} mappa", "1 file" => "1 fájl", "{count} files" => "{count} fájl", -"Restore" => "Visszaállítás" +"Nothing in here. Your trash bin is empty!" => "Itt nincs semmi. Az Ön szemetes mappája üres!", +"Restore" => "Visszaállítás", +"Delete" => "Törlés" ); diff --git a/apps/files_trashbin/l10n/hy.php b/apps/files_trashbin/l10n/hy.php new file mode 100644 index 00000000000..3b80487278a --- /dev/null +++ b/apps/files_trashbin/l10n/hy.php @@ -0,0 +1,3 @@ +<?php $TRANSLATIONS = array( +"Delete" => "Ջնջել" +); diff --git a/apps/files_trashbin/l10n/ia.php b/apps/files_trashbin/l10n/ia.php index c2581f3de17..0a51752312f 100644 --- a/apps/files_trashbin/l10n/ia.php +++ b/apps/files_trashbin/l10n/ia.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Nomine" +"Name" => "Nomine", +"Delete" => "Deler" ); diff --git a/apps/files_trashbin/l10n/id.php b/apps/files_trashbin/l10n/id.php index 1a14d8b7c21..ab5fe25ac6b 100644 --- a/apps/files_trashbin/l10n/id.php +++ b/apps/files_trashbin/l10n/id.php @@ -1,3 +1,15 @@ <?php $TRANSLATIONS = array( -"Name" => "nama" +"Couldn't delete %s permanently" => "Tidak dapat menghapus permanen %s", +"Couldn't restore %s" => "Tidak dapat memulihkan %s", +"perform restore operation" => "jalankan operasi pemulihan", +"delete file permanently" => "hapus berkas secara permanen", +"Name" => "Nama", +"Deleted" => "Dihapus", +"1 folder" => "1 map", +"{count} folders" => "{count} map", +"1 file" => "1 berkas", +"{count} files" => "{count} berkas", +"Nothing in here. Your trash bin is empty!" => "Tempat sampah anda kosong!", +"Restore" => "Pulihkan", +"Delete" => "Hapus" ); diff --git a/apps/files_trashbin/l10n/is.php b/apps/files_trashbin/l10n/is.php index 416f641a8ef..fba36c91cb5 100644 --- a/apps/files_trashbin/l10n/is.php +++ b/apps/files_trashbin/l10n/is.php @@ -3,5 +3,6 @@ "1 folder" => "1 mappa", "{count} folders" => "{count} möppur", "1 file" => "1 skrá", -"{count} files" => "{count} skrár" +"{count} files" => "{count} skrár", +"Delete" => "Eyða" ); diff --git a/apps/files_trashbin/l10n/it.php b/apps/files_trashbin/l10n/it.php index 7def431a42a..027b22c91ac 100644 --- a/apps/files_trashbin/l10n/it.php +++ b/apps/files_trashbin/l10n/it.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Impossibile eliminare %s definitivamente", +"Couldn't restore %s" => "Impossibile ripristinare %s", "perform restore operation" => "esegui operazione di ripristino", +"delete file permanently" => "elimina il file definitivamente", +"Delete permanently" => "Elimina definitivamente", "Name" => "Nome", "Deleted" => "Eliminati", "1 folder" => "1 cartella", @@ -7,5 +11,6 @@ "1 file" => "1 file", "{count} files" => "{count} file", "Nothing in here. Your trash bin is empty!" => "Qui non c'è niente. Il tuo cestino è vuoto.", -"Restore" => "Ripristina" +"Restore" => "Ripristina", +"Delete" => "Elimina" ); diff --git a/apps/files_trashbin/l10n/ja_JP.php b/apps/files_trashbin/l10n/ja_JP.php index 0b4e1954e74..478aa400664 100644 --- a/apps/files_trashbin/l10n/ja_JP.php +++ b/apps/files_trashbin/l10n/ja_JP.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "%s を完全に削除出来ませんでした", +"Couldn't restore %s" => "%s を復元出来ませんでした", "perform restore operation" => "復元操作を実行する", +"delete file permanently" => "ファイルを完全に削除する", +"Delete permanently" => "完全に削除する", "Name" => "名前", "Deleted" => "削除済み", "1 folder" => "1 フォルダ", @@ -7,5 +11,6 @@ "1 file" => "1 ファイル", "{count} files" => "{count} ファイル", "Nothing in here. Your trash bin is empty!" => "ここには何もありません。ゴミ箱は空です!", -"Restore" => "復元" +"Restore" => "復元", +"Delete" => "削除" ); diff --git a/apps/files_trashbin/l10n/ka_GE.php b/apps/files_trashbin/l10n/ka_GE.php index 43dba38f5c7..05068767863 100644 --- a/apps/files_trashbin/l10n/ka_GE.php +++ b/apps/files_trashbin/l10n/ka_GE.php @@ -3,5 +3,6 @@ "1 folder" => "1 საქაღალდე", "{count} folders" => "{count} საქაღალდე", "1 file" => "1 ფაილი", -"{count} files" => "{count} ფაილი" +"{count} files" => "{count} ფაილი", +"Delete" => "წაშლა" ); diff --git a/apps/files_trashbin/l10n/ko.php b/apps/files_trashbin/l10n/ko.php index 61acd1276a7..b40546e34b8 100644 --- a/apps/files_trashbin/l10n/ko.php +++ b/apps/files_trashbin/l10n/ko.php @@ -4,5 +4,6 @@ "{count} folders" => "폴더 {count}개", "1 file" => "파일 1개", "{count} files" => "파일 {count}개", -"Restore" => "복원" +"Restore" => "복원", +"Delete" => "삭제" ); diff --git a/apps/files_trashbin/l10n/lb.php b/apps/files_trashbin/l10n/lb.php index d1bd7518663..01deea23500 100644 --- a/apps/files_trashbin/l10n/lb.php +++ b/apps/files_trashbin/l10n/lb.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Numm" +"Name" => "Numm", +"Delete" => "Läschen" ); diff --git a/apps/files_trashbin/l10n/lt_LT.php b/apps/files_trashbin/l10n/lt_LT.php index 4933e97202f..513c7626c4e 100644 --- a/apps/files_trashbin/l10n/lt_LT.php +++ b/apps/files_trashbin/l10n/lt_LT.php @@ -3,5 +3,6 @@ "1 folder" => "1 aplankalas", "{count} folders" => "{count} aplankalai", "1 file" => "1 failas", -"{count} files" => "{count} failai" +"{count} files" => "{count} failai", +"Delete" => "Ištrinti" ); diff --git a/apps/files_trashbin/l10n/lv.php b/apps/files_trashbin/l10n/lv.php index 017a8d285c0..d3c68e2a778 100644 --- a/apps/files_trashbin/l10n/lv.php +++ b/apps/files_trashbin/l10n/lv.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Nevarēja pilnībā izdzēst %s", +"Couldn't restore %s" => "Nevarēja atjaunot %s", "perform restore operation" => "veikt atjaunošanu", +"delete file permanently" => "dzēst datni pavisam", +"Delete permanently" => "Dzēst pavisam", "Name" => "Nosaukums", "Deleted" => "Dzēsts", "1 folder" => "1 mape", @@ -7,5 +11,6 @@ "1 file" => "1 datne", "{count} files" => "{count} datnes", "Nothing in here. Your trash bin is empty!" => "Šeit nekā nav. Jūsu miskaste ir tukša!", -"Restore" => "Atjaunot" +"Restore" => "Atjaunot", +"Delete" => "Dzēst" ); diff --git a/apps/files_trashbin/l10n/mk.php b/apps/files_trashbin/l10n/mk.php index b983c341e8c..22b288b002f 100644 --- a/apps/files_trashbin/l10n/mk.php +++ b/apps/files_trashbin/l10n/mk.php @@ -3,5 +3,6 @@ "1 folder" => "1 папка", "{count} folders" => "{count} папки", "1 file" => "1 датотека", -"{count} files" => "{count} датотеки" +"{count} files" => "{count} датотеки", +"Delete" => "Избриши" ); diff --git a/apps/files_trashbin/l10n/ms_MY.php b/apps/files_trashbin/l10n/ms_MY.php index 73e97b496e4..381d599865e 100644 --- a/apps/files_trashbin/l10n/ms_MY.php +++ b/apps/files_trashbin/l10n/ms_MY.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Nama" +"Name" => "Nama", +"Delete" => "Padam" ); diff --git a/apps/files_trashbin/l10n/nb_NO.php b/apps/files_trashbin/l10n/nb_NO.php index 49364753d13..dc7b8fe97c5 100644 --- a/apps/files_trashbin/l10n/nb_NO.php +++ b/apps/files_trashbin/l10n/nb_NO.php @@ -3,5 +3,6 @@ "1 folder" => "1 mappe", "{count} folders" => "{count} mapper", "1 file" => "1 fil", -"{count} files" => "{count} filer" +"{count} files" => "{count} filer", +"Delete" => "Slett" ); diff --git a/apps/files_trashbin/l10n/nl.php b/apps/files_trashbin/l10n/nl.php index 4efa6ecf662..c576e5d81f8 100644 --- a/apps/files_trashbin/l10n/nl.php +++ b/apps/files_trashbin/l10n/nl.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Kon %s niet permanent verwijderen", +"Couldn't restore %s" => "Kon %s niet herstellen", "perform restore operation" => "uitvoeren restore operatie", +"delete file permanently" => "verwijder bestanden definitief", +"Delete permanently" => "Verwijder definitief", "Name" => "Naam", "Deleted" => "Verwijderd", "1 folder" => "1 map", @@ -7,5 +11,6 @@ "1 file" => "1 bestand", "{count} files" => "{count} bestanden", "Nothing in here. Your trash bin is empty!" => "Niets te vinden. Uw prullenbak is leeg!", -"Restore" => "Herstellen" +"Restore" => "Herstellen", +"Delete" => "Verwijder" ); diff --git a/apps/files_trashbin/l10n/nn_NO.php b/apps/files_trashbin/l10n/nn_NO.php index be60dabdf01..f8ab465ee42 100644 --- a/apps/files_trashbin/l10n/nn_NO.php +++ b/apps/files_trashbin/l10n/nn_NO.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Namn" +"Name" => "Namn", +"Delete" => "Slett" ); diff --git a/apps/files_trashbin/l10n/oc.php b/apps/files_trashbin/l10n/oc.php index 2c705193c15..e6b939dac0c 100644 --- a/apps/files_trashbin/l10n/oc.php +++ b/apps/files_trashbin/l10n/oc.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Nom" +"Name" => "Nom", +"Delete" => "Escafa" ); diff --git a/apps/files_trashbin/l10n/pl.php b/apps/files_trashbin/l10n/pl.php index d2ada4c9466..e5ea45b88ae 100644 --- a/apps/files_trashbin/l10n/pl.php +++ b/apps/files_trashbin/l10n/pl.php @@ -1,8 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Nie można trwale usunąć %s", +"Couldn't restore %s" => "Nie można przywrócić %s", +"perform restore operation" => "wykonywanie operacji przywracania", +"delete file permanently" => "trwale usuń plik", +"Delete permanently" => "Trwale usuń", "Name" => "Nazwa", +"Deleted" => "Usunięte", "1 folder" => "1 folder", "{count} folders" => "{count} foldery", "1 file" => "1 plik", "{count} files" => "{count} pliki", -"Restore" => "Przywróć" +"Nothing in here. Your trash bin is empty!" => "Nic tu nie ma. Twój kosz jest pusty!", +"Restore" => "Przywróć", +"Delete" => "Usuń" ); diff --git a/apps/files_trashbin/l10n/pt_BR.php b/apps/files_trashbin/l10n/pt_BR.php index db5737d9238..b9932a71023 100644 --- a/apps/files_trashbin/l10n/pt_BR.php +++ b/apps/files_trashbin/l10n/pt_BR.php @@ -1,5 +1,9 @@ <?php $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", "perform restore operation" => "realizar operação de restauração", +"delete file permanently" => "excluir arquivo permanentemente", +"Delete permanently" => "Excluir permanentemente", "Name" => "Nome", "Deleted" => "Excluído", "1 folder" => "1 pasta", @@ -7,5 +11,6 @@ "1 file" => "1 arquivo", "{count} files" => "{count} arquivos", "Nothing in here. Your trash bin is empty!" => "Nada aqui. Sua lixeira está vazia!", -"Restore" => "Restaurar" +"Restore" => "Restaurar", +"Delete" => "Excluir" ); diff --git a/apps/files_trashbin/l10n/pt_PT.php b/apps/files_trashbin/l10n/pt_PT.php index 79930315b0e..a621587ea0b 100644 --- a/apps/files_trashbin/l10n/pt_PT.php +++ b/apps/files_trashbin/l10n/pt_PT.php @@ -1,5 +1,9 @@ <?php $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", "perform restore operation" => "Restaurar", +"delete file permanently" => "Eliminar permanentemente o(s) ficheiro(s)", +"Delete permanently" => "Eliminar permanentemente", "Name" => "Nome", "Deleted" => "Apagado", "1 folder" => "1 pasta", @@ -7,5 +11,6 @@ "1 file" => "1 ficheiro", "{count} files" => "{count} ficheiros", "Nothing in here. Your trash bin is empty!" => "Não ha ficheiros. O lixo está vazio", -"Restore" => "Restaurar" +"Restore" => "Restaurar", +"Delete" => "Apagar" ); diff --git a/apps/files_trashbin/l10n/ro.php b/apps/files_trashbin/l10n/ro.php index 6ece51e02cf..6a919b62dfb 100644 --- a/apps/files_trashbin/l10n/ro.php +++ b/apps/files_trashbin/l10n/ro.php @@ -3,5 +3,6 @@ "1 folder" => "1 folder", "{count} folders" => "{count} foldare", "1 file" => "1 fisier", -"{count} files" => "{count} fisiere" +"{count} files" => "{count} fisiere", +"Delete" => "Șterge" ); diff --git a/apps/files_trashbin/l10n/ru.php b/apps/files_trashbin/l10n/ru.php index 23d739a2ff7..4cf9af1fc39 100644 --- a/apps/files_trashbin/l10n/ru.php +++ b/apps/files_trashbin/l10n/ru.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "%s не может быть удалён навсегда", +"Couldn't restore %s" => "%s не может быть восстановлен", +"perform restore operation" => "выполнить операцию восстановления", +"delete file permanently" => "удалить файл навсегда", +"Delete permanently" => "Удалено навсегда", "Name" => "Имя", +"Deleted" => "Удалён", "1 folder" => "1 папка", "{count} folders" => "{count} папок", "1 file" => "1 файл", -"{count} files" => "{count} файлов" +"{count} files" => "{count} файлов", +"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!", +"Restore" => "Восстановить", +"Delete" => "Удалить" ); diff --git a/apps/files_trashbin/l10n/ru_RU.php b/apps/files_trashbin/l10n/ru_RU.php index 8ef2658cf24..04a899bdd5d 100644 --- a/apps/files_trashbin/l10n/ru_RU.php +++ b/apps/files_trashbin/l10n/ru_RU.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "%s не может быть удалён навсегда", +"Couldn't restore %s" => "%s не может быть восстановлен", +"perform restore operation" => "выполнить операцию восстановления", +"delete file permanently" => "удалить файл навсегда", +"Delete permanently" => "Удалить навсегда", "Name" => "Имя", +"Deleted" => "Удалён", "1 folder" => "1 папка", "{count} folders" => "{количество} папок", "1 file" => "1 файл", -"{count} files" => "{количество} файлов" +"{count} files" => "{количество} файлов", +"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!", +"Restore" => "Восстановить", +"Delete" => "Удалить" ); diff --git a/apps/files_trashbin/l10n/si_LK.php b/apps/files_trashbin/l10n/si_LK.php index cb351afaec9..71c56329776 100644 --- a/apps/files_trashbin/l10n/si_LK.php +++ b/apps/files_trashbin/l10n/si_LK.php @@ -1,5 +1,6 @@ <?php $TRANSLATIONS = array( "Name" => "නම", "1 folder" => "1 ෆොල්ඩරයක්", -"1 file" => "1 ගොනුවක්" +"1 file" => "1 ගොනුවක්", +"Delete" => "මකා දමන්න" ); diff --git a/apps/files_trashbin/l10n/sk_SK.php b/apps/files_trashbin/l10n/sk_SK.php index 81d43614d7b..c5806a5dee8 100644 --- a/apps/files_trashbin/l10n/sk_SK.php +++ b/apps/files_trashbin/l10n/sk_SK.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Nemožno zmazať %s navždy", +"Couldn't restore %s" => "Nemožno obnoviť %s", "perform restore operation" => "vykonať obnovu", +"delete file permanently" => "trvalo zmazať súbor", +"Delete permanently" => "Zmazať trvalo", "Name" => "Meno", "Deleted" => "Zmazané", "1 folder" => "1 priečinok", @@ -7,5 +11,6 @@ "1 file" => "1 súbor", "{count} files" => "{count} súborov", "Nothing in here. Your trash bin is empty!" => "Žiadny obsah. Kôš je prázdny!", -"Restore" => "Obnoviť" +"Restore" => "Obnoviť", +"Delete" => "Zmazať" ); diff --git a/apps/files_trashbin/l10n/sl.php b/apps/files_trashbin/l10n/sl.php index 2579f95c862..4765945747d 100644 --- a/apps/files_trashbin/l10n/sl.php +++ b/apps/files_trashbin/l10n/sl.php @@ -3,5 +3,6 @@ "1 folder" => "1 mapa", "{count} folders" => "{count} map", "1 file" => "1 datoteka", -"{count} files" => "{count} datotek" +"{count} files" => "{count} datotek", +"Delete" => "Izbriši" ); diff --git a/apps/files_trashbin/l10n/sr.php b/apps/files_trashbin/l10n/sr.php index 36659e70803..2e7c139e389 100644 --- a/apps/files_trashbin/l10n/sr.php +++ b/apps/files_trashbin/l10n/sr.php @@ -7,5 +7,6 @@ "1 file" => "1 датотека", "{count} files" => "{count} датотеке/а", "Nothing in here. Your trash bin is empty!" => "Овде нема ништа. Корпа за отпатке је празна.", -"Restore" => "Врати" +"Restore" => "Врати", +"Delete" => "Обриши" ); diff --git a/apps/files_trashbin/l10n/sr@latin.php b/apps/files_trashbin/l10n/sr@latin.php index 52255c7429a..2cb86adfd40 100644 --- a/apps/files_trashbin/l10n/sr@latin.php +++ b/apps/files_trashbin/l10n/sr@latin.php @@ -1,3 +1,4 @@ <?php $TRANSLATIONS = array( -"Name" => "Ime" +"Name" => "Ime", +"Delete" => "Obriši" ); diff --git a/apps/files_trashbin/l10n/sv.php b/apps/files_trashbin/l10n/sv.php index 5bde85e7056..6f8c2365818 100644 --- a/apps/files_trashbin/l10n/sv.php +++ b/apps/files_trashbin/l10n/sv.php @@ -1,5 +1,9 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Kunde inte radera %s permanent", +"Couldn't restore %s" => "Kunde inte återställa %s", "perform restore operation" => "utför återställning", +"delete file permanently" => "radera filen permanent", +"Delete permanently" => "Radera permanent", "Name" => "Namn", "Deleted" => "Raderad", "1 folder" => "1 mapp", @@ -7,5 +11,6 @@ "1 file" => "1 fil", "{count} files" => "{count} filer", "Nothing in here. Your trash bin is empty!" => "Ingenting här. Din papperskorg är tom!", -"Restore" => "Återskapa" +"Restore" => "Återskapa", +"Delete" => "Radera" ); diff --git a/apps/files_trashbin/l10n/ta_LK.php b/apps/files_trashbin/l10n/ta_LK.php index a436e2344a4..f21e5fc750d 100644 --- a/apps/files_trashbin/l10n/ta_LK.php +++ b/apps/files_trashbin/l10n/ta_LK.php @@ -3,5 +3,6 @@ "1 folder" => "1 கோப்புறை", "{count} folders" => "{எண்ணிக்கை} கோப்புறைகள்", "1 file" => "1 கோப்பு", -"{count} files" => "{எண்ணிக்கை} கோப்புகள்" +"{count} files" => "{எண்ணிக்கை} கோப்புகள்", +"Delete" => "நீக்குக" ); diff --git a/apps/files_trashbin/l10n/th_TH.php b/apps/files_trashbin/l10n/th_TH.php index 8a031fb0d70..3f5d44c763e 100644 --- a/apps/files_trashbin/l10n/th_TH.php +++ b/apps/files_trashbin/l10n/th_TH.php @@ -7,5 +7,6 @@ "1 file" => "1 ไฟล์", "{count} files" => "{count} ไฟล์", "Nothing in here. Your trash bin is empty!" => "ไม่มีอะไรอยู่ในนี้ ถังขยะของคุณยังว่างอยู่", -"Restore" => "คืนค่า" +"Restore" => "คืนค่า", +"Delete" => "ลบ" ); diff --git a/apps/files_trashbin/l10n/tr.php b/apps/files_trashbin/l10n/tr.php index 5b7064eceaf..c874d73316a 100644 --- a/apps/files_trashbin/l10n/tr.php +++ b/apps/files_trashbin/l10n/tr.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "%s Kalıcı olarak silinemedi", +"Couldn't restore %s" => "%s Geri yüklenemedi", +"perform restore operation" => "Geri yükleme işlemini gerçekleştir", +"delete file permanently" => "Dosyayı kalıcı olarak sil", +"Delete permanently" => "Kalıcı olarak sil", "Name" => "İsim", +"Deleted" => "Silindi", "1 folder" => "1 dizin", "{count} folders" => "{count} dizin", "1 file" => "1 dosya", -"{count} files" => "{count} dosya" +"{count} files" => "{count} dosya", +"Nothing in here. Your trash bin is empty!" => "Burası boş. Çöp kutun tamamen boş.", +"Restore" => "Geri yükle", +"Delete" => "Sil" ); diff --git a/apps/files_trashbin/l10n/uk.php b/apps/files_trashbin/l10n/uk.php index 14c6931255a..df7dd24864c 100644 --- a/apps/files_trashbin/l10n/uk.php +++ b/apps/files_trashbin/l10n/uk.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Неможливо видалити %s назавжди", +"Couldn't restore %s" => "Неможливо відновити %s", +"perform restore operation" => "виконати операцію відновлення", +"delete file permanently" => "видалити файл назавжди", +"Delete permanently" => "Видалити назавжди", "Name" => "Ім'я", +"Deleted" => "Видалено", "1 folder" => "1 папка", "{count} folders" => "{count} папок", "1 file" => "1 файл", -"{count} files" => "{count} файлів" +"{count} files" => "{count} файлів", +"Nothing in here. Your trash bin is empty!" => "Нічого немає. Ваший кошик для сміття пустий!", +"Restore" => "Відновити", +"Delete" => "Видалити" ); diff --git a/apps/files_trashbin/l10n/vi.php b/apps/files_trashbin/l10n/vi.php index 2c51c69aaf2..165fa9cfd94 100644 --- a/apps/files_trashbin/l10n/vi.php +++ b/apps/files_trashbin/l10n/vi.php @@ -1,7 +1,16 @@ <?php $TRANSLATIONS = array( +"Couldn't delete %s permanently" => "Không thể óa %s vĩnh viễn", +"Couldn't restore %s" => "Không thể khôi phục %s", +"perform restore operation" => "thực hiện phục hồi", +"delete file permanently" => "xóa file vĩnh viễn", +"Delete permanently" => "Xóa vĩnh vễn", "Name" => "Tên", +"Deleted" => "Đã xóa", "1 folder" => "1 thư mục", "{count} folders" => "{count} thư mục", "1 file" => "1 tập tin", -"{count} files" => "{count} tập tin" +"{count} files" => "{count} tập tin", +"Nothing in here. Your trash bin is empty!" => "Không có gì ở đây. Thùng rác của bạn rỗng!", +"Restore" => "Khôi phục", +"Delete" => "Xóa" ); diff --git a/apps/files_trashbin/l10n/zh_CN.GB2312.php b/apps/files_trashbin/l10n/zh_CN.GB2312.php index 2c6a7891e98..606d80d441b 100644 --- a/apps/files_trashbin/l10n/zh_CN.GB2312.php +++ b/apps/files_trashbin/l10n/zh_CN.GB2312.php @@ -3,5 +3,6 @@ "1 folder" => "1 个文件夹", "{count} folders" => "{count} 个文件夹", "1 file" => "1 个文件", -"{count} files" => "{count} 个文件" +"{count} files" => "{count} 个文件", +"Delete" => "删除" ); diff --git a/apps/files_trashbin/l10n/zh_CN.php b/apps/files_trashbin/l10n/zh_CN.php index 0060b1f31d6..327a3e24707 100644 --- a/apps/files_trashbin/l10n/zh_CN.php +++ b/apps/files_trashbin/l10n/zh_CN.php @@ -3,5 +3,6 @@ "1 folder" => "1个文件夹", "{count} folders" => "{count} 个文件夹", "1 file" => "1 个文件", -"{count} files" => "{count} 个文件" +"{count} files" => "{count} 个文件", +"Delete" => "删除" ); diff --git a/apps/files_trashbin/l10n/zh_TW.php b/apps/files_trashbin/l10n/zh_TW.php index be61d9b0b6d..0142e901f58 100644 --- a/apps/files_trashbin/l10n/zh_TW.php +++ b/apps/files_trashbin/l10n/zh_TW.php @@ -1,7 +1,9 @@ <?php $TRANSLATIONS = array( +"Delete permanently" => "永久刪除", "Name" => "名稱", "1 folder" => "1 個資料夾", "{count} folders" => "{count} 個資料夾", "1 file" => "1 個檔案", -"{count} files" => "{count} 個檔案" +"{count} files" => "{count} 個檔案", +"Delete" => "刪除" ); diff --git a/apps/files_trashbin/lib/hooks.php b/apps/files_trashbin/lib/hooks.php index d6a62d447b8..9081706a2c5 100644 --- a/apps/files_trashbin/lib/hooks.php +++ b/apps/files_trashbin/lib/hooks.php @@ -1,23 +1,23 @@ <?php -/**
- * ownCloud - trash bin
- *
- * @author Bjoern Schiessle
- * @copyright 2013 Bjoern Schiessle schiessle@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
+/** + * ownCloud - trash bin + * + * @author Bjoern Schiessle + * @copyright 2013 Bjoern Schiessle schiessle@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * */ /** @@ -36,7 +36,7 @@ class Hooks { * to copy the file to the trash bin */ public static function remove_hook($params) { - + if ( \OCP\App::isEnabled('files_trashbin') ) { $path = $params['path']; Trashbin::move2trash($path); diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index abc7fbb7383..f0cfa496832 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -23,19 +23,25 @@ namespace OCA\Files_Trashbin; class Trashbin { - - const DEFAULT_RETENTION_OBLIGATION=180; // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) + // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) + const DEFAULT_RETENTION_OBLIGATION=180; + + // unit: percentage; 50% of available disk space/quota + const DEFAULTMAXSIZE=50; + /** * move file to the trash bin - * - * @param string $file_path path to the deleted file/directory relative to the files root directory + * + * @param $file_path path to the deleted file/directory relative to the files root directory */ public static function move2trash($file_path) { $user = \OCP\User::getUser(); $view = new \OC\Files\View('/'. $user); if (!$view->is_dir('files_trashbin')) { $view->mkdir('files_trashbin'); - $view->mkdir("versions_trashbin"); + $view->mkdir("files_trashbin/files"); + $view->mkdir("files_trashbin/versions"); + $view->mkdir("files_trashbin/keyfiles"); } $path_parts = pathinfo($file_path); @@ -50,117 +56,202 @@ class Trashbin { } else { $type = 'file'; } - - self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view); - if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) { + $trashbinSize = self::getTrashbinSize($user); + if ( $trashbinSize === false || $trashbinSize < 0 ) { + $trashbinSize = self::calculateSize(new \OC\Files\View('/'. $user.'/files_trashbin')); + } + $trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view); + + if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) { $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)"); $result = $query->execute(array($deleted, $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/'.$deleted.'.d'.$timestamp); + $view->deleteAll('files_trashbin/files/'.$deleted.'.d'.$timestamp); \OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR); return; } - + + // Take care of file versions if ( \OCP\App::isEnabled('files_versions') ) { if ( $view->is_dir('files_versions'.$file_path) ) { - $view->rename('files_versions'.$file_path, 'versions_trashbin/'. $deleted.'.d'.$timestamp); - } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) { + $trashbinSize += self::calculateSize(new \OC\Files\View('/'. $user.'/files_versions/'.$file_path)); + $view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp); + } else if ( $versions = \OCA\Files_Versions\Storage::getVersions($user, $file_path) ) { foreach ($versions as $v) { - $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp); + $trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']); + $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp); } } } + + // Take care of encryption keys + $keyfile = \OC\Files\Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path); + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) { + if ( $view->is_dir('files'.$file_path) ) { + $trashbinSize += self::calculateSize(new \OC\Files\View('/'.$user.'/'.$keyfile)); + $view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp); + } else { + $trashbinSize += $view->filesize($keyfile.'.key'); + $view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp); + } + } + } else { + \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR); + } + + // get available disk space for user + $quota = \OC_Preferences::getValue($user, 'files', 'quota'); + if ( $quota === null ) { + $quota = \OC_Appconfig::getValue('files', 'default_quota'); + } + if ( $quota === null ) { + $quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers()); } else { - \OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin' , \OC_log::ERROR); + $quota = \OCP\Util::computerFileSize($quota); } - self::expire(); + // calculate available space for trash bin + $rootInfo = $view->getFileInfo('/files'); + $free = $quota-$rootInfo['size']; // remaining free space for user + if ( $free > 0 ) { + $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $trashbinSize; // how much space can be used for versions + } else { + $availableSpace = $free-$trashbinSize; + } + $trashbinSize -= self::expire($availableSpace); + + self::setTrashbinSize($user, $trashbinSize); + } - - + + /** * restore files from trash bin - * @param string $file path to the deleted file - * @param string $filename name of the file - * @param int $timestamp time when the file was deleted + * @param $file path to the deleted file + * @param $filename name of the file + * @param $timestamp time when the file was deleted */ public static function restore($file, $filename, $timestamp) { - $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')); + } 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,type 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']) || + if ( $result[0]['location'] != '/' && + (!$view->is_dir('files'.$result[0]['location']) || !$view->isUpdatable('files'.$result[0]['location'])) ) { $location = ''; } } else { - $path_parts = pathinfo($filename); + $path_parts = pathinfo($file); $result[] = array( 'location' => $path_parts['dirname'], - 'type' => $view->is_dir('/files_trashbin/'.$file) ? 'dir' : 'files', + 'type' => $view->is_dir('/files_trashbin/files/'.$file) ? 'dir' : 'files', ); $location = ''; } - $source = \OC\Files\Filesystem::normalizePath('files_trashbin/'.$file); + $source = \OC\Files\Filesystem::normalizePath('files_trashbin/files/'.$file); $target = \OC\Files\Filesystem::normalizePath('files/'.$location.'/'.$filename); - + // we need a extension in case a file/dir with the same name already exists $ext = self::getUniqueExtension($location, $filename, $view); $mtime = $view->filemtime($source); if( $view->rename($source, $target.$ext) ) { $view->touch($target.$ext, $mtime); + if ($view->is_dir($target.$ext)) { + $trashbinSize -= self::calculateSize(new \OC\Files\View('/'.$user.'/'.$target.$ext)); + } else { + $trashbinSize -= $view->filesize($target.$ext); + } // if versioning app is enabled, copy versions from the trash bin back to the original location if ( \OCP\App::isEnabled('files_versions') ) { - if ( $result[0]['type'] == 'dir' ) { - $view->rename(\OC\Files\Filesystem::normalizePath('versions_trashbin/'. $file), \OC\Files\Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); - } else if ( $versions = self::getVersionsFromTrash($file, $timestamp) ) { + if ($timestamp ) { + $versionedFile = $filename; + } else { + $versionedFile = $file; + } + if ( $result[0]['type'] === 'dir' ) { + $trashbinSize -= self::calculateSize(new \OC\Files\View('/'.$user.'/'.'files_trashbin/versions/'. $file)); + $view->rename(\OC\Files\Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC\Files\Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext)); + } else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { - $view->rename('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp); + $view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } else { - $view->rename('versions_trashbin/'.$file.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); + $trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v); + $view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v); } } } } - + + // Take care of encryption keys TODO! Get '.key' in file between file name and delete date (also for permanent delete!) + $parts = pathinfo($file); + if ( $result[0]['type'] === 'dir' ) { + $keyfile = \OC\Files\Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename); + } else { + $keyfile = \OC\Files\Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename.'.key'); + } + if ($timestamp) { + $keyfile .= '.d'.$timestamp; + } + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + if ( $result[0]['type'] === 'dir' ) { + $trashbinSize -= self::calculateSize(new \OC\Files\View('/'.$user.'/'.$keyfile)); + $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename); + } else { + $trashbinSize -= $view->filesize($keyfile); + $view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key'); + } + } + 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); + return true; } else { - \OC_Log::write('files_trashbin', 'Couldn\'t restore file from trash bin, '.$filename , \OC_log::ERROR); + \OC_Log::write('files_trashbin', 'Couldn\'t restore file from trash bin, '.$filename, \OC_log::ERROR); } return false; } - + /** * delete file from trash bin permanently * @param $filename path to the file * @param $timestamp of deletion time - * @return true/false + * @return size of deleted files */ public static function delete($filename, $timestamp=null) { - $user = \OCP\User::getUser(); - $view = new \OC_FilesystemView('/'.$user); + $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)); @@ -168,105 +259,168 @@ class Trashbin { } else { $file = $filename; } - + if ( \OCP\App::isEnabled('files_versions') ) { - if ($view->is_dir('versions_trashbin/'.$file)) { - $view->unlink('versions_trashbin/'.$file); - } else if ( $versions = self::getVersionsFromTrash($file, $timestamp) ) { + if ($view->is_dir('files_trashbin/versions/'.$file)) { + $size += self::calculateSize(new \OC\Files\view('/'.$user.'/files_trashbin/versions/'.$file)); + $view->unlink('files_trashbin/versions/'.$file); + } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { foreach ($versions as $v) { if ($timestamp ) { - $view->unlink('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); } else { - $view->unlink('versions_trashbin/'.$file.'.v'.$v); + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); } } } } + + // Take care of encryption keys + $parts = pathinfo($file); + if ( $view->is_dir('/files_trashbin/files/'.$file) ) { + $keyfile = \OC\Files\Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename); + } else { + $keyfile = \OC\Files\Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename.'.key'); + } + if ($timestamp) { + $keyfile .= '.d'.$timestamp; + } + if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) { + if ( $view->is_dir($keyfile) ) { + $size += self::calculateSize(new \OC\Files\View('/'.$user.'/'.$keyfile)); + } else { + $size += $view->filesize($keyfile); + } + $view->unlink($keyfile); + } - $view->unlink('/files_trashbin/'.$file); + if ($view->is_dir('/files_trashbin/files/'.$file)) { + $size += self::calculateSize(new \OC\Files\View('/'.$user.'/files_trashbin/files/'.$file)); + } else { + $size += $view->filesize('/files_trashbin/files/'.$file); + } + $view->unlink('/files_trashbin/files/'.$file); + $trashbinSize -= $size; + self::setTrashbinSize($user, $trashbinSize); - return true; + return $size; } - - + + /** + * check to see whether a file exists in trashbin + * @param $filename path to the file + * @param $timestamp of deletion time + * @return true if file exists, otherwise false + */ + public static function file_exists($filename, $timestamp=null) { + $user = \OCP\User::getUser(); + $view = new \OC\Files\View('/'.$user); + + if ($timestamp) { + $filename = $filename.'.d'.$timestamp; + } else { + $filename = $filename; + } + + $target = \OC\Files\Filesystem::normalizePath('files_trashbin/files/'.$filename); + return $view->file_exists($target); + } + /** * clean up the trash bin + * @param max. available disk space for trashbin */ - private static function expire() { - - $view = new \OC\Files\View('/'.\OCP\User::getUser()); + private static function expire($availableSpace) { + $user = \OCP\User::getUser(); - + $view = new \OC\Files\View('/'.$user); + $size = 0; + $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=?'); $result = $query->execute(array($user))->fetchAll(); - - $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', self::DEFAULT_RETENTION_OBLIGATION); - + + $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', + self::DEFAULT_RETENTION_OBLIGATION); + $limit = time() - ($retention_obligation * 86400); foreach ( $result as $r ) { $timestamp = $r['timestamp']; $filename = $r['id']; if ( $r['timestamp'] < $limit ) { - $view->unlink('files_trashbin/'.$filename.'.d'.$timestamp); - if ($r['type'] == 'dir') { - $view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp); - } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { - foreach ($versions as $v) { - $view->unlink('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp); - } - } + $size += self::delete($filename, $timestamp); } } - - $query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND timestamp<?'); - $query->execute(array($user,$limit)); + $availableSpace = $availableSpace + $size; + // if size limit for trash bin reached, delete oldest files in trash bin + if ($availableSpace < 0) { + $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash' + .' WHERE user=? ORDER BY timestamp ASC'); + $result = $query->execute(array($user))->fetchAll(); + $length = count($result); + $i = 0; + while ( $i < $length && $availableSpace < 0 ) { + $tmp = self::delete($result[$i]['id'], $result[$i]['timestamp']); + $availableSpace += $tmp; + $size += $tmp; + $i++; + } + + + } + + return $size; } - + /** * recursive copy to copy a whole 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 + * + * @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 */ private static function copy_recursive( $source, $destination, $view ) { + $size = 0; if ( $view->is_dir( 'files'.$source ) ) { $view->mkdir( $destination ); $view->touch($destination, $view->filemtime('files'.$source)); foreach ( \OC_Files::getDirectoryContent($source) as $i ) { $pathDir = $source.'/'.$i['name']; if ( $view->is_dir('files'.$pathDir) ) { - self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); } else { + $size += $view->filesize('files'.$pathDir); $view->copy( 'files'.$pathDir, $destination . '/' . $i['name'] ); $view->touch($destination . '/' . $i['name'], $view->filemtime('files'.$pathDir)); } } } else { + $size += $view->filesize('files'.$source); $view->copy( 'files'.$source, $destination ); $view->touch($destination, $view->filemtime('files'.$source)); } + return $size; } - + /** * find all versions which belong to the file we want to restore - * @param string $filename name of the file which should be restored - * @param int $timestamp timestamp when the file was deleted + * @param $filename name of the file which should be restored + * @param $timestamp timestamp when the file was deleted */ private static function getVersionsFromTrash($filename, $timestamp) { - $view = new \OC\Files\View('/'.\OCP\User::getUser().'/versions_trashbin'); + $view = new \OC\Files\View('/'.\OCP\User::getUser().'/files_trashbin/versions'); $versionsName = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($filename); $versions = array(); - if ($timestamp ) { - // fetch for old versions + // fetch for old versions $matches = glob( $versionsName.'.v*.d'.$timestamp ); $offset = -strlen($timestamp)-2; } else { $matches = glob( $versionsName.'.v*' ); } - + foreach( $matches as $ma ) { if ( $timestamp ) { $parts = explode( '.v', substr($ma, 0, $offset) ); @@ -278,12 +432,12 @@ class Trashbin { } return $versions; } - + /** * find unique extension for restored file if a file with the same name already exists - * @param string $location where the file should be restored - * @param string $filename name of the file - * @param \OC\Files\View $view filesystem view relative to users root directory + * @param $location where the file should be restored + * @param $filename name of the file + * @param $view filesystem view relative to users root directory * @return string with unique extension */ private static function getUniqueExtension($location, $filename, $view) { @@ -300,4 +454,58 @@ class Trashbin { return $ext; } + /** + * @brief get the size from a given root folder + * @param $view file view on the root folder + * @return size of the folder + */ + private static function calculateSize($view) { + $root = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath(''); + if (!file_exists($root)) { + return 0; + } + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), + \RecursiveIteratorIterator::CHILD_FIRST); + $size = 0; + + foreach ($iterator as $path) { + $relpath = substr($path, strlen($root)-1); + if ( !$view->is_dir($relpath) ) { + $size += $view->filesize($relpath); + } + } + return $size; + } + + /** + * get current size of trash bin from a given user + * + * @param $user user who owns the trash bin + * @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 $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)); + } + } diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index 24e4a0e6c69..aaeeb5c6f6e 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -5,11 +5,11 @@ </div> <div id='notification'></div> -<?php if (isset($_['files']) && count($_['files'])==0):?> +<?php if (isset($_['files']) && count($_['files'])==0 && $_['dirlisting'] == false):?> <div id="emptyfolder"><?php echo $l->t('Nothing in here. Your trash bin is empty!')?></div> <?php endif; ?> -<table class="hascontrols"> +<table> <thead> <tr> <th id='headerName'> @@ -25,6 +25,13 @@ </th> <th id="headerDate"> <span id="modified"><?php echo $l->t( 'Deleted' ); ?></span> + <span class="selectedActions"> + <a href="" class="delete"> + <?php echo $l->t('Delete')?> + <img class="svg" alt="<?php echo $l->t('Delete')?>" + src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /> + </a> + </span> </th> </tr> </thead> diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index fe8a71f44e6..dea0a43cd4c 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -1,12 +1,8 @@ <input type="hidden" id="disableSharing" data-status="<?php echo $_['disableSharing']; ?>"> <?php foreach($_['files'] as $file): - $simple_file_size = OCP\simple_file_size($file['size']); - // the bigger the file, the darker the shade of grey; megabytes*2 - $simple_size_color = intval(200-$file['size']/(1024*1024)*2); - if($simple_size_color<0) $simple_size_color = 0; $relative_deleted_date = OCP\relative_modified_date($file['timestamp']); // the older the file, the brighter the shade of grey; days*14 - $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); + $relative_date_color = round((time()-$file['date'])/60/60/24*14); if($relative_date_color>200) $relative_date_color = 200; $name = str_replace('+', '%20', urlencode($file['name'])); $name = str_replace('%2F', '/', $name); @@ -73,4 +69,3 @@ </td> </tr> <?php endforeach; -
\ No newline at end of file |