summaryrefslogtreecommitdiff
path: root/manifests/vhost/phpdirs.pp
blob: 24413d0e0f3ec50d485fe2f82bf80b5aede891ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
define apache::vhost::phpdirs(
    $ensure = present,
    $php_upload_tmp_dir = 'absent',
    $php_session_save_path = 'absent',
    $documentroot_owner = apache,
    $documentroot_group = 0,
    $documentroot_mode = 0750,
    $run_mode = 'normal',
    $run_uid = 'absent'
){
    # php upload_tmp_dir
    case $php_upload_tmp_dir {
        'absent': {
            include apache::defaultphpdirs
            $real_php_upload_tmp_dir = "/var/www/upload_tmp_dir/$name"
        }
        default: { $real_php_upload_tmp_dir = $php_upload_tmp_dir }
    }
    # php session_save_path
    case $php_session_save_path {
        'absent': {
            include apache::defaultphpdirs
            $real_php_session_save_path = "/var/www/session.save_path/$name"
        }
        default: { $real_php_session_save_path = $php_session_save_path }
    }

    case $ensure {
        absent: {
            file{[$real_php_upload_tmp_dir, $real_php_session_save_path ]:
                ensure => absent,
                purge => true,
                force => true,
                recurse => true,
            }
        }
        default: {
            file{[$real_php_upload_tmp_dir, $real_php_session_save_path ]:
                ensure => directory,
                owner => $run_mode ? {
                    'itk' => $run_uid,
                    default => $documentroot_owner
                },
                group => $documentroot_group, mode => $documentroot_mode;
            }
        }
    }
}