Skip to content

Commit 6088a9c

Browse files
author
Till Brehm
committed
#4977 stats Folder created even when Statistics set to none
1 parent bb00dc2 commit 6088a9c

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ function update($event_name, $data) {
719719

720720
if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
721721
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
722-
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats');
722+
if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats');
723723
//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
724724
if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
725725
if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
@@ -1005,8 +1005,10 @@ function update($event_name, $data) {
10051005
$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
10061006
$app->system->chown($data['new']['document_root'].'/web/error', $username);
10071007
$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
1008-
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
1009-
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
1008+
if($data['new']['stats_type'] != '') {
1009+
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
1010+
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
1011+
}
10101012
$app->system->chown($data['new']['document_root'].'/webdav', $username);
10111013
$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
10121014
$app->system->chown($data['new']['document_root'].'/private', $username);
@@ -1046,8 +1048,10 @@ function update($event_name, $data) {
10461048
$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
10471049
$app->system->chown($data['new']['document_root'].'/web/error', $username);
10481050
$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
1049-
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
1050-
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
1051+
if($data['new']['stats_type'] != '') {
1052+
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
1053+
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
1054+
}
10511055
$app->system->chown($data['new']['document_root'].'/webdav', $username);
10521056
$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
10531057
}
@@ -1060,16 +1064,20 @@ function update($event_name, $data) {
10601064
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
10611065
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
10621066
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
1063-
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
1064-
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
1067+
if($data['new']['stats_type'] != '') {
1068+
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
1069+
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
1070+
}
10651071
} else {
10661072
$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
10671073
$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
10681074
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
10691075
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
10701076
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
1071-
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
1072-
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
1077+
if($data['new']['stats_type'] != '') {
1078+
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
1079+
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
1080+
}
10731081
}
10741082
}
10751083

server/plugins-available/nginx_plugin.inc.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ function update($event_name, $data) {
566566

567567
if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
568568
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
569-
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats');
569+
if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats');
570570
//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
571571
if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
572572
if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
@@ -853,8 +853,10 @@ function update($event_name, $data) {
853853
$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
854854
$app->system->chown($data['new']['document_root'].'/web/error', $username);
855855
$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
856-
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
857-
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
856+
if($data['new']['stats_type'] != '') {
857+
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
858+
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
859+
}
858860
//$app->system->chown($data['new']['document_root'].'/webdav',$username);
859861
//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
860862
$app->system->chown($data['new']['document_root'].'/private', $username);
@@ -900,8 +902,10 @@ function update($event_name, $data) {
900902
$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
901903
$app->system->chown($data['new']['document_root'].'/web/error', $username);
902904
$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
903-
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
904-
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
905+
if($data['new']['stats_type'] != '') {
906+
$app->system->chown($data['new']['document_root'].'/web/stats', $username);
907+
$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
908+
}
905909
//$app->system->chown($data['new']['document_root'].'/webdav',$username);
906910
//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
907911

@@ -919,16 +923,20 @@ function update($event_name, $data) {
919923
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
920924
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
921925
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
922-
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
923-
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
926+
if($data['new']['stats_type'] != '') {
927+
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
928+
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
929+
}
924930
} else {
925931
$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
926932
$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
927933
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
928934
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
929935
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
930-
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
931-
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
936+
if($data['new']['stats_type'] != '') {
937+
$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
938+
$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
939+
}
932940
}
933941
}
934942

0 commit comments

Comments
 (0)