@@ -1801,21 +1801,23 @@ function update($event_name, $data) {
18011801
18021802 //* Create .htaccess and .htpasswd file for website statistics
18031803 //if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
1804- if (!is_dir ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats ' )) $ app ->system ->mkdir ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats ' );
1805- $ ht_file = "AuthType Basic \nAuthName \"Members Only \"\nAuthUserFile " .$ data ['new ' ]['document_root ' ]."/web/stats/.htpasswd_stats \nrequire valid-user " ;
1806- $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats/.htaccess ' , $ ht_file );
1807- $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats/.htaccess ' , 0755 );
1808- unset($ ht_file );
1809- //}
18101804
1811- if (!is_file ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
1812- if (trim ($ data ['new ' ]['stats_password ' ]) != '' ) {
1813- $ htp_file = 'admin: ' .trim ($ data ['new ' ]['stats_password ' ]);
1814- $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ], false );
1815- $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' , $ htp_file );
1816- $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ], true );
1817- $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' , 0755 );
1818- unset($ htp_file );
1805+ if ($ data ['new ' ]['stats_type ' ] != '' ) {
1806+ if (!is_dir ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats ' )) $ app ->system ->mkdir ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats ' );
1807+ $ ht_file = "AuthType Basic \nAuthName \"Members Only \"\nAuthUserFile " .$ data ['new ' ]['document_root ' ]."/web/stats/.htpasswd_stats \nrequire valid-user " ;
1808+ $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats/.htaccess ' , $ ht_file );
1809+ $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/ ' . $ web_folder . '/stats/.htaccess ' , 0755 );
1810+ unset($ ht_file );
1811+
1812+ if (!is_file ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
1813+ if (trim ($ data ['new ' ]['stats_password ' ]) != '' ) {
1814+ $ htp_file = 'admin: ' .trim ($ data ['new ' ]['stats_password ' ]);
1815+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ], false );
1816+ $ app ->system ->file_put_contents ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' , $ htp_file );
1817+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ], true );
1818+ $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/web/stats/.htpasswd_stats ' , 0755 );
1819+ unset($ htp_file );
1820+ }
18191821 }
18201822 }
18211823
@@ -1824,6 +1826,11 @@ function update($event_name, $data) {
18241826 $ this ->awstats_update ($ data , $ web_config );
18251827 }
18261828
1829+ //* Remove Stats-Folder when Statistics set to none
1830+ if ($ data ['new ' ]['stats_type ' ] == '' && ($ data ['new ' ]['type ' ] == 'vhost ' || $ data ['new ' ]['type ' ] == 'vhostsubdomain ' || $ data ['new ' ]['type ' ] == 'vhostalias ' )) {
1831+ exec ('rm -rf ' .$ data ['new ' ]['document_root ' ].'/web/stats ' );
1832+ }
1833+
18271834 $ this ->php_fpm_pool_update ($ data , $ web_config , $ pool_dir , $ pool_name , $ socket_dir , $ web_folder );
18281835 $ this ->hhvm_update ($ data , $ web_config );
18291836
0 commit comments