Skip to content

Commit 07dcf84

Browse files
author
Marius Burkard
committed
Merge branch 'bugfix/6052_Prevent-recursive-io-ops-on-alias-vhosts' into 'develop'
Skip possible IO extensive operations for vhostalias creation on "web" document root Closes #6052 See merge request ispconfig/ispconfig3!1417
2 parents ee45b99 + 783ebe6 commit 07dcf84

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

server/plugins-available/nginx_plugin.inc.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,11 @@ function update($event_name, $data) {
819819
}
820820
}
821821
}
822-
$app->system->exec_safe('chmod -R a+r ?', $data['new']['document_root'].'/' . $web_folder . '/');
822+
// Set the a+r mod to the web_folder.
823+
// Skip this for types where the target vhost already exists if the web_folder is "web". In this case, everything is setup already from the vhost setup
824+
if ( ( $data['new']['type'] != 'vhostalias' && $data['new']['type'] != 'vhostsubdomain' ) || $web_folder != 'web') {
825+
$app->system->exec_safe('chmod -R a+r ?', $data['new']['document_root'].'/' . $web_folder . '/');
826+
}
823827

824828
//** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
825829
} elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
@@ -874,7 +878,10 @@ function update($event_name, $data) {
874878

875879
if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) {
876880
// Chown and chmod the directories below the document root
877-
$app->system->exec_safe('chown -R ?:? ?', $username, $groupname, $data['new']['document_root'].'/' . $web_folder);
881+
// Skip this for types where the target vhost already exists if the web_folder is "web". In this case, everything is setup already from the vhost setup
882+
if ( ( $data['new']['type'] != 'vhostalias' && $data['new']['type'] != 'vhostsubdomain' ) || $web_folder != 'web') {
883+
$app->system->exec_safe( 'chown -R ?:? ?', $username, $groupname, $data['new']['document_root'] . '/' . $web_folder );
884+
}
878885
// The document root itself has to be owned by root in normal level and by the web owner in security level 20
879886
if($web_config['security_level'] == 20) {
880887
$app->system->exec_safe('chown ?:? ?', $username, $groupname, $data['new']['document_root'].'/' . $web_folder);

0 commit comments

Comments
 (0)