@@ -1770,8 +1770,19 @@ function update($event_name, $data) {
17701770 $ tpl ->setLoop ('alias_seo_redirects ' , $ alias_seo_redirects );
17711771 }
17721772
1773+ $ stats_web_folder = 'web ' ;
1774+ if ($ data ['new ' ]['type ' ] == 'vhost ' ){
1775+ if ($ data ['new ' ]['web_folder ' ] != '' ){
1776+ if (substr ($ data ['new ' ]['web_folder ' ], 0 , 1 ) == '/ ' ) $ data ['new ' ]['web_folder ' ] = substr ($ data ['new ' ]['web_folder ' ],1 );
1777+ if (substr ($ data ['new ' ]['web_folder ' ], -1 ) == '/ ' ) $ data ['new ' ]['web_folder ' ] = substr ($ data ['new ' ]['web_folder ' ],0 ,-1 );
1778+ }
1779+ $ stats_web_folder .= '/ ' .$ data ['new ' ]['web_folder ' ];
1780+ } elseif ($ data ['new ' ]['type ' ] == 'vhostsubdomain ' || $ data ['new ' ]['type ' ] == 'vhostalias ' ) {
1781+ $ stats_web_folder = $ data ['new ' ]['web_folder ' ];
1782+ }
1783+
17731784 //* Create basic http auth for website statistics
1774- $ tpl ->setVar ('stats_auth_passwd_file ' , $ data ['new ' ]['document_root ' ]."/web /stats/.htpasswd_stats " );
1785+ $ tpl ->setVar ('stats_auth_passwd_file ' , $ data ['new ' ]['document_root ' ]."/ " . $ stats_web_folder . " /stats/.htpasswd_stats " );
17751786
17761787 // Create basic http auth for other directories
17771788 $ basic_auth_locations = $ this ->_create_web_folder_auth_configuration ($ data ['new ' ]);
@@ -1839,11 +1850,11 @@ function update($event_name, $data) {
18391850 }
18401851
18411852 // create password file for stats directory
1842- if (!is_file ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
1853+ if (!is_file ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
18431854 if (trim ($ data ['new ' ]['stats_password ' ]) != '' ) {
18441855 $ htp_file = 'admin: ' .trim ($ data ['new ' ]['stats_password ' ]);
1845- $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' , $ htp_file );
1846- $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' , 0755 );
1856+ $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' , $ htp_file );
1857+ $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' , 0755 );
18471858 unset($ htp_file );
18481859 }
18491860 }
0 commit comments