diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle mezzanine_patched_smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle
--- smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle 1970-01-01 01:00:00.000000000 +0100
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle 2010-11-26 14:13:34.000000000 +0100
@@ -0,0 +1,54 @@
+#/usr/bin/perl -w
+
+#----------------------------------------------------------------------
+# copyright (C) 2010 Firewall Services
+# daniel@firewall-services.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#----------------------------------------------------------------------
+
+
+use esmith::AccountsDB;
+use File::Find;
+use File::stat;
+
+my $a = esmith::AccountsDB->open_ro or die "Error opening accounts DB\n";
+
+foreach my $share ($a->get_all_by_prop(type=>'share')){
+ my $key = $share->key;
+ my $recycle = $share->prop('RecycleBin') || 'disabled';
+ our $retention = $share->prop('RecycleBinRetention') || 'unlimited';
+ # Skip the share if recycle bin is disabled or if retention is not limited
+ next if (($recycle eq 'disabled') || ($retention eq 'unlimited'));
+ # Convert retention in seconds
+ $retention = 60*60*24*$retention;
+ my $dir = $share->prop('RecycleBinDir') || 'Recycle Bin';
+ # Skip if dir contains ./
+ next if $dir =~ m#(\./)#;
+ find(\&remove, "/home/e-smith/files/shares/$key/files/$dir/");
+}
+
+sub remove{
+ # Remove files with last modification older than $retention
+ if ( -f ){
+ my $mtime = stat($_)->mtime;
+ (time() - $mtime > $retention) && unlink($_);
+ }
+ # Remove empty directories
+ elsif ( -d ){
+ (scalar <"$_/*">) || rmdir($_);
+ }
+}
+
diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares
--- smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares 2010-11-26 14:16:29.000000000 +0100
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares 2010-11-26 14:16:26.000000000 +0100
@@ -181,6 +181,48 @@
+ LABEL_RETENTION
+
+ Retention time
+
+
+
+
+ UNLIMITED
+
+ unlimited
+
+
+
+
+ ONE_WEEK
+
+ one week
+
+
+
+
+ ONE_MONTH
+
+ one month
+
+
+
+
+ SIX_MONTHS
+
+ six months
+
+
+
+
+ ONE_YEAR
+
+ one year
+
+
+
+ DESC_HTTP_SETTINGS
The following settings control the access of this shared folder using the HTTP/HTTPS protocol.
diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares
--- smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2010-11-26 14:16:29.000000000 +0100
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2010-11-26 14:10:14.000000000 +0100
@@ -79,6 +79,13 @@
+
+
+
+
{cgi};
$q->param(-name=>'smbaccess',-value=>'browseable');
$q->param(-name=>'recyclebin',-value=>'disabled');
+ $q->param(-name=>'retention',-value=>'unlimited');
$q->param(-name=>'httpaccess',-value=>'none');
$q->param(-name=>'webdav',-value=>'disabled');
$q->param(-name=>'requireSSL',-value=>'disabled');
@@ -211,6 +212,8 @@
($rec->prop('smbAccess') || 'enabled'));
$q->param(-name=>'recyclebin',-value=>
($rec->prop('RecycleBin') || 'disabled'));
+ $q->param(-name=>'retention',-value=>
+ ($rec->prop('RecycleBinRetention') || 'unlimited'));
$q->param(-name=>'httpaccess',-value=>
($rec->prop('httpAccess') || 'none'));
$q->param(-name=>'webdav',-value=>
@@ -461,6 +464,7 @@
WriteGroups => $WriteGroups,
ReadGroups => $ReadGroups,
RecycleBin => $self->cgi->param('recyclebin'),
+ RecycleBinRetention => $self->cgi->param('retention'),
smbAccess => $self->cgi->param('smbaccess'),
httpAccess => $self->cgi->param('httpaccess'),
WebDav => $self->cgi->param('webdav'),
@@ -509,6 +513,7 @@
WriteGroups => $WriteGroups,
ReadGroups => $ReadGroups,
RecycleBin => $self->cgi->param('recyclebin'),
+ RecycleBinRetention => $self->cgi->param('retention'),
smbAccess => $self->cgi->param('smbaccess'),
httpAccess => $self->cgi->param('httpaccess'),
WebDav => $self->cgi->param('webdav'),