From 5aeb35e71b47c2e96f0b2522b8ce443f4dc2add0 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 1 May 2023 23:23:09 +0200 Subject: [PATCH] Fix stats for vhost alias #6386 --- server/plugins-available/apache2_plugin.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index d829b5979e..dc0df3005c 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1935,18 +1935,18 @@ class apache2_plugin { if($data['new']['stats_type'] != '') { if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats'); - $ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user\nDirectoryIndex index.html index.php\nHeader set Content-Security-Policy \"default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;\"\n\nAddDefaultCharset UTF-8\n\n"; + $ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/".$web_folder."/stats/.htpasswd_stats\nrequire valid-user\nDirectoryIndex index.html index.php\nHeader set Content-Security-Policy \"default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;\"\n\nAddDefaultCharset UTF-8\n\n"; $app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file); $app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755); unset($ht_file); - if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { + if(!is_file($data['new']['document_root'].'/'.$web_folder.'/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { if(isset($data['new']['stats_password']) && trim($data['new']['stats_password']) != '') { $htp_file = 'admin:'.trim($data['new']['stats_password']); $app->system->web_folder_protection($data['new']['document_root'], false); - $app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file); + $app->system->file_put_contents($data['new']['document_root'].'/'.$web_folder.'/stats/.htpasswd_stats', $htp_file); $app->system->web_folder_protection($data['new']['document_root'], true); - $app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755); + $app->system->chmod($data['new']['document_root'].'/'.$web_folder.'/stats/.htpasswd_stats', 0755); unset($htp_file); } } -- GitLab