Skip to content

Commit 318ace2

Browse files
committed
1 parent e2c5f8b commit 318ace2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function update($event_name,$data) {
238238
if(is_array($tmp_symlinks_array)) {
239239
foreach($tmp_symlinks_array as $tmp_symlink) {
240240
$tmp_symlink = str_replace("[client_id]",$client_id,$tmp_symlink);
241-
$tmp_symlink = str_replace("[website_domain]",$data["new"]["domain"],$tmp_symlink);
241+
$tmp_symlink = str_replace("[website_domain]",$data["old"]["domain"],$tmp_symlink);
242242
// Remove trailing slash
243243
if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
244244
// create the symlinks, if not exist
@@ -389,6 +389,13 @@ function update($event_name,$data) {
389389
$app->log("Removing symlink: $vhost_symlink => $vhost_file",LOGLEVEL_DEBUG);
390390
}
391391

392+
// remove old symlink, if domain name of the site has changed
393+
if($this->action == 'update' && $data["old"]["domain"] != '' && $data["new"]["domain"] != $data["old"]["domain"]) {
394+
$vhost_symlink = escapeshellcmd($web_config["vhost_conf_enabled_dir"].'/'.$data["old"]["domain"].'.vhost');
395+
unlink($vhost_symlink);
396+
$app->log("Removing symlink: $vhost_symlink => $vhost_file",LOGLEVEL_DEBUG);
397+
}
398+
392399
// request a httpd reload when all records have been processed
393400
$app->services->restartServiceDelayed('httpd','reload');
394401

0 commit comments

Comments
 (0)