Commit 3b8dfa35 authored by sikeda's avatar sikeda
Browse files

[-dev] Removing functions no longer used.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12898 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent df46139a
......@@ -31,6 +31,7 @@ use Digest::MD5 qw();
use Encode qw();
use English qw(-no_match_vars);
use File::Path qw();
use IO::File;
use POSIX qw();
use Sympa;
......
......@@ -8441,77 +8441,14 @@ sub get_which {
### moderation for shared
# return the status of the shared
sub get_shared_status {
my $self = shift;
$log->syslog('debug3', '(%s)', $self->{'name'});
if (-e $self->{'dir'} . '/shared') {
return 'exist';
} elsif (-e $self->{'dir'} . '/pending.shared') {
return 'deleted';
} else {
return 'none';
}
}
# return the list of documents shared waiting for moderation
sub get_shared_moderated {
my $self = shift;
$log->syslog('debug3', '');
my $shareddir = $self->{'dir'} . '/shared';
unless (-e "$shareddir") {
return undef;
}
## sort of the shared
my @mod_dir = sort_dir_to_get_mod("$shareddir");
return \@mod_dir;
}
# return the list of documents awaiting for moderation in a dir and its
# subdirs
sub sort_dir_to_get_mod {
#dir to explore
my $dir = shift;
$log->syslog('debug3', '');
# listing of all the shared documents of the directory
unless (opendir DIR, "$dir") {
$log->syslog('err', 'Cannot open %s: %m', $dir);
return undef;
}
# array of entry of the directory DIR
my @tmpdir = readdir DIR;
closedir DIR;
# private entry with documents not yet moderated
my @moderate_dir = grep (/(\.moderate)$/, @tmpdir);
@moderate_dir = grep (!/^\.desc\./, @moderate_dir);
foreach my $d (@moderate_dir) {
$d = "$dir/$d";
}
# DEPRECATED: Use {status} attribute of Sympa::SharedDocument instance.
#sub get_shared_status;
my $path_d;
foreach my $d (@tmpdir) {
# current document
$path_d = "$dir/$d";
# DEPRECATED: Use Sympa::SharedDocument::get_moderated_descendants().
#sub get_shared_moderated;
if ($d =~ /^\.+$/) {
next;
}
if (-d $path_d) {
push(@moderate_dir, sort_dir_to_get_mod($path_d));
}
}
return @moderate_dir;
}
# DEPRECATED: Subroutine of get_shared_moderated().
#sub sort_dir_to_get_mod;
## Get the type of a DB field
#OBSOLETED: No longer used. This is specific to MySQL: Use $sdm->get_fields()
......@@ -9447,18 +9384,11 @@ sub select_list_members_for_topic {
# DEPRECATED. Use Sympa::Spool::Auth::remove().
#sub delete_subscription_request;
sub get_shared_size {
my $self = shift;
return Sympa::Tools::File::get_dir_size($self->{'dir'} . '/shared');
}
# OBSOLETED: Use Sympa::SharedDocument::get_size().
#sub get_shared_size;
sub get_arc_size {
my $self = shift;
my $dir = shift;
return Sympa::Tools::File::get_dir_size($dir . '/' . $self->get_id);
}
# OBSOLETED: Use Sympa::Archive::get_size().
#sub get_arc_size;
# return the date epoch for next delivery planified for a list
# Note: As of 6.2a.41, returns undef if parameter is not set or invalid.
......@@ -9788,24 +9718,8 @@ sub notify_bouncers {
return 1;
}
## Create the document repository
sub create_shared {
my $self = shift;
my $dir = $self->{'dir'} . '/shared';
if (-e $dir) {
$log->syslog('err', '%s already exists', $dir);
return undef;
}
unless (mkdir($dir, 0777)) {
$log->syslog('err', 'Unable to create %s: %m', $dir);
return undef;
}
return 1;
}
# DDEPRECATED: Use Sympa::SharedDocument::create().
#sub create_shared;
## check if a list has include-type data sources
sub has_include_data_sources {
......
......@@ -364,172 +364,30 @@ sub upload_file_to_server {
return 1;
}
## Useful function to get off the slash at the end of the path
## at its end
sub no_slash_end {
my $path = shift;
# DEPRECATED: No longer used.
#sub no_slash_end;
## supress ending '/'
$path =~ s/\/+$//;
return $path;
}
## return a visible path from a moderated file or not
sub make_visible_path {
my $path = shift;
my $visible_path = $path;
if ($path =~ /\.url(\.moderate)?$/) {
if ($path =~ /^([^\/]*\/)*([^\/]+)\.([^\/]+)$/) {
$visible_path =~ s/\.moderate$//;
$visible_path =~ s/^\.//;
$visible_path =~ s/\.url$//;
}
} elsif ($path =~ /\.moderate$/) {
if ($path =~ /^(([^\/]*\/)*)([^\/]+)(\/?)$/) {
my $name = $3;
$name =~ s/^\.//;
$name =~ s/\.moderate//;
$visible_path = "$2" . "$name";
}
}
## Qdecode the visible path
return Sympa::Tools::Text::qdecode_filename($visible_path);
}
# DEPRECATED: No longer used.
#sub make_visible_path;
## returns a mailto according to list spam protection parameter
# DEPRECATED. Use [%|mailto()%] and [%|obfuscate()%] filters in template.
#sub mailto;
## return the mode of editing included in $action : 0, 0.5 or 1
sub find_edit_mode {
my $action = shift;
# DEPRECATED: No longer used.
#sub find_edit_mode;
my $result;
if ($action =~ /editor/i) {
$result = 0.5;
} elsif ($action =~ /do_it/i) {
$result = 1;
} else {
$result = 0;
}
return $result;
}
## return the mode of editing : 0, 0.5 or 1 :
# do the merging between 2 args of right access edit : "0" > "0.5" > "1"
# instead of a "and" between two booleans : the most restrictive right is
# imposed
sub merge_edit {
my $arg1 = shift;
my $arg2 = shift;
my $result;
if ($arg1 == 0 || $arg2 == 0) {
$result = 0;
} elsif ($arg1 == 0.5 || $arg2 == 0.5) {
$result = 0.5;
} else {
$result = 1;
}
return $result;
}
# DEPRECATED: No longer used.
#sub merge_edit;
sub get_desc_file {
my $file = shift;
my $ligne;
my %hash;
# Moved: Use Sympa::SharedDocument::_load_desc_file().
#sub get_desc_file;
open DESC_FILE, "$file";
# DEPRECATED: No longer used.
#sub get_directory_content;
while ($ligne = <DESC_FILE>) {
if ($ligne =~ /^title\s*$/) {
#case title of the document
while ($ligne = <DESC_FILE>) {
last if ($ligne =~ /^\s*$/);
$ligne =~ /^\s*(\S.*\S)\s*/;
$hash{'title'} = $hash{'title'} . $1 . " ";
}
}
if ($ligne =~ /^creation\s*$/) {
#case creation of the document
while ($ligne = <DESC_FILE>) {
last if ($ligne =~ /^\s*$/);
if ($ligne =~ /^\s*email\s*(\S*)\s*/) {
$hash{'email'} = $1;
}
if ($ligne =~ /^\s*date_epoch\s*(\d*)\s*/) {
$hash{'date'} = $1;
}
}
}
if ($ligne =~ /^access\s*$/) {
#case access scenarios for the document
while ($ligne = <DESC_FILE>) {
last if ($ligne =~ /^\s*$/);
if ($ligne =~ /^\s*read\s*(\S*)\s*/) {
$hash{'read'} = $1;
}
if ($ligne =~ /^\s*edit\s*(\S*)\s*/) {
$hash{'edit'} = $1;
}
}
}
}
close DESC_FILE;
return %hash;
}
## return a ref on an array of file (or subdirecties) to show to user
sub get_directory_content {
my $tmpdir = shift;
my $user = shift;
my $list = shift;
my $doc = shift;
# array of file not hidden
my @dir = grep !/^\./, @$tmpdir;
# array with documents not yet moderated
my @moderate_dir = grep (/(\.moderate)$/, @$tmpdir);
@moderate_dir = grep (!/^\.desc\./, @moderate_dir);
# The editor can see file not yet moderated.
# A user can see file not yet moderated if they are the owner of these
# files.
if ($list->is_admin('actual_editor', $user)) {
push(@dir, @moderate_dir);
} else {
my @privatedir = select_my_files($user, $doc, \@moderate_dir);
push(@dir, @privatedir);
}
return \@dir;
}
## return an array that contains only file from @$refdir that belongs to $user
sub select_my_files {
my ($user, $path, $refdir) = @_;
my @new_dir;
foreach my $d (@$refdir) {
if (-e "$path/.desc.$d") {
my %desc_hash = get_desc_file("$path/.desc.$d");
if ($user eq $desc_hash{'email'}) {
$new_dir[$#new_dir + 1] = $d;
}
}
}
return @new_dir;
}
# DEPRECATED: No longer used (a subroutine of get_directory_content()).
#sub select_my_files;
sub get_icon {
my $robot = shift || '*';
......
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