/[smeserver]/rpms/e-smith-quota/sme8/e-smith-quota-2.2.0-QuotaAsNumber.patch
ViewVC logotype

Contents of /rpms/e-smith-quota/sme8/e-smith-quota-2.2.0-QuotaAsNumber.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sat Nov 27 20:48:00 2010 UTC (13 years, 11 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-quota-2_2_0-8_el5_sme, e-smith-quota-2_2_0-7_el5_sme, e-smith-quota-2_2_0-9_el5_sme, e-smith-quota-2_2_0-10_el5_sme, HEAD
Changes since 1.1: +2 -2 lines
- Correction to allow units in upper and lower case [SME: 5248]

1 diff -ruN e-smith-quota-2.2.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/quota e-smith-quota-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/quota
2 --- e-smith-quota-2.2.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/quota 2008-10-07 18:37:14.000000000 +0100
3 +++ e-smith-quota-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/quota 2010-11-27 10:08:19.000000000 +0000
4 @@ -94,19 +94,19 @@
5 <entry>
6 <base>INSTRUCTIONS</base>
7 <trans>
8 - Enter the quota as an integer with optional unit
9 - suffix of 'K' for kilobytes, 'M' for megabytes, or 'G' for gigabytes.
10 + Enter the quota with optional unit suffix of 'K' for kilobytes, 'M' for megabytes,
11 + 'G' for gigabytes or 'T' for terabytes.
12 Entries with no suffix are assumed to be in megabytes. A setting of '0'
13 for either limit disables that limit for the corresponding user.
14 </trans>
15 </entry>
16 <entry>
17 - <base>SOFT_VAL_MUST_BE_INTEGER</base>
18 - <trans>Error: limit with grace period must be an integer, optionally followed by one of the unit suffixes K, M, or G.</trans>
19 + <base>SOFT_VAL_MUST_BE_NUMBER</base>
20 + <trans>Error: limit with grace period must be a number, optionally followed by one of the unit suffixes K, M, G, or T.</trans>
21 </entry>
22 <entry>
23 - <base>HARD_VAL_MUST_BE_INTEGER</base>
24 - <trans>Error: absolute limit must be an integer, optionally followed by one of the unit suffixes K, M, or G.</trans>
25 + <base>HARD_VAL_MUST_BE_NUMBER</base>
26 + <trans>Error: absolute limit must be a number, optionally followed by one of the unit suffixes K, M, G, or T.</trans>
27 </entry>
28 <entry>
29 <base>ERR_HARD_LT_SOFT</base>
30 diff -ruN e-smith-quota-2.2.0.old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm e-smith-quota-2.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm
31 --- e-smith-quota-2.2.0.old/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm 2010-11-21 15:26:32.000000000 +0000
32 +++ e-smith-quota-2.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/quota.pm 2010-11-27 10:08:09.000000000 +0000
33 @@ -20,6 +20,7 @@
34 use esmith::FormMagick;
35 use esmith::cgi;
36 use esmith::TestUtils;
37 +use Scalar::Util qw(looks_like_number);
38
39 our @ISA = qw(esmith::FormMagick Exporter);
40 our @EXPORT = qw(
41 @@ -266,42 +267,39 @@
42 return $self->error($msg, 'Initial');
43 }
44 my $softlim = $q->param ('soft');
45 - unless ($softlim =~ /^(\d+)\s*[kmg]?$/i)
46 - {
47 - return $self->error('SOFT_VAL_MUST_BE_INTEGER', 'Initial');
48 - }
49 - my $value = $1;
50 - if($softlim =~ /g$/i)
51 - {
52 - $softlim = $self->GBtoKB($value);
53 - }
54 - elsif($softlim =~ /k$/i)
55 - {
56 - $softlim = $value;
57 - }
58 - else
59 +
60 + unless ($softlim =~ /^(.+?)\s*([kmgt])?$/i )
61 {
62 - $softlim = $self->MBtoKB($value);
63 + return $self->error('SOFT_VAL_MUST_BE_NUMBER', 'Initial');
64 }
65 + my $value = $1;
66 + unless (looks_like_number($value))
67 + {
68 + return $self->error('SOFT_VAL_MUST_BE_NUMBER', 'Initial');
69 + }
70 + my $exponent = 1; # Entries with no suffix are assumed to be in megabytes.
71 + if (defined ($2))
72 + {
73 + $exponent = index("kmgt",lc($2));
74 + }
75 + $softlim = ($value * 1024 ** $exponent);
76
77 my $hardlim = $q->param ('hard');
78 - unless ($hardlim =~ /^(\d+)\s*[kmg]?$/i)
79 - {
80 - return $self->error('HARD_VAL_MUST_BE_INTEGER', 'Initial');
81 - }
82 - $value = $1;
83 - if($hardlim =~ /g$/i)
84 - {
85 - $hardlim = $self->GBtoKB($value);
86 - }
87 - elsif($hardlim =~ /k$/i)
88 - {
89 - $hardlim = $value;
90 - }
91 - else
92 + unless ($hardlim =~ /^(.+?)\s*([kmgt])?$/i )
93 {
94 - $hardlim = $self->MBtoKB($value);
95 + return $self->error('HARD_VAL_MUST_BE_NUMBER', 'Initial');
96 }
97 + my $value = $1;
98 + unless (looks_like_number($value))
99 + {
100 + return $self->error('HARD_VAL_MUST_BE_NUMBER', 'Initial');
101 + }
102 + my $exponent = 1; # Entries with no suffix are assumed to be in megabytes.
103 + if (defined ($2))
104 + {
105 + $exponent = index("kmgt",lc($2));
106 + }
107 + $hardlim = ($value * 1024 ** $exponent);
108
109 #------------------------------------------------------------
110 # Make sure that soft limit is less than hard limit.

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed