@@ -1779,8 +1779,19 @@ function update($event_name, $data) {
17791779 $ tpl ->setLoop ('alias_seo_redirects ' , $ alias_seo_redirects );
17801780 }
17811781
1782+ $ stats_web_folder = 'web ' ;
1783+ if ($ data ['new ' ]['type ' ] == 'vhost ' ){
1784+ if ($ data ['new ' ]['web_folder ' ] != '' ){
1785+ if (substr ($ data ['new ' ]['web_folder ' ], 0 , 1 ) == '/ ' ) $ data ['new ' ]['web_folder ' ] = substr ($ data ['new ' ]['web_folder ' ],1 );
1786+ if (substr ($ data ['new ' ]['web_folder ' ], -1 ) == '/ ' ) $ data ['new ' ]['web_folder ' ] = substr ($ data ['new ' ]['web_folder ' ],0 ,-1 );
1787+ }
1788+ $ stats_web_folder .= '/ ' .$ data ['new ' ]['web_folder ' ];
1789+ } elseif ($ data ['new ' ]['type ' ] == 'vhostsubdomain ' || $ data ['new ' ]['type ' ] == 'vhostalias ' ) {
1790+ $ stats_web_folder = $ data ['new ' ]['web_folder ' ];
1791+ }
1792+
17821793 //* Create basic http auth for website statistics
1783- $ tpl ->setVar ('stats_auth_passwd_file ' , $ data ['new ' ]['document_root ' ]."/web /stats/.htpasswd_stats " );
1794+ $ tpl ->setVar ('stats_auth_passwd_file ' , $ data ['new ' ]['document_root ' ]."/ " . $ stats_web_folder . " /stats/.htpasswd_stats " );
17841795
17851796 // Create basic http auth for other directories
17861797 $ basic_auth_locations = $ this ->_create_web_folder_auth_configuration ($ data ['new ' ]);
@@ -1848,11 +1859,11 @@ function update($event_name, $data) {
18481859 }
18491860
18501861 // create password file for stats directory
1851- if (!is_file ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
1862+ if (!is_file ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
18521863 if (trim ($ data ['new ' ]['stats_password ' ]) != '' ) {
18531864 $ htp_file = 'admin: ' .trim ($ data ['new ' ]['stats_password ' ]);
1854- $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' , $ htp_file );
1855- $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/web /stats/.htpasswd_stats ' , 0755 );
1865+ $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' , $ htp_file );
1866+ $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/ ' . $ stats_web_folder . ' /stats/.htpasswd_stats ' , 0755 );
18561867 unset($ htp_file );
18571868 }
18581869 }
0 commit comments