Merge branch 'master' into external_storage_ui_feedback
This commit is contained in:
commit
4a05e8820f
536 changed files with 9506 additions and 4862 deletions
|
@ -26,8 +26,7 @@ foreach ($_FILES['files']['error'] as $error) {
|
|||
UPLOAD_ERR_OK => $l->t('There is no error, the file uploaded with success'),
|
||||
UPLOAD_ERR_INI_SIZE => $l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ')
|
||||
. ini_get('upload_max_filesize'),
|
||||
UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified'
|
||||
. ' in the HTML form'),
|
||||
UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
|
||||
UPLOAD_ERR_PARTIAL => $l->t('The uploaded file was only partially uploaded'),
|
||||
UPLOAD_ERR_NO_FILE => $l->t('No file was uploaded'),
|
||||
UPLOAD_ERR_NO_TMP_DIR => $l->t('Missing a temporary folder'),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<description>File Management</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Robin Appelman</author>
|
||||
<require>4.91</require>
|
||||
<require>4.93</require>
|
||||
<shipped>true</shipped>
|
||||
<standalone/>
|
||||
<default_enable/>
|
||||
|
|
|
@ -123,6 +123,24 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
|
|||
.selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; }
|
||||
.selectedActions a img { position:relative; top:.3em; }
|
||||
|
||||
#fileList a.action {
|
||||
display:none;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
}
|
||||
#fileList tr:hover a.action {
|
||||
display:inline;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=.5)";
|
||||
filter: alpha(opacity=.5);
|
||||
opacity: .5;
|
||||
}
|
||||
#fileList tr:hover a.action:hover {
|
||||
display:inline;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=1)";
|
||||
filter: alpha(opacity=1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#scanning-message{ top:40%; left:40%; position:absolute; display:none; }
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ var FileList={
|
|||
if(extension){
|
||||
name_span.append($('<span></span>').addClass('extension').text(extension));
|
||||
}
|
||||
//dirs can show the number of uploaded files
|
||||
//dirs can show the number of uploaded files
|
||||
if (type == 'dir') {
|
||||
link_elem.append($('<span></span>').attr({
|
||||
'class': 'uploadtext',
|
||||
|
@ -44,7 +44,7 @@ var FileList={
|
|||
}
|
||||
td.append(link_elem);
|
||||
tr.append(td);
|
||||
|
||||
|
||||
//size column
|
||||
if(size!=t('files', 'Pending')){
|
||||
simpleSize=simpleFileSize(size);
|
||||
|
@ -59,7 +59,7 @@ var FileList={
|
|||
"style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'
|
||||
}).text(simpleSize);
|
||||
tr.append(td);
|
||||
|
||||
|
||||
// date column
|
||||
var modifiedColor = Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5);
|
||||
td = $('<td></td>').attr({ "class": "date" });
|
||||
|
@ -87,7 +87,7 @@ var FileList={
|
|||
lastModified,
|
||||
$('#permissions').val()
|
||||
);
|
||||
|
||||
|
||||
FileList.insertElement(name, 'file', tr.attr('data-file',name));
|
||||
var row = $('tr').filterAttr('data-file',name);
|
||||
if(loading){
|
||||
|
@ -101,7 +101,7 @@ var FileList={
|
|||
FileActions.display(row.find('td.filename'));
|
||||
},
|
||||
addDir:function(name,size,lastModified,hidden){
|
||||
|
||||
|
||||
var tr = this.createRow(
|
||||
'dir',
|
||||
name,
|
||||
|
@ -111,7 +111,7 @@ var FileList={
|
|||
lastModified,
|
||||
$('#permissions').val()
|
||||
);
|
||||
|
||||
|
||||
FileList.insertElement(name,'dir',tr);
|
||||
var row = $('tr').filterAttr('data-file',name);
|
||||
row.find('td.filename').draggable(dragOptions);
|
||||
|
@ -315,8 +315,8 @@ var FileList={
|
|||
do_delete:function(files){
|
||||
if(files.substr){
|
||||
files=[files];
|
||||
}
|
||||
for (var i in files) {
|
||||
}
|
||||
for (var i=0; i<files.length; i++) {
|
||||
var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete");
|
||||
var oldHTML = deleteAction[0].outerHTML;
|
||||
var newHTML = '<img class="move2trash" data-action="Delete" title="'+t('files', 'perform delete operation')+'" src="'+ OC.imagePath('core', 'loading.gif') +'"></a>';
|
||||
|
@ -334,7 +334,7 @@ var FileList={
|
|||
if (result.status == 'success') {
|
||||
$.each(files,function(index,file){
|
||||
var files = $('tr').filterAttr('data-file',file);
|
||||
files.hide();
|
||||
files.remove();
|
||||
files.find('input[type="checkbox"]').removeAttr('checked');
|
||||
files.removeClass('selected');
|
||||
});
|
||||
|
@ -344,7 +344,7 @@ var FileList={
|
|||
var deleteAction = $('tr').filterAttr('data-file',file).children("td.date").children(".move2trash");
|
||||
deleteAction[0].outerHTML = oldHTML;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -114,7 +114,7 @@ $(document).ready(function() {
|
|||
$(this).parent().children('#file_upload_start').trigger('click');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
// Show trash bin
|
||||
$('#trash a').live('click', function() {
|
||||
window.location=OC.filePath('files_trashbin', '', 'index.php');
|
||||
|
@ -162,9 +162,10 @@ $(document).ready(function() {
|
|||
var tr=$('tr').filterAttr('data-file',filename);
|
||||
var renaming=tr.data('renaming');
|
||||
if(!renaming && !FileList.isLoading(filename)){
|
||||
var mime=$(this).parent().parent().data('mime');
|
||||
var type=$(this).parent().parent().data('type');
|
||||
var permissions = $(this).parent().parent().data('permissions');
|
||||
FileActions.currentFile = $(this).parent();
|
||||
var mime=FileActions.getCurrentMimeType();
|
||||
var type=FileActions.getCurrentType();
|
||||
var permissions = FileActions.getCurrentPermissions();
|
||||
var action=FileActions.getDefault(mime,type, permissions);
|
||||
if(action){
|
||||
event.preventDefault();
|
||||
|
@ -523,7 +524,7 @@ $(document).ready(function() {
|
|||
crumb.text(text);
|
||||
}
|
||||
|
||||
$(window).click(function(){
|
||||
$(document).click(function(){
|
||||
$('#new>ul').hide();
|
||||
$('#new').removeClass('active');
|
||||
$('#new li').each(function(i,element){
|
||||
|
@ -594,7 +595,7 @@ $(document).ready(function() {
|
|||
var date=new Date();
|
||||
FileList.addFile(name,0,date,false,hidden);
|
||||
var tr=$('tr').filterAttr('data-file',name);
|
||||
tr.data('mime','text/plain').data('id',result.data.id);
|
||||
tr.attr('data-mime','text/plain');
|
||||
tr.attr('data-id', result.data.id);
|
||||
getMimeIcon('text/plain',function(path){
|
||||
tr.find('td.filename').attr('style','background-image:url('+path+')');
|
||||
|
@ -816,26 +817,26 @@ var createDragShadow = function(event){
|
|||
//select dragged file
|
||||
$(event.target).parents('tr').find('td input:first').prop('checked',true);
|
||||
}
|
||||
|
||||
|
||||
var selectedFiles = getSelectedFiles();
|
||||
|
||||
|
||||
if (!isDragSelected && selectedFiles.length == 1) {
|
||||
//revert the selection
|
||||
$(event.target).parents('tr').find('td input:first').prop('checked',false);
|
||||
}
|
||||
|
||||
|
||||
//also update class when we dragged more than one file
|
||||
if (selectedFiles.length > 1) {
|
||||
$(event.target).parents('tr').addClass('selected');
|
||||
}
|
||||
|
||||
|
||||
// build dragshadow
|
||||
var dragshadow = $('<table class="dragshadow"></table>');
|
||||
var tbody = $('<tbody></tbody>');
|
||||
dragshadow.append(tbody);
|
||||
|
||||
|
||||
var dir=$('#dir').val();
|
||||
|
||||
|
||||
$(selectedFiles).each(function(i,elem){
|
||||
var newtr = $('<tr data-dir="'+dir+'" data-filename="'+elem.name+'">'
|
||||
+'<td class="filename">'+elem.name+'</td><td class="size">'+humanFileSize(elem.size)+'</td>'
|
||||
|
@ -849,7 +850,7 @@ var createDragShadow = function(event){
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return dragshadow;
|
||||
}
|
||||
|
||||
|
@ -862,6 +863,10 @@ var dragOptions={
|
|||
$('#fileList tr td.filename').addClass('ui-draggable');
|
||||
}
|
||||
}
|
||||
// sane browsers support using the distance option
|
||||
if ( ! $.browser.msie) {
|
||||
dragOptions['distance'] = 20;
|
||||
}
|
||||
|
||||
var folderDropOptions={
|
||||
drop: function( event, ui ) {
|
||||
|
@ -869,9 +874,9 @@ var folderDropOptions={
|
|||
if ($(event.target).parents('tr').find('td input:first').prop('checked') === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var target=$.trim($(this).find('.nametext').text());
|
||||
|
||||
|
||||
var files = ui.helper.find('tr');
|
||||
$(files).each(function(i,row){
|
||||
var dir = $(row).data('dir');
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"replaced {new_name}" => "{new_name} wurde ersetzt",
|
||||
"undo" => "rückgängig machen",
|
||||
"replaced {new_name} with {old_name}" => "{old_name} wurde ersetzt durch {new_name}",
|
||||
"perform delete operation" => "Führe das Löschen aus",
|
||||
"perform delete operation" => "führe das Löschen aus",
|
||||
"'.' is an invalid file name." => "'.' ist kein gültiger Dateiname.",
|
||||
"File name cannot be empty." => "Der Dateiname darf nicht leer sein.",
|
||||
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Ungültiger Name, '\\', '/', '<', '>', ':', '\"', '|', '?' und '*' sind nicht zulässig.",
|
||||
|
@ -69,5 +69,5 @@
|
|||
"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Die Datei überschreitet die Maximalgröße für Uploads auf diesem Server.",
|
||||
"Files are being scanned, please wait." => "Dateien werden gescannt, bitte warten.",
|
||||
"Current scanning" => "Scanne",
|
||||
"Upgrading filesystem cache..." => "Aktualisiere den Dateisystem-Cache"
|
||||
"Upgrading filesystem cache..." => "Aktualisiere den Dateisystem-Cache..."
|
||||
);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"Missing a temporary folder" => "תיקייה זמנית חסרה",
|
||||
"Failed to write to disk" => "הכתיבה לכונן נכשלה",
|
||||
"Files" => "קבצים",
|
||||
"Delete permanently" => "מחק לצמיתות",
|
||||
"Delete" => "מחיקה",
|
||||
"Rename" => "שינוי שם",
|
||||
"Pending" => "ממתין",
|
||||
|
|
6
apps/files/l10n/hy.php
Normal file
6
apps/files/l10n/hy.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Delete" => "Ջնջել",
|
||||
"Close" => "Փակել",
|
||||
"Save" => "Պահպանել",
|
||||
"Download" => "Բեռնել"
|
||||
);
|
|
@ -19,6 +19,10 @@
|
|||
"Name" => "Nama",
|
||||
"Size" => "Ukuran",
|
||||
"Modified" => "Dimodifikasi",
|
||||
"1 folder" => "1 map",
|
||||
"{count} folders" => "{count} map",
|
||||
"1 file" => "1 berkas",
|
||||
"{count} files" => "{count} berkas",
|
||||
"Upload" => "Unggah",
|
||||
"File handling" => "Penanganan berkas",
|
||||
"Maximum upload size" => "Ukuran unggah maksimum",
|
||||
|
|
3
apps/files/l10n/my_MM.php
Normal file
3
apps/files/l10n/my_MM.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Files" => "ဖိုင်များ"
|
||||
);
|
|
@ -60,6 +60,7 @@
|
|||
"Text file" => "Arquivo texto",
|
||||
"Folder" => "Pasta",
|
||||
"From link" => "Do link",
|
||||
"Deleted files" => "Arquivos apagados",
|
||||
"Cancel upload" => "Cancelar upload",
|
||||
"Nothing in here. Upload something!" => "Nada aqui.Carrege alguma coisa!",
|
||||
"Download" => "Baixar",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Encryption" => "enkripsi",
|
||||
"None" => "tidak ada"
|
||||
"Encryption" => "Enkripsi",
|
||||
"File encryption is enabled." => "Enkripsi berkas aktif.",
|
||||
"The following file types will not be encrypted:" => "Tipe berkas berikut tidak akan dienkripsi:",
|
||||
"Exclude the following file types from encryption:" => "Kecualikan tipe berkas berikut dari enkripsi:",
|
||||
"None" => "Tidak ada"
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<description>Mount external storage sources</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Robin Appelman, Michael Gapczynski</author>
|
||||
<require>4.91</require>
|
||||
<require>4.93</require>
|
||||
<shipped>true</shipped>
|
||||
<types>
|
||||
<filesystem/>
|
||||
|
|
3
apps/files_external/l10n/hy.php
Normal file
3
apps/files_external/l10n/hy.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Delete" => "Ջնջել"
|
||||
);
|
|
@ -1,14 +1,26 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Access granted" => "akses diberikan",
|
||||
"Grant access" => "berikan hak akses",
|
||||
"Fill out all required fields" => "isi semua field yang dibutuhkan",
|
||||
"External Storage" => "penyimpanan eksternal",
|
||||
"Configuration" => "konfigurasi",
|
||||
"Options" => "pilihan",
|
||||
"Applicable" => "berlaku",
|
||||
"None set" => "tidak satupun di set",
|
||||
"All Users" => "semua pengguna",
|
||||
"Groups" => "grup",
|
||||
"Users" => "pengguna",
|
||||
"Delete" => "hapus"
|
||||
"Access granted" => "Akses diberikan",
|
||||
"Error configuring Dropbox storage" => "Kesalahan dalam mengkonfigurasi penyimpanan Dropbox",
|
||||
"Grant access" => "Berikan hak akses",
|
||||
"Fill out all required fields" => "Isi semua field yang dibutuhkan",
|
||||
"Please provide a valid Dropbox app key and secret." => "Masukkan kunci dan sandi aplikasi Dropbox yang benar.",
|
||||
"Error configuring Google Drive storage" => "Kesalahan dalam mengkonfigurasi penyimpanan Google Drive",
|
||||
"<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Peringatan:</b> \"smbclient\" tidak terpasang. Mount direktori CIFS/SMB tidak dapat dilakukan. Silakan minta administrator sistem untuk memasangnya.",
|
||||
"<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Peringatan:</b> Dukungan FTP di PHP tidak aktif atau tidak terpasang. Mount direktori FTP tidak dapat dilakukan. Silakan minta administrator sistem untuk memasangnya.",
|
||||
"External Storage" => "Penyimpanan Eksternal",
|
||||
"Mount point" => "Lokasi mount",
|
||||
"Backend" => "Backend",
|
||||
"Configuration" => "Konfigurasi",
|
||||
"Options" => "Pilihan",
|
||||
"Applicable" => "Berlaku",
|
||||
"Add mount point" => "Tambah lokasi mount",
|
||||
"None set" => "Tidak satupun di set",
|
||||
"All Users" => "Semua Pengguna",
|
||||
"Groups" => "Grup",
|
||||
"Users" => "Pengguna",
|
||||
"Delete" => "Hapus",
|
||||
"Enable User External Storage" => "Aktifkan Penyimpanan Eksternal Pengguna",
|
||||
"Allow users to mount their own external storage" => "Ijinkan pengguna untuk me-mount penyimpanan eksternal mereka",
|
||||
"SSL root certificates" => "Sertifikat root SSL",
|
||||
"Import Root Certificate" => "Impor Sertifikat Root"
|
||||
);
|
||||
|
|
3
apps/files_external/l10n/my_MM.php
Normal file
3
apps/files_external/l10n/my_MM.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Users" => "သုံးစွဲသူ"
|
||||
);
|
|
@ -38,7 +38,7 @@ class OC_Mount_Config {
|
|||
* @return array
|
||||
*/
|
||||
public static function getBackends() {
|
||||
|
||||
|
||||
$backends['\OC\Files\Storage\Local']=array(
|
||||
'backend' => 'Local',
|
||||
'configuration' => array(
|
||||
|
@ -77,7 +77,7 @@ class OC_Mount_Config {
|
|||
'token' => '#token',
|
||||
'token_secret' => '#token secret'),
|
||||
'custom' => 'google');
|
||||
|
||||
|
||||
$backends['\OC\Files\Storage\SWIFT']=array(
|
||||
'backend' => 'OpenStack Swift',
|
||||
'configuration' => array(
|
||||
|
@ -86,7 +86,7 @@ class OC_Mount_Config {
|
|||
'token' => '*Token',
|
||||
'root' => '&Root',
|
||||
'secure' => '!Secure ftps://'));
|
||||
|
||||
|
||||
if(OC_Mount_Config::checksmbclient()) $backends['\OC\Files\Storage\SMB']=array(
|
||||
'backend' => 'SMB / CIFS',
|
||||
'configuration' => array(
|
||||
|
@ -95,7 +95,7 @@ class OC_Mount_Config {
|
|||
'password' => '*Password',
|
||||
'share' => 'Share',
|
||||
'root' => '&Root'));
|
||||
|
||||
|
||||
$backends['\OC\Files\Storage\DAV']=array(
|
||||
'backend' => 'ownCloud / WebDAV',
|
||||
'configuration' => array(
|
||||
|
@ -104,13 +104,13 @@ class OC_Mount_Config {
|
|||
'password' => '*Password',
|
||||
'root' => '&Root',
|
||||
'secure' => '!Secure https://'));
|
||||
|
||||
|
||||
$backends['\OC\Files\Storage\SFTP']=array(
|
||||
'backend' => 'SFTP',
|
||||
'configuration' => array(
|
||||
'host' => 'URL',
|
||||
'user' => 'Username',
|
||||
'password' => '*Password',
|
||||
'user' => 'Username',
|
||||
'password' => '*Password',
|
||||
'root' => '&Root'));
|
||||
|
||||
return($backends);
|
||||
|
@ -401,7 +401,7 @@ class OC_Mount_Config {
|
|||
}
|
||||
|
||||
/**
|
||||
* check if php-ftp is installed
|
||||
* check if php-ftp is installed
|
||||
*/
|
||||
public static function checkphpftp() {
|
||||
if(function_exists('ftp_login')) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
$this->root = isset($params['root']) ? $this->cleanPath($params['root']) : '/';
|
||||
if ($this->root[0] != '/') $this->root = '/' . $this->root;
|
||||
if (substr($this->root, -1, 1) != '/') $this->root .= '/';
|
||||
|
||||
|
||||
$host_keys = $this->read_host_keys();
|
||||
|
||||
$this->client = new \Net_SFTP($this->host);
|
||||
|
@ -50,18 +50,18 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
$host_keys[$this->host] = $current_host_key;
|
||||
$this->write_host_keys($host_keys);
|
||||
}
|
||||
|
||||
|
||||
if(!$this->file_exists('')){
|
||||
$this->mkdir('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function test() {
|
||||
if (!isset($params['host']) || !isset($params['user']) || !isset($params['password'])) {
|
||||
throw new \Exception("Required parameters not set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getId(){
|
||||
return 'sftp::' . $this->user . '@' . $this->host . '/' . $this->root;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
$host_key_arr = explode("::", $line, 2);
|
||||
if (count($host_key_arr) == 2) {
|
||||
$hosts[] = $host_key_arr[0];
|
||||
$keys[] = $host_key_arr[1];
|
||||
$keys[] = $host_key_arr[1];
|
||||
}
|
||||
}
|
||||
return array_combine($hosts, $keys);
|
||||
|
@ -203,7 +203,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
$tmp = \OC_Helper::tmpFile($ext);
|
||||
$this->getFile($abs_path, $tmp);
|
||||
return fopen($tmp, $mode);
|
||||
|
||||
|
||||
case 'w':
|
||||
case 'wb':
|
||||
case 'a':
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<description>File sharing between users</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Michael Gapczynski</author>
|
||||
<require>4.91</require>
|
||||
<require>4.93</require>
|
||||
<shipped>true</shipped>
|
||||
<default_enable/>
|
||||
<types>
|
||||
|
|
|
@ -52,7 +52,10 @@ if (version_compare($installedVersion, '0.3', '<')) {
|
|||
}
|
||||
catch (Exception $e) {
|
||||
$update_error = true;
|
||||
OCP\Util::writeLog('files_sharing', 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")', OCP\Util::WARN);
|
||||
OCP\Util::writeLog('files_sharing',
|
||||
'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith
|
||||
.'" (error is "'.$e->getMessage().'")',
|
||||
OCP\Util::WARN);
|
||||
}
|
||||
OC_Util::tearDownFS();
|
||||
}
|
||||
|
|
4
apps/files_sharing/l10n/my_MM.php
Normal file
4
apps/files_sharing/l10n/my_MM.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Password" => "စကားဝှက်",
|
||||
"web services under your control" => "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services"
|
||||
);
|
|
@ -71,8 +71,9 @@ class Shared_Cache extends Cache {
|
|||
}
|
||||
} else {
|
||||
$query = \OC_DB::prepare(
|
||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
||||
FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
|
||||
.' `size`, `mtime`, `encrypted`'
|
||||
.' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
||||
$result = $query->execute(array($file));
|
||||
$data = $result->fetchRow();
|
||||
$data['fileid'] = (int)$data['fileid'];
|
||||
|
|
|
@ -33,7 +33,8 @@ class Shared_Permissions extends Permissions {
|
|||
if ($fileId == -1) {
|
||||
return \OCP\PERMISSION_READ;
|
||||
}
|
||||
$source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE, null, true);
|
||||
$source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE,
|
||||
null, true);
|
||||
if ($source) {
|
||||
return $source['permissions'];
|
||||
} else {
|
||||
|
|
|
@ -72,7 +72,11 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
|||
public function formatItems($items, $format, $parameters = null) {
|
||||
if ($format == self::FORMAT_SHARED_STORAGE) {
|
||||
// Only 1 item should come through for this format call
|
||||
return array('path' => $items[key($items)]['path'], 'permissions' => $items[key($items)]['permissions'], 'uid_owner' => $items[key($items)]['uid_owner']);
|
||||
return array(
|
||||
'path' => $items[key($items)]['path'],
|
||||
'permissions' => $items[key($items)]['permissions'],
|
||||
'uid_owner' => $items[key($items)]['uid_owner']
|
||||
);
|
||||
} else if ($format == self::FORMAT_GET_FOLDER_CONTENTS) {
|
||||
$files = array();
|
||||
foreach ($items as $item) {
|
||||
|
@ -99,7 +103,13 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
|||
}
|
||||
$size += (int)$item['size'];
|
||||
}
|
||||
return array('fileid' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size);
|
||||
return array(
|
||||
'fileid' => -1,
|
||||
'name' => 'Shared',
|
||||
'mtime' => $mtime,
|
||||
'mimetype' => 'httpd/unix-directory',
|
||||
'size' => $size
|
||||
);
|
||||
} else if ($format == self::FORMAT_OPENDIR) {
|
||||
$files = array();
|
||||
foreach ($items as $item) {
|
||||
|
|
|
@ -33,7 +33,8 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
|
|||
}
|
||||
while (!empty($parents)) {
|
||||
$parents = "'".implode("','", $parents)."'";
|
||||
$query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache` WHERE `parent` IN ('.$parents.')');
|
||||
$query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache`'
|
||||
.' WHERE `parent` IN ('.$parents.')');
|
||||
$result = $query->execute();
|
||||
$parents = array();
|
||||
while ($file = $result->fetchRow()) {
|
||||
|
@ -47,4 +48,4 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
|
|||
return $children;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,7 +240,8 @@ class Shared extends \OC\Files\Storage\Common {
|
|||
public function file_put_contents($path, $data) {
|
||||
if ($source = $this->getSourcePath($path)) {
|
||||
// Check if permission is granted
|
||||
if (($this->file_exists($path) && !$this->isUpdatable($path)) || ($this->is_dir($path) && !$this->isCreatable($path))) {
|
||||
if (($this->file_exists($path) && !$this->isUpdatable($path))
|
||||
|| ($this->is_dir($path) && !$this->isCreatable($path))) {
|
||||
return false;
|
||||
}
|
||||
$info = array(
|
||||
|
@ -314,7 +315,8 @@ class Shared extends \OC\Files\Storage\Common {
|
|||
if ($this->isCreatable(dirname($path2))) {
|
||||
$source = $this->fopen($path1, 'r');
|
||||
$target = $this->fopen($path2, 'w');
|
||||
return \OC_Helper::streamCopy($source, $target);
|
||||
list ($count, $result) = \OC_Helper::streamCopy($source, $target);
|
||||
return $result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -390,9 +392,12 @@ class Shared extends \OC\Files\Storage\Common {
|
|||
}
|
||||
|
||||
public static function setup($options) {
|
||||
if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || \OCP\Share::getItemsSharedWith('file')) {
|
||||
if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user']
|
||||
|| \OCP\Share::getItemsSharedWith('file')) {
|
||||
$user_dir = $options['user_dir'];
|
||||
\OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
|
||||
\OC\Files\Filesystem::mount('\OC\Files\Storage\Shared',
|
||||
array('sharedFolder' => '/Shared'),
|
||||
$user_dir.'/Shared/');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ if (isset($_GET['t'])) {
|
|||
$path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($path)) {
|
||||
if (!isset($linkItem['item_type'])) {
|
||||
OCP\Util::writeLog('share', 'No item type set for share id: ' . $linkItem['id'], \OCP\Util::ERROR);
|
||||
|
@ -171,7 +171,9 @@ if (isset($path)) {
|
|||
$list->assign('files', $files, false);
|
||||
$list->assign('disableSharing', true);
|
||||
$list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
|
||||
$list->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=', false);
|
||||
$list->assign('downloadURL',
|
||||
OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=',
|
||||
false);
|
||||
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
|
||||
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
|
||||
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
|
||||
|
@ -188,7 +190,8 @@ if (isset($path)) {
|
|||
$folder->assign('usedSpacePercent', 0);
|
||||
$tmpl->assign('folder', $folder->fetchPage(), false);
|
||||
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
|
||||
$tmpl->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
|
||||
$tmpl->assign('downloadURL',
|
||||
OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
|
||||
} else {
|
||||
$tmpl->assign('dir', $dir);
|
||||
|
||||
|
@ -209,4 +212,3 @@ if (isset($path)) {
|
|||
header('HTTP/1.0 404 Not Found');
|
||||
$tmpl = new OCP\Template('', '404', 'guest');
|
||||
$tmpl->printPage();
|
||||
|
||||
|
|
|
@ -3,15 +3,20 @@
|
|||
<input type="hidden" name="filename" value="<?php echo $_['filename'] ?>" id="filename">
|
||||
<input type="hidden" name="mimetype" value="<?php echo $_['mimetype'] ?>" id="mimetype">
|
||||
<header><div id="header">
|
||||
<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg" src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
|
||||
<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg"
|
||||
src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
|
||||
<div class="header-right">
|
||||
<?php if (isset($_['folder'])): ?>
|
||||
<span id="details"><?php echo $l->t('%s shared the folder %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
|
||||
<span id="details"><?php echo $l->t('%s shared the folder %s with you',
|
||||
array($_['displayName'], $_['fileTarget'])) ?></span>
|
||||
<?php else: ?>
|
||||
<span id="details"><?php echo $l->t('%s shared the file %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
|
||||
<span id="details"><?php echo $l->t('%s shared the file %s with you',
|
||||
array($_['displayName'], $_['fileTarget'])) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!isset($_['folder']) || $_['allowZipDownload']): ?>
|
||||
<a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
|
||||
<a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img
|
||||
class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
|
||||
/><?php echo $l->t('Download')?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div></header>
|
||||
|
@ -27,9 +32,12 @@
|
|||
<ul id="noPreview">
|
||||
<li class="error">
|
||||
<?php echo $l->t('No preview available for').' '.$_['fileTarget']; ?><br />
|
||||
<a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
|
||||
<a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download"
|
||||
src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
|
||||
/><?php echo $l->t('Download')?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> – <?php echo $l->t('web services under your control'); ?></p></footer>
|
||||
<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> –
|
||||
<?php echo $l->t('web services under your control'); ?></p></footer>
|
||||
|
|
|
@ -3,24 +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;
|
||||
}
|
||||
}
|
||||
|
||||
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
|
||||
|
||||
if (!OCA\Files_Trashbin\Trashbin::file_exists($filename)) {
|
||||
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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>files_trashbin</id>
|
||||
<name>Trash bin</name>
|
||||
<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>
|
||||
|
|
40
apps/files_trashbin/appinfo/update.php
Normal file
40
apps/files_trashbin/appinfo/update.php
Normal file
|
@ -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');
|
||||
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
0.1
|
||||
0.3
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
// Check if we are a user
|
||||
// Check if we are a user
|
||||
OCP\User::checkLoggedIn();
|
||||
|
||||
OCP\Util::addScript('files_trashbin', 'trash');
|
||||
|
@ -9,16 +9,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;
|
||||
|
@ -35,10 +35,10 @@ if ($dir) {
|
|||
'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file',
|
||||
'location' => $dir,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($fullpath);
|
||||
|
||||
closedir($dirContent);
|
||||
|
||||
} else {
|
||||
$dirlisting = false;
|
||||
$query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?');
|
||||
|
@ -66,28 +66,28 @@ foreach ($result as $r) {
|
|||
$files[] = $i;
|
||||
}
|
||||
|
||||
// Make breadcrumb
|
||||
// Make breadcrumb
|
||||
$pathtohere = '';
|
||||
$breadcrumb = array();
|
||||
foreach (explode('/', $dir) as $i) {
|
||||
$breadcrumb = array();
|
||||
foreach (explode('/', $dir) as $i) {
|
||||
if ($i != '') {
|
||||
if ( preg_match('/^(.+)\.d[0-9]+$/', $i, $match) ) {
|
||||
$name = $match[1];
|
||||
} else {
|
||||
$name = $i;
|
||||
}
|
||||
$pathtohere .= '/' . $i;
|
||||
$breadcrumb[] = array('dir' => $pathtohere, 'name' => $name);
|
||||
}
|
||||
}
|
||||
$pathtohere .= '/' . $i;
|
||||
$breadcrumb[] = array('dir' => $pathtohere, 'name' => $name);
|
||||
}
|
||||
}
|
||||
|
||||
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
|
||||
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
|
||||
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
|
||||
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
|
||||
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=', false);
|
||||
|
||||
$list = new OCP\Template('files_trashbin', 'part.list', '');
|
||||
$list->assign('files', $files, false);
|
||||
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$dir, false);
|
||||
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$dir, false);
|
||||
$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file='.$dir, false);
|
||||
$list->assign('disableSharing', true);
|
||||
$list->assign('dirlisting', $dirlisting);
|
||||
|
@ -95,6 +95,7 @@ $list->assign('disableDownloadActions', true);
|
|||
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
|
||||
$tmpl->assign('fileList', $list->fetchPage(), false);
|
||||
$tmpl->assign('files', $files);
|
||||
$tmpl->assign('dirlisting', $dirlisting);
|
||||
$tmpl->assign('dir', OC_Filesystem::normalizePath($view->getAbsolutePath()));
|
||||
|
||||
$tmpl->printPage();
|
||||
|
|
|
@ -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;
|
|
@ -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);
|
||||
|
@ -18,35 +19,36 @@ $(document).ready(function() {
|
|||
OC.dialogs.alert(result.data.message, 'Error');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
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')){
|
||||
|
@ -88,19 +90,19 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
processSelection();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('.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;
|
||||
}
|
||||
|
||||
|
||||
$.post(OC.filePath('files_trashbin','ajax','undelete.php'),
|
||||
{files:fileslist, dirlisting:dirlisting},
|
||||
function(result){
|
||||
|
@ -111,9 +113,33 @@ $(document).ready(function() {
|
|||
if (result.status != 'success') {
|
||||
OC.dialogs.alert(result.data.message, 'Error');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.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');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "اسم"
|
||||
"Name" => "اسم",
|
||||
"Delete" => "إلغاء"
|
||||
);
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
"1 file" => "1 файл",
|
||||
"{count} files" => "{count} файла",
|
||||
"Nothing in here. Your trash bin is empty!" => "Няма нищо. Кофата е празна!",
|
||||
"Restore" => "Възтановяване"
|
||||
"Restore" => "Възтановяване",
|
||||
"Delete" => "Изтриване"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "১টি ফোল্ডার",
|
||||
"{count} folders" => "{count} টি ফোল্ডার",
|
||||
"1 file" => "১টি ফাইল",
|
||||
"{count} files" => "{count} টি ফাইল"
|
||||
"{count} files" => "{count} টি ফাইল",
|
||||
"Delete" => "মুছে"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 fil",
|
||||
"{count} files" => "{count} filer",
|
||||
"Nothing in here. Your trash bin is empty!" => "Intet at se her. Din papirkurv er tom!",
|
||||
"Restore" => "Gendan"
|
||||
"Restore" => "Gendan",
|
||||
"Delete" => "Slet"
|
||||
);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Couldn't delete %s permanently" => "Konnte %s nicht permanent löschen",
|
||||
"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 permanent löschen",
|
||||
"delete file permanently" => "Datei dauerhaft löschen",
|
||||
"Delete permanently" => "Permanent löschen",
|
||||
"Name" => "Name",
|
||||
"Deleted" => "gelöscht",
|
||||
"1 folder" => "1 Ordner",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Couldn't delete %s permanently" => "Konnte %s nicht entgültig löschen",
|
||||
"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 entgültig löschen",
|
||||
"delete file permanently" => "Datei dauerhaft löschen",
|
||||
"Delete permanently" => "Endgültig löschen",
|
||||
"Name" => "Name",
|
||||
"Deleted" => "Gelöscht",
|
||||
"1 folder" => "1 Ordner",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"Couldn't restore %s" => "Αδυναμία επαναφοράς %s",
|
||||
"perform restore operation" => "εκτέλεση λειτουργία επαναφοράς",
|
||||
"delete file permanently" => "μόνιμη διαγραφή αρχείου",
|
||||
"Delete permanently" => "Μόνιμη διαγραφή",
|
||||
"Name" => "Όνομα",
|
||||
"Deleted" => "Διαγράφηκε",
|
||||
"1 folder" => "1 φάκελος",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 αρχείο",
|
||||
"{count} files" => "{count} αρχεία",
|
||||
"Nothing in here. Your trash bin is empty!" => "Δεν υπάρχει τίποτα εδώ. Ο κάδος σας είναι άδειος!",
|
||||
"Restore" => "Επαναφορά"
|
||||
"Restore" => "Επαναφορά",
|
||||
"Delete" => "Διαγραφή"
|
||||
);
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"{count} folders" => "{count} dosierujoj",
|
||||
"1 file" => "1 dosiero",
|
||||
"{count} files" => "{count} dosierujoj",
|
||||
"Restore" => "Restaŭri"
|
||||
"Restore" => "Restaŭri",
|
||||
"Delete" => "Forigi"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 archivo",
|
||||
"{count} files" => "{count} archivos",
|
||||
"Nothing in here. Your trash bin is empty!" => "No hay nada acá. ¡La papelera está vacía!",
|
||||
"Restore" => "Recuperar"
|
||||
"Restore" => "Recuperar",
|
||||
"Delete" => "Borrar"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 fail",
|
||||
"{count} files" => "{count} faili",
|
||||
"Nothing in here. Your trash bin is empty!" => "Siin pole midagi. Sinu prügikast on tühi!",
|
||||
"Restore" => "Taasta"
|
||||
"Restore" => "Taasta",
|
||||
"Delete" => "Kustuta"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "fitxategi bat",
|
||||
"{count} files" => "{count} fitxategi",
|
||||
"Nothing in here. Your trash bin is empty!" => "Ez dago ezer ez. Zure zakarrontzia hutsik dago!",
|
||||
"Restore" => "Berrezarri"
|
||||
"Restore" => "Berrezarri",
|
||||
"Delete" => "Ezabatu"
|
||||
);
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"{count} folders" => "{ شمار} پوشه ها",
|
||||
"1 file" => "1 پرونده",
|
||||
"{count} files" => "{ شمار } فایل ها",
|
||||
"Restore" => "بازیابی"
|
||||
"Restore" => "بازیابی",
|
||||
"Delete" => "حذف"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 ficheiro",
|
||||
"{count} files" => "{count} ficheiros",
|
||||
"Nothing in here. Your trash bin is empty!" => "Aquí non hai nada. O cesto do lixo está baleiro!",
|
||||
"Restore" => "Restablecer"
|
||||
"Restore" => "Restablecer",
|
||||
"Delete" => "Eliminar"
|
||||
);
|
||||
|
|
|
@ -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" => "מחיקה"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Ime"
|
||||
"Name" => "Ime",
|
||||
"Delete" => "Obriši"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 fájl",
|
||||
"{count} files" => "{count} fájl",
|
||||
"Nothing in here. Your trash bin is empty!" => "Itt nincs semmi. Az Ön szemetes mappája üres!",
|
||||
"Restore" => "Visszaállítás"
|
||||
"Restore" => "Visszaállítás",
|
||||
"Delete" => "Törlés"
|
||||
);
|
||||
|
|
3
apps/files_trashbin/l10n/hy.php
Normal file
3
apps/files_trashbin/l10n/hy.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Delete" => "Ջնջել"
|
||||
);
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Nomine"
|
||||
"Name" => "Nomine",
|
||||
"Delete" => "Deler"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"Couldn't restore %s" => "%s を復元出来ませんでした",
|
||||
"perform restore operation" => "復元操作を実行する",
|
||||
"delete file permanently" => "ファイルを完全に削除する",
|
||||
"Delete permanently" => "完全に削除する",
|
||||
"Name" => "名前",
|
||||
"Deleted" => "削除済み",
|
||||
"1 folder" => "1 フォルダ",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 ファイル",
|
||||
"{count} files" => "{count} ファイル",
|
||||
"Nothing in here. Your trash bin is empty!" => "ここには何もありません。ゴミ箱は空です!",
|
||||
"Restore" => "復元"
|
||||
"Restore" => "復元",
|
||||
"Delete" => "削除"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "1 საქაღალდე",
|
||||
"{count} folders" => "{count} საქაღალდე",
|
||||
"1 file" => "1 ფაილი",
|
||||
"{count} files" => "{count} ფაილი"
|
||||
"{count} files" => "{count} ფაილი",
|
||||
"Delete" => "წაშლა"
|
||||
);
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"{count} folders" => "폴더 {count}개",
|
||||
"1 file" => "파일 1개",
|
||||
"{count} files" => "파일 {count}개",
|
||||
"Restore" => "복원"
|
||||
"Restore" => "복원",
|
||||
"Delete" => "삭제"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Numm"
|
||||
"Name" => "Numm",
|
||||
"Delete" => "Läschen"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "1 папка",
|
||||
"{count} folders" => "{count} папки",
|
||||
"1 file" => "1 датотека",
|
||||
"{count} files" => "{count} датотеки"
|
||||
"{count} files" => "{count} датотеки",
|
||||
"Delete" => "Избриши"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Nama"
|
||||
"Name" => "Nama",
|
||||
"Delete" => "Padam"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Namn"
|
||||
"Name" => "Namn",
|
||||
"Delete" => "Slett"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Nom"
|
||||
"Name" => "Nom",
|
||||
"Delete" => "Escafa"
|
||||
);
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"{count} folders" => "{count} foldery",
|
||||
"1 file" => "1 plik",
|
||||
"{count} files" => "{count} pliki",
|
||||
"Restore" => "Przywróć"
|
||||
"Restore" => "Przywróć",
|
||||
"Delete" => "Usuń"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"Couldn't restore %s" => "%s не может быть восстановлен",
|
||||
"perform restore operation" => "выполнить операцию восстановления",
|
||||
"delete file permanently" => "удалить файл навсегда",
|
||||
"Delete permanently" => "Удалено навсегда",
|
||||
"Name" => "Имя",
|
||||
"Deleted" => "Удалён",
|
||||
"1 folder" => "1 папка",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 файл",
|
||||
"{count} files" => "{count} файлов",
|
||||
"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!",
|
||||
"Restore" => "Восстановить"
|
||||
"Restore" => "Восстановить",
|
||||
"Delete" => "Удалить"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"Couldn't restore %s" => "%s не может быть восстановлен",
|
||||
"perform restore operation" => "выполнить операцию восстановления",
|
||||
"delete file permanently" => "удалить файл навсегда",
|
||||
"Delete permanently" => "Удалить навсегда",
|
||||
"Name" => "Имя",
|
||||
"Deleted" => "Удалён",
|
||||
"1 folder" => "1 папка",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 файл",
|
||||
"{count} files" => "{количество} файлов",
|
||||
"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!",
|
||||
"Restore" => "Восстановить"
|
||||
"Restore" => "Восстановить",
|
||||
"Delete" => "Удалить"
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "නම",
|
||||
"1 folder" => "1 ෆොල්ඩරයක්",
|
||||
"1 file" => "1 ගොනුවක්"
|
||||
"1 file" => "1 ගොනුවක්",
|
||||
"Delete" => "මකා දමන්න"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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ť"
|
||||
);
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
"1 file" => "1 датотека",
|
||||
"{count} files" => "{count} датотеке/а",
|
||||
"Nothing in here. Your trash bin is empty!" => "Овде нема ништа. Корпа за отпатке је празна.",
|
||||
"Restore" => "Врати"
|
||||
"Restore" => "Врати",
|
||||
"Delete" => "Обриши"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php $TRANSLATIONS = array(
|
||||
"Name" => "Ime"
|
||||
"Name" => "Ime",
|
||||
"Delete" => "Obriši"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,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"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "1 கோப்புறை",
|
||||
"{count} folders" => "{எண்ணிக்கை} கோப்புறைகள்",
|
||||
"1 file" => "1 கோப்பு",
|
||||
"{count} files" => "{எண்ணிக்கை} கோப்புகள்"
|
||||
"{count} files" => "{எண்ணிக்கை} கோப்புகள்",
|
||||
"Delete" => "நீக்குக"
|
||||
);
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
"1 file" => "1 ไฟล์",
|
||||
"{count} files" => "{count} ไฟล์",
|
||||
"Nothing in here. Your trash bin is empty!" => "ไม่มีอะไรอยู่ในนี้ ถังขยะของคุณยังว่างอยู่",
|
||||
"Restore" => "คืนค่า"
|
||||
"Restore" => "คืนค่า",
|
||||
"Delete" => "ลบ"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 dosya",
|
||||
"{count} files" => "{count} dosya",
|
||||
"Nothing in here. Your trash bin is empty!" => "Burası boş. Çöp kutun tamamen boş.",
|
||||
"Restore" => "Geri yükle"
|
||||
"Restore" => "Geri yükle",
|
||||
"Delete" => "Sil"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"Couldn't restore %s" => "Неможливо відновити %s",
|
||||
"perform restore operation" => "виконати операцію відновлення",
|
||||
"delete file permanently" => "видалити файл назавжди",
|
||||
"Delete permanently" => "Видалити назавжди",
|
||||
"Name" => "Ім'я",
|
||||
"Deleted" => "Видалено",
|
||||
"1 folder" => "1 папка",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 файл",
|
||||
"{count} files" => "{count} файлів",
|
||||
"Nothing in here. Your trash bin is empty!" => "Нічого немає. Ваший кошик для сміття пустий!",
|
||||
"Restore" => "Відновити"
|
||||
"Restore" => "Відновити",
|
||||
"Delete" => "Видалити"
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"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",
|
||||
|
@ -10,5 +11,6 @@
|
|||
"1 file" => "1 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"
|
||||
"Restore" => "Khôi phục",
|
||||
"Delete" => "Xóa"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "1 个文件夹",
|
||||
"{count} folders" => "{count} 个文件夹",
|
||||
"1 file" => "1 个文件",
|
||||
"{count} files" => "{count} 个文件"
|
||||
"{count} files" => "{count} 个文件",
|
||||
"Delete" => "删除"
|
||||
);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"1 folder" => "1个文件夹",
|
||||
"{count} folders" => "{count} 个文件夹",
|
||||
"1 file" => "1 个文件",
|
||||
"{count} files" => "{count} 个文件"
|
||||
"{count} files" => "{count} 个文件",
|
||||
"Delete" => "删除"
|
||||
);
|
||||
|
|
|
@ -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" => "刪除"
|
||||
);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,111 +1,131 @@
|
|||
<?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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Files_Trashbin;
|
||||
|
||||
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)
|
||||
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
|
||||
|
||||
// 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 $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_FilesystemView('/'. $user);
|
||||
if (!$view->is_dir('files_trashbin')) {
|
||||
$view->mkdir('files_trashbin');
|
||||
$view->mkdir("versions_trashbin");
|
||||
}
|
||||
|
||||
$path_parts = pathinfo($file_path);
|
||||
|
||||
$deleted = $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';
|
||||
$view = new \OC\Files\View('/'. $user);
|
||||
if (!$view->is_dir('files_trashbin')) {
|
||||
$view->mkdir('files_trashbin');
|
||||
$view->mkdir("files_trashbin/files");
|
||||
$view->mkdir("files_trashbin/versions");
|
||||
$view->mkdir("files_trashbin/keyfiles");
|
||||
}
|
||||
|
||||
if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
|
||||
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
|
||||
}
|
||||
$trashbinSize += self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view);
|
||||
|
||||
if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) {
|
||||
$query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)");
|
||||
$path_parts = pathinfo($file_path);
|
||||
|
||||
$deleted = $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';
|
||||
}
|
||||
|
||||
$trashbinSize = self::getTrashbinSize($user);
|
||||
if ( $trashbinSize === false || $trashbinSize < 0 ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $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;
|
||||
}
|
||||
|
||||
if ( \OCP\App::isEnabled('files_versions') ) {
|
||||
}
|
||||
|
||||
// Take care of file versions
|
||||
if ( \OCP\App::isEnabled('files_versions') ) {
|
||||
if ( $view->is_dir('files_versions'.$file_path) ) {
|
||||
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/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_FilesystemView('/'. $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) {
|
||||
$trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']);
|
||||
$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_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_FilesystemView('/'.$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 = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota'));
|
||||
if ( $quota == null ) {
|
||||
$quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota'));
|
||||
}
|
||||
if ( $quota == null ) {
|
||||
$quota = \OC\Files\Filesystem::free_space('/');
|
||||
// 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 {
|
||||
$quota = \OCP\Util::computerFileSize($quota);
|
||||
}
|
||||
|
||||
// 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;
|
||||
// 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);
|
||||
\OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize);
|
||||
|
||||
self::setTrashbinSize($user, $trashbinSize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* restore files from trash bin
|
||||
* @param $file path to the deleted file
|
||||
|
@ -116,37 +136,38 @@ class Trashbin {
|
|||
$user = \OCP\User::getUser();
|
||||
$view = new \OC_FilesystemView('/'.$user);
|
||||
|
||||
if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
|
||||
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
|
||||
$trashbinSize = self::getTrashbinSize($user);
|
||||
if ( $trashbinSize === false || $trashbinSize < 0 ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $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']) ||
|
||||
!$view->isUpdatable('files'.$result[0]['location'])) ) {
|
||||
$location = '';
|
||||
|
||||
// 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 {
|
||||
$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_Filesystem::normalizePath('files_trashbin/'.$file);
|
||||
$source = \OC_Filesystem::normalizePath('files_trashbin/files/'.$file);
|
||||
$target = \OC_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);
|
||||
|
@ -163,29 +184,50 @@ class Trashbin {
|
|||
$versionedFile = $filename;
|
||||
} else {
|
||||
$versionedFile = $file;
|
||||
}
|
||||
if ( $result[0]['type'] == 'dir' ) {
|
||||
$trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file));
|
||||
$view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
|
||||
} else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) {
|
||||
}
|
||||
if ( $result[0]['type'] === 'dir' ) {
|
||||
$trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file));
|
||||
$view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
|
||||
} else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) {
|
||||
foreach ($versions as $v) {
|
||||
if ($timestamp ) {
|
||||
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp);
|
||||
$view->rename('versions_trashbin/'.$versionedFile.'.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 {
|
||||
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v);
|
||||
$view->rename('versions_trashbin/'.$versionedFile.'.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_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename);
|
||||
} else {
|
||||
$keyfile = \OC_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_FilesystemView('/'.$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 = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?');
|
||||
$query->execute(array($user,$filename,$timestamp));
|
||||
}
|
||||
|
||||
\OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize);
|
||||
self::setTrashbinSize($user, $trashbinSize);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
\OC_Log::write('files_trashbin', 'Couldn\'t restore file from trash bin, '.$filename, \OC_log::ERROR);
|
||||
|
@ -193,58 +235,77 @@ class Trashbin {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete file from trash bin permanently
|
||||
|
||||
/**
|
||||
* delete file from trash bin permanently
|
||||
* @param $filename path to the file
|
||||
* @param $timestamp of deletion time
|
||||
* @return size of deleted files
|
||||
*/
|
||||
public static function delete($filename, $timestamp=null) {
|
||||
$user = \OCP\User::getUser();
|
||||
* @param $timestamp of deletion time
|
||||
* @return size of deleted files
|
||||
*/
|
||||
public static function delete($filename, $timestamp=null) {
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC_FilesystemView('/'.$user);
|
||||
$size = 0;
|
||||
$size = 0;
|
||||
|
||||
if ( ($trashbinSize = \OCP\Config::getAppValue('files_trashbin', 'size')) === null ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
|
||||
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
|
||||
$trashbinSize = self::getTrashbinSize($user);
|
||||
if ( $trashbinSize === false || $trashbinSize < 0 ) {
|
||||
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $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));
|
||||
|
||||
if ( $timestamp ) {
|
||||
$query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?');
|
||||
$query->execute(array($user,$filename,$timestamp));
|
||||
$file = $filename.'.d'.$timestamp;
|
||||
} else {
|
||||
$file = $filename;
|
||||
}
|
||||
|
||||
|
||||
if ( \OCP\App::isEnabled('files_versions') ) {
|
||||
if ($view->is_dir('versions_trashbin/'.$file)) {
|
||||
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/versions_trashbin/'.$file));
|
||||
$view->unlink('versions_trashbin/'.$file);
|
||||
if ($view->is_dir('files_trashbin/versions/'.$file)) {
|
||||
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/versions/'.$file));
|
||||
$view->unlink('files_trashbin/versions/'.$file);
|
||||
} else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) {
|
||||
foreach ($versions as $v) {
|
||||
if ($timestamp ) {
|
||||
$size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v.'.d'.$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 {
|
||||
$size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v);
|
||||
$view->unlink('/versions_trashbin/'.$filename.'.v'.$v);
|
||||
$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
|
||||
$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($view->is_dir('/files_trashbin/'.$file)) {
|
||||
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/'.$file));
|
||||
} else {
|
||||
$size += $view->filesize('/files_trashbin/'.$file);
|
||||
}
|
||||
$view->unlink('/files_trashbin/'.$file);
|
||||
|
||||
// Take care of encryption keys
|
||||
$parts = pathinfo($file);
|
||||
if ( $view->is_dir('/files_trashbin/files/'.$file) ) {
|
||||
$keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename);
|
||||
} else {
|
||||
$keyfile = \OC_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_FilesystemView('/'.$user.'/'.$keyfile));
|
||||
} else {
|
||||
$size += $view->filesize($keyfile);
|
||||
}
|
||||
$view->unlink($keyfile);
|
||||
}
|
||||
|
||||
if ($view->is_dir('/files_trashbin/files/'.$file)) {
|
||||
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/files/'.$file));
|
||||
} else {
|
||||
$size += $view->filesize('/files_trashbin/files/'.$file);
|
||||
}
|
||||
$view->unlink('/files_trashbin/files/'.$file);
|
||||
$trashbinSize -= $size;
|
||||
\OCP\Config::setAppValue('files_trashbin', 'size', $trashbinSize);
|
||||
|
||||
return $size;
|
||||
self::setTrashbinSize($user, $trashbinSize);
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -263,56 +324,40 @@ class Trashbin {
|
|||
$filename = $filename;
|
||||
}
|
||||
|
||||
$target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename);
|
||||
$target = \OC_Filesystem::normalizePath('files_trashbin/files/'.$filename);
|
||||
return $view->file_exists($target);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* clean up the trash bin
|
||||
* @param max. available disk space for trashbin
|
||||
*/
|
||||
* @param max. available disk space for trashbin
|
||||
*/
|
||||
private static function expire($availableSpace) {
|
||||
|
||||
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC_FilesystemView('/'.$user);
|
||||
$size = 0;
|
||||
|
||||
$query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=?');
|
||||
|
||||
$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 ) {
|
||||
if ($view->is_dir('files_trashbin/'.$filename.'.d'.$timestamp)) {
|
||||
$size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp));
|
||||
} else {
|
||||
$size += $view->filesize('files_trashbin/'.$filename.'.d'.$timestamp);
|
||||
}
|
||||
$view->unlink('files_trashbin/'.$filename.'.d'.$timestamp);
|
||||
if ($r['type'] == 'dir') {
|
||||
$size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp));
|
||||
$view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp);
|
||||
} else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) {
|
||||
foreach ($versions as $v) {
|
||||
$size += $view->filesize('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp);
|
||||
$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');
|
||||
$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;
|
||||
|
@ -322,15 +367,16 @@ class Trashbin {
|
|||
$size += $tmp;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $size;
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -357,15 +403,15 @@ class Trashbin {
|
|||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* find all versions which belong to the file we want to restore
|
||||
* @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_FilesystemView('/'.\OCP\User::getUser().'/versions_trashbin');
|
||||
$versionsName = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($filename);
|
||||
$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin/versions');
|
||||
$versionsName = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($filename);
|
||||
$versions = array();
|
||||
if ($timestamp ) {
|
||||
// fetch for old versions
|
||||
|
@ -373,20 +419,20 @@ class Trashbin {
|
|||
$offset = -strlen($timestamp)-2;
|
||||
} else {
|
||||
$matches = glob( $versionsName.'.v*' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach( $matches as $ma ) {
|
||||
if ( $timestamp ) {
|
||||
$parts = explode( '.v', substr($ma, 0, $offset) );
|
||||
$parts = explode( '.v', substr($ma, 0, $offset) );
|
||||
$versions[] = ( end( $parts ) );
|
||||
} else {
|
||||
$parts = explode( '.v', $ma );
|
||||
$parts = explode( '.v', $ma );
|
||||
$versions[] = ( end( $parts ) );
|
||||
}
|
||||
}
|
||||
return $versions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* find unique extension for restored file if a file with the same name already exists
|
||||
* @param $location where the file should be restored
|
||||
|
@ -395,39 +441,71 @@ class Trashbin {
|
|||
* @return string with unique extension
|
||||
*/
|
||||
private static function getUniqueExtension($location, $filename, $view) {
|
||||
$ext = '';
|
||||
if ( $view->file_exists('files'.$location.'/'.$filename) ) {
|
||||
$tmpext = '.restored';
|
||||
$ext = $tmpext;
|
||||
$i = 1;
|
||||
while ( $view->file_exists('files'.$location.'/'.$filename.$ext) ) {
|
||||
$ext = $tmpext.$i;
|
||||
$i++;
|
||||
}
|
||||
$ext = '';
|
||||
if ( $view->file_exists('files'.$location.'/'.$filename) ) {
|
||||
$tmpext = '.restored';
|
||||
$ext = $tmpext;
|
||||
$i = 1;
|
||||
while ( $view->file_exists('files'.$location.'/'.$filename.$ext) ) {
|
||||
$ext = $tmpext.$i;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
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('');
|
||||
* @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;
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</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; ?>
|
||||
|
||||
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue