From a04f31435ab3b51441db68c4b1020fe2e0b02946 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 12 Jun 2010 08:48:05 +0200 Subject: introduce upload dir for gallery server side uploads --- manifests/vhost/php/gallery2.pp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/manifests/vhost/php/gallery2.pp b/manifests/vhost/php/gallery2.pp index 19240e9..7f38895 100644 --- a/manifests/vhost/php/gallery2.pp +++ b/manifests/vhost/php/gallery2.pp @@ -43,7 +43,8 @@ define apache::vhost::php::gallery2( $htpasswd_path = 'absent', $manage_config = true, $config_webwriteable = false, - $manage_directories = true + $manage_directories = true, + $upload_dir = 'present' ){ $documentroot = $path ? { 'absent' => $operatingsystem ? { @@ -64,9 +65,32 @@ define apache::vhost::php::gallery2( 'present' => directory, default => absent }, - owner => $documentroot_owner, - group => $documentroot_group, - mode => 0660; + owner => $documentroot_owner, group => $documentroot_group, mode => 0660; + } + + if $upload_dir != 'present' { + $real_upload_dir = $operatingsystem ? { + openbsd => "/var/www/htdocs/${name}/upload", + default => "/var/www/vhosts/${name}/upload" + } + } else { + $real_upload_dir = $upload_dir + } + + file{$real_upload_dir: + owner => $documentroot_owner, group => $documentroot_group, mode => 0660; + } + if ($ensure == 'absent') or ($upload_dir == 'absent') { + File[$real_upload_dir]{ + ensure => absent, + purge => true, + force => true, + recurse => true + } + } else { + File[$real_upload_dir]{ + ensure => directory + } } # create vhost configuration file -- cgit v1.2.3