Commit 1afe6731 authored by sikeda's avatar sikeda
Browse files

[-dev] get_shared_size() and get_arc_size() in Sympa::List were deprecated. ...

[-dev] get_shared_size() and get_arc_size() in Sympa::List were deprecated.  Use get_size() methods in Sympa::SharedDocument and Sympa::Archive.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12881 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 335146b0
......@@ -15441,7 +15441,7 @@ sub do_d_upload {
 
## Check quota
if ($list->{'admin'}{'shared_doc'}{'quota'}) {
if ($list->get_shared_size() >=
if (Sympa::SharedDocument->new($list)->get_size >=
$list->{'admin'}{'shared_doc'}{'quota'} * 1024) {
Sympa::Report::reject_report_web('user', 'shared_full', {},
$param->{'action'}, $list);
......@@ -16627,7 +16627,7 @@ sub do_d_unzip {
 
## Check quota
if ($list->{'admin'}{'shared_doc'}{'quota'}) {
if ($list->get_shared_size() >=
if (Sympa::SharedDocument->new($list)->get_size >=
$list->{'admin'}{'shared_doc'}{'quota'} * 1024) {
Sympa::Report::reject_report_web('user', 'shared_full', {},
$param->{'action'}, $list);
......@@ -17578,7 +17578,7 @@ sub d_copy_file {
## Check quota
if ($list->{'admin'}{'shared_doc'}{'quota'}) {
 
if ($list->get_shared_size() >=
if (Sympa::SharedDocument->new($list)->get_size >=
$list->{'admin'}{'shared_doc'}{'quota'} * 1024) {
Sympa::Report::reject_report_web('user', 'shared_full', {},
$param->{'action'}, $list);
......@@ -21015,12 +21015,10 @@ sub do_ignoresig {
sub do_stats {
wwslog('info', '');
 
$param->{'shared_size'} = int(($list->get_shared_size + 512) / 1024);
$param->{'arc_size'} = int(
( $list->get_arc_size(Conf::get_robot_conf($robot, 'arc_path')) +
512
) / 1024
);
$param->{'shared_size'} =
int((Sympa::SharedDocument->new($list)->get_size + 512) / 1024);
$param->{'arc_size'} =
int((Sympa::Archive->new(context => $list)->get_size + 512) / 1024);
 
my $stats = {
send_mail => {title => $language->gettext("Mail sending")},
......
......@@ -584,6 +584,15 @@ sub get_archives {
# DEPRECATED. Use select_archive() and fetch().
#sub search_msgid;
# Old name: Sympa::List::get_arc_size().
sub get_size {
my $self = shift;
my $dir = shift;
return 0 unless -d $self->{base_directory};
return Sympa::Tools::File::get_dir_size($self->{base_directory});
}
# OBSOLETED. No longer used.
sub exist {
my ($name, $file) = @_;
......@@ -1069,6 +1078,12 @@ Returns:
Hashref.
Note that message won't be locked.
=item get_size ( )
I<Instance method>.
Gets total size of messages in archives.
This method was introduced on Sympa 6.2.17.
=item next ( [ reverse =E<gt> 1 ] )
I<Instance method>.
......
......@@ -729,6 +729,15 @@ sub get_privileges {
# return $result;
#}
# Old name: Sympa::List::get_shared_size().
sub get_size {
my $self = shift;
return undef unless grep { $self->{type} eq $_ } qw(root directory);
return 0 unless -d $self->{fs_path};
return Sympa::Tools::File::get_dir_size($self->{fs_path});
}
sub install {
my $self = shift;
......@@ -1050,6 +1059,11 @@ Gets privileges of a user on the node.
TBD.
=item get_size ( )
I<Instance method>.
Gets total size under current node.
=item install ( )
I<Instance method>.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment