Commit 6669cc6b authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[change] pictures_url & pictures_path are no longer may be per-robot...

[change] pictures_url & pictures_path are no longer may be per-robot parameters.  Because list subdirectories under PICTURESDIR are assumed.
parent 20078b24
......@@ -852,45 +852,26 @@ sub checkfiles {
}
}
# Create pictures dir if useful for each robot.
foreach my $robot (keys %{$Conf{'robots'}}) {
my $dir = get_robot_conf($robot, 'pictures_path');
if ($dir ne '' && -d $dir) {
unless (-f $dir . '/index.html') {
unless (open(FF, ">$dir" . '/index.html')) {
$log->syslog(
'err',
'Unable to create %s/index.html as an empty file to protect directory: %m',
$dir
);
}
close FF;
}
# Create pictures directory. FIXME: Would be created on demand.
my $pictures_dir = $Conf::Conf{'pictures_path'};
unless (-d $pictures_dir) {
unless (mkdir $pictures_dir, 0775) {
$log->syslog('err', 'Unable to create directory %s',
$pictures_dir);
$config_err++;
} else {
chmod 0775, $pictures_dir; # set masked bits.
# create picture dir
if (get_robot_conf($robot, 'pictures_feature') eq 'on') {
my $pictures_dir =
get_robot_conf($robot, 'pictures_path');
unless (-d $pictures_dir) {
unless (mkdir($pictures_dir, 0775)) {
$log->syslog('err', 'Unable to create directory %s',
$pictures_dir);
$config_err++;
}
chmod 0775, $pictures_dir;
my $index_path = $pictures_dir . '/index.html';
unless (-f $index_path) {
unless (open(FF, ">$index_path")) {
$log->syslog(
'err',
'Unable to create %s as an empty file to protect directory',
$index_path
);
}
close FF;
}
}
my $index_path = $pictures_dir . '/index.html';
my $fh;
unless (open $fh, '>', $index_path) {
$log->syslog(
'err',
'Unable to create %s as an empty file to protect directory',
$index_path
);
} else {
close $fh;
}
}
}
......
......@@ -1320,14 +1320,12 @@ our @params = (
{ 'name' => 'pictures_path',
'default_s' => '$PICTURESDIR',
'gettext_id' => 'Directory for subscribers pictures',
'vhost' => '1',
},
{ 'name' => 'pictures_url',
'default' => '/static-sympa/pictures',
'gettext_id' => 'URL for subscribers pictures',
'gettext_comment' =>
'HTTP server have to map it with "pictures_path" directory.',
'vhost' => '1',
},
{ 'name' => 'color_0',
'gettext_id' => 'Colors for web interface',
......@@ -1666,6 +1664,7 @@ our @params = (
'gettext_comment' =>
"Enables or disables the pictures feature by default. If enabled, subscribers can upload their picture (from the \"Subscriber option\" page) to use as an avatar.\nPictures are stored in a directory specified by the \"static_content_path\" parameter.",
'default' => 'on',
'vhost' => '1',
},
{ 'name' => 'pictures_max_size',
'gettext_id' => 'The maximum size of uploaded picture',
......
......@@ -1773,21 +1773,14 @@ sub send_notify_to_owner {
return 1;
}
# Note: This would be moved to Robot package.
# FIXME:This might be moved to Sympa::WWW namespace.
sub get_picture_path {
my $self = shift;
return join '/',
Conf::get_robot_conf($self->{'domain'}, 'pictures_path'),
$self->get_id, @_;
return join '/', $Conf::Conf{'pictures_path'}, $self->get_id, @_;
}
# Note: This would be moved to Robot package.
sub get_picture_url {
my $self = shift;
return join '/',
Conf::get_robot_conf($self->{'domain'}, 'pictures_url'),
$self->get_id, @_;
}
# No longer used. Use Sympa::List::find_picture_url().
#sub get_picture_url;
=over 4
......@@ -1800,6 +1793,7 @@ Returns the type of a pictures according to the user.
=cut
# Old name: tools::pictures_filename()
# FIXME:This might be moved to Sympa::WWW namespace.
sub find_picture_filenames {
my $self = shift;
my $email = shift;
......@@ -1816,6 +1810,7 @@ sub find_picture_filenames {
return @ret;
}
# FIXME:This might be moved to Sympa::WWW namespace.
sub find_picture_paths {
my $self = shift;
my $email = shift;
......@@ -1836,13 +1831,16 @@ Find pictures URL
=cut
# Old name: tools::make_pictures_url().
# FIXME:This might be moved to Sympa::WWW namespace.
sub find_picture_url {
my $self = shift;
my $email = shift;
my ($filename) = $self->find_picture_filenames($email);
return undef unless $filename;
return $self->get_picture_url($filename);
return Sympa::Tools::Text::weburl(
$Conf::Conf{'pictures_url'}, [$self->get_id, $filename]);
}
=over
......@@ -1855,6 +1853,7 @@ Deletes a member's picture file.
=cut
# FIXME:This might be moved to Sympa::WWW namespace.
sub delete_list_member_picture {
$log->syslog('debug2', '(%s, %s)', @_);
my $self = 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