From 6088a9c69e26d69849924e5c2fc33eccc8ff207e Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Tue, 22 May 2018 16:05:16 +0200 Subject: [PATCH] #4977 stats Folder created even when Statistics set to none --- .../plugins-available/apache2_plugin.inc.php | 26 ++++++++++++------- server/plugins-available/nginx_plugin.inc.php | 26 ++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index bab74653d..aba168257 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -719,7 +719,7 @@ class apache2_plugin { if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder); if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error'); - if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); + if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder); if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin'); @@ -1005,8 +1005,10 @@ class apache2_plugin { $app->system->chgrp($data['new']['document_root'].'/web', $groupname); $app->system->chown($data['new']['document_root'].'/web/error', $username); $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } $app->system->chown($data['new']['document_root'].'/webdav', $username); $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); $app->system->chown($data['new']['document_root'].'/private', $username); @@ -1046,8 +1048,10 @@ class apache2_plugin { $app->system->chgrp($data['new']['document_root'].'/web', $groupname); $app->system->chown($data['new']['document_root'].'/web/error', $username); $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } $app->system->chown($data['new']['document_root'].'/webdav', $username); $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); } @@ -1060,16 +1064,20 @@ class apache2_plugin { $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } } else { $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755); $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } } } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index a7d7cf5e8..c09e226d0 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -566,7 +566,7 @@ class nginx_plugin { if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder); if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error'); - if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); + if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder); if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin'); @@ -853,8 +853,10 @@ class nginx_plugin { $app->system->chgrp($data['new']['document_root'].'/web', $groupname); $app->system->chown($data['new']['document_root'].'/web/error', $username); $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } //$app->system->chown($data['new']['document_root'].'/webdav',$username); //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); $app->system->chown($data['new']['document_root'].'/private', $username); @@ -900,8 +902,10 @@ class nginx_plugin { $app->system->chgrp($data['new']['document_root'].'/web', $groupname); $app->system->chown($data['new']['document_root'].'/web/error', $username); $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } //$app->system->chown($data['new']['document_root'].'/webdav',$username); //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); @@ -919,16 +923,20 @@ class nginx_plugin { $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } } else { $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755); $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } } } -- GitLab