1 |
unnilennium |
1.1 |
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 |
2 |
|
|
--- smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle 1970-01-01 01:00:00.000000000 +0100 |
3 |
|
|
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/cron.daily/purge-shares-recycle 2010-11-26 14:13:34.000000000 +0100 |
4 |
|
|
@@ -0,0 +1,54 @@ |
5 |
|
|
+#/usr/bin/perl -w |
6 |
|
|
+ |
7 |
|
|
+#---------------------------------------------------------------------- |
8 |
|
|
+# copyright (C) 2010 Firewall Services |
9 |
|
|
+# daniel@firewall-services.com |
10 |
|
|
+# |
11 |
|
|
+# This program is free software; you can redistribute it and/or modify |
12 |
|
|
+# it under the terms of the GNU General Public License as published by |
13 |
|
|
+# the Free Software Foundation; either version 2 of the License, or |
14 |
|
|
+# (at your option) any later version. |
15 |
|
|
+# |
16 |
|
|
+# This program is distributed in the hope that it will be useful, |
17 |
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
|
|
+# GNU General Public License for more details. |
20 |
|
|
+# |
21 |
|
|
+# You should have received a copy of the GNU General Public License |
22 |
|
|
+# along with this program; if not, write to the Free Software |
23 |
|
|
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
|
|
+#---------------------------------------------------------------------- |
25 |
|
|
+ |
26 |
|
|
+ |
27 |
|
|
+use esmith::AccountsDB; |
28 |
|
|
+use File::Find; |
29 |
|
|
+use File::stat; |
30 |
|
|
+ |
31 |
|
|
+my $a = esmith::AccountsDB->open_ro or die "Error opening accounts DB\n"; |
32 |
|
|
+ |
33 |
|
|
+foreach my $share ($a->get_all_by_prop(type=>'share')){ |
34 |
|
|
+ my $key = $share->key; |
35 |
|
|
+ my $recycle = $share->prop('RecycleBin') || 'disabled'; |
36 |
|
|
+ our $retention = $share->prop('RecycleBinRetention') || 'unlimited'; |
37 |
|
|
+ # Skip the share if recycle bin is disabled or if retention is not limited |
38 |
|
|
+ next if (($recycle eq 'disabled') || ($retention eq 'unlimited')); |
39 |
|
|
+ # Convert retention in seconds |
40 |
|
|
+ $retention = 60*60*24*$retention; |
41 |
|
|
+ my $dir = $share->prop('RecycleBinDir') || 'Recycle Bin'; |
42 |
|
|
+ # Skip if dir contains ./ |
43 |
|
|
+ next if $dir =~ m#(\./)#; |
44 |
|
|
+ find(\&remove, "/home/e-smith/files/shares/$key/files/$dir/"); |
45 |
|
|
+} |
46 |
|
|
+ |
47 |
|
|
+sub remove{ |
48 |
|
|
+ # Remove files with last modification older than $retention |
49 |
|
|
+ if ( -f ){ |
50 |
|
|
+ my $mtime = stat($_)->mtime; |
51 |
|
|
+ (time() - $mtime > $retention) && unlink($_); |
52 |
|
|
+ } |
53 |
|
|
+ # Remove empty directories |
54 |
|
|
+ elsif ( -d ){ |
55 |
|
|
+ (scalar <"$_/*">) || rmdir($_); |
56 |
|
|
+ } |
57 |
|
|
+} |
58 |
|
|
+ |
59 |
|
|
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 |
60 |
|
|
--- 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 |
61 |
|
|
+++ 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 |
62 |
|
|
@@ -181,6 +181,48 @@ |
63 |
|
|
</entry> |
64 |
|
|
|
65 |
|
|
<entry> |
66 |
|
|
+ <base>LABEL_RETENTION</base> |
67 |
|
|
+ <trans> |
68 |
|
|
+ Retention time |
69 |
|
|
+ </trans> |
70 |
|
|
+ </entry> |
71 |
|
|
+ |
72 |
|
|
+ <entry> |
73 |
|
|
+ <base>UNLIMITED</base> |
74 |
|
|
+ <trans> |
75 |
|
|
+ unlimited |
76 |
|
|
+ </trans> |
77 |
|
|
+ </entry> |
78 |
|
|
+ |
79 |
|
|
+ <entry> |
80 |
|
|
+ <base>ONE_WEEK</base> |
81 |
|
|
+ <trans> |
82 |
|
|
+ one week |
83 |
|
|
+ </trans> |
84 |
|
|
+ </entry> |
85 |
|
|
+ |
86 |
|
|
+ <entry> |
87 |
|
|
+ <base>ONE_MONTH</base> |
88 |
|
|
+ <trans> |
89 |
|
|
+ one month |
90 |
|
|
+ </trans> |
91 |
|
|
+ </entry> |
92 |
|
|
+ |
93 |
|
|
+ <entry> |
94 |
|
|
+ <base>SIX_MONTHS</base> |
95 |
|
|
+ <trans> |
96 |
|
|
+ six months |
97 |
|
|
+ </trans> |
98 |
|
|
+ </entry> |
99 |
|
|
+ |
100 |
|
|
+ <entry> |
101 |
|
|
+ <base>ONE_YEAR</base> |
102 |
|
|
+ <trans> |
103 |
|
|
+ one year |
104 |
|
|
+ </trans> |
105 |
|
|
+ </entry> |
106 |
|
|
+ |
107 |
|
|
+ <entry> |
108 |
|
|
<base>DESC_HTTP_SETTINGS</base> |
109 |
|
|
<trans> |
110 |
|
|
The following settings control the access of this shared folder using the HTTP/HTTPS protocol. |
111 |
|
|
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 |
112 |
|
|
--- smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2010-11-26 14:16:29.000000000 +0100 |
113 |
|
|
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2010-11-26 14:10:14.000000000 +0100 |
114 |
|
|
@@ -79,6 +79,13 @@ |
115 |
|
|
<label>LABEL_RECYCLEBIN</label> |
116 |
|
|
</field> |
117 |
|
|
|
118 |
|
|
+ <field type="select" |
119 |
|
|
+ id="retention" |
120 |
|
|
+ options="'unlimited' => 'UNLIMITED', '7' => 'ONE_WEEK', '30' => 'ONE_MONTH', |
121 |
|
|
+ '180' => 'SIX_MONTHS', '365' => 'ONE_YEAR'"> |
122 |
|
|
+ <label>LABEL_RETENTION</label> |
123 |
|
|
+ </field> |
124 |
|
|
+ |
125 |
|
|
<subroutine src="print_section_bar()" /> |
126 |
|
|
|
127 |
|
|
<field |
128 |
|
|
diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm mezzanine_patched_smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm |
129 |
|
|
--- smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2010-11-26 14:16:29.000000000 +0100 |
130 |
|
|
+++ mezzanine_patched_smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2010-11-26 14:09:58.000000000 +0100 |
131 |
|
|
@@ -177,6 +177,7 @@ |
132 |
|
|
my $q = $self->{cgi}; |
133 |
|
|
$q->param(-name=>'smbaccess',-value=>'browseable'); |
134 |
|
|
$q->param(-name=>'recyclebin',-value=>'disabled'); |
135 |
|
|
+ $q->param(-name=>'retention',-value=>'unlimited'); |
136 |
|
|
$q->param(-name=>'httpaccess',-value=>'none'); |
137 |
|
|
$q->param(-name=>'webdav',-value=>'disabled'); |
138 |
|
|
$q->param(-name=>'requireSSL',-value=>'disabled'); |
139 |
|
|
@@ -211,6 +212,8 @@ |
140 |
|
|
($rec->prop('smbAccess') || 'enabled')); |
141 |
|
|
$q->param(-name=>'recyclebin',-value=> |
142 |
|
|
($rec->prop('RecycleBin') || 'disabled')); |
143 |
|
|
+ $q->param(-name=>'retention',-value=> |
144 |
|
|
+ ($rec->prop('RecycleBinRetention') || 'unlimited')); |
145 |
|
|
$q->param(-name=>'httpaccess',-value=> |
146 |
|
|
($rec->prop('httpAccess') || 'none')); |
147 |
|
|
$q->param(-name=>'webdav',-value=> |
148 |
|
|
@@ -461,6 +464,7 @@ |
149 |
|
|
WriteGroups => $WriteGroups, |
150 |
|
|
ReadGroups => $ReadGroups, |
151 |
|
|
RecycleBin => $self->cgi->param('recyclebin'), |
152 |
|
|
+ RecycleBinRetention => $self->cgi->param('retention'), |
153 |
|
|
smbAccess => $self->cgi->param('smbaccess'), |
154 |
|
|
httpAccess => $self->cgi->param('httpaccess'), |
155 |
|
|
WebDav => $self->cgi->param('webdav'), |
156 |
|
|
@@ -509,6 +513,7 @@ |
157 |
|
|
WriteGroups => $WriteGroups, |
158 |
|
|
ReadGroups => $ReadGroups, |
159 |
|
|
RecycleBin => $self->cgi->param('recyclebin'), |
160 |
|
|
+ RecycleBinRetention => $self->cgi->param('retention'), |
161 |
|
|
smbAccess => $self->cgi->param('smbaccess'), |
162 |
|
|
httpAccess => $self->cgi->param('httpaccess'), |
163 |
|
|
WebDav => $self->cgi->param('webdav'), |