Skip to content

Commit 8433d03

Browse files
author
Till Brehm
committed
Create empty .htpasswd file, when adding a new folder protection.
1 parent 14001d2 commit 8433d03

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,15 @@ function web_folder_update($event_name, $data) {
22172217
$app->system->chown($new_folder_path.'.htaccess', $website['system_user']);
22182218
$app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']);
22192219
$app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
2220+
2221+
//* Create empty .htpasswd file, if it does not exist
2222+
if(!is_file($folder_path.'.htpasswd')) {
2223+
$app->system->touch($new_folder_path.'.htpasswd');
2224+
$app->system->chmod($new_folder_path.'.htpasswd', 0750);
2225+
$app->system->chown($new_folder_path.'.htpasswd', $website['system_user']);
2226+
$app->system->chgrp($new_folder_path.'.htpasswd', $website['system_group']);
2227+
$app->log('Created file '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
2228+
}
22202229
}
22212230

22222231
//* Remove .htaccess file

0 commit comments

Comments
 (0)