Skip to content

Commit 52a04e7

Browse files
committed
Fixed: FS#1314 - WebDAV module doesn't work.
1 parent 0ff3f15 commit 52a04e7

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,13 +1052,14 @@ function server_ip($event_name,$data) {
10521052
*/
10531053
public function webdav($event_name,$data) {
10541054
global $app, $conf;
1055+
1056+
/*
1057+
* load the server configuration options
1058+
*/
1059+
$app->uses("getconf");
1060+
$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
10551061

10561062
if (($event_name == 'webdav_user_insert') || ($event_name == 'webdav_user_update')) {
1057-
/*
1058-
* load the server configuration options
1059-
*/
1060-
$app->uses("getconf");
1061-
$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
10621063

10631064
/*
10641065
* Get additional informations
@@ -1134,12 +1135,29 @@ public function webdav($event_name,$data) {
11341135
*/
11351136
$sitedata = $app->db->queryOneRecord("SELECT document_root, domain FROM web_domain WHERE domain_id = " . $data['old']['parent_domain_id']);
11361137
$documentRoot = $sitedata['document_root'];
1138+
$domain = $sitedata['domain'];
11371139

11381140
/*
11391141
* We dont't want to destroy any (transfer)-Data. So we do NOT delete any dir.
11401142
* So the only thing, we have to do, is to delete the user from the password-file
11411143
*/
11421144
$this->_writeHtDigestFile( $documentRoot . '/webdav/' . $data['old']['dir'] . '.htdigest', $data['old']['username'], $data['old']['dir'], '');
1145+
1146+
/*
1147+
* Next step, patch the vhost - file
1148+
*/
1149+
$vhost_file = escapeshellcmd($web_config["vhost_conf_dir"] . '/' . $domain . '.vhost');
1150+
$this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav');
1151+
1152+
/*
1153+
* Last, restart apache
1154+
*/
1155+
if($apache_chrooted) {
1156+
$app->services->restartServiceDelayed('httpd','restart');
1157+
} else {
1158+
// request a httpd reload when all records have been processed
1159+
$app->services->restartServiceDelayed('httpd','reload');
1160+
}
11431161
}
11441162
}
11451163

@@ -1190,7 +1208,11 @@ private function _writeHtDigestFile($filename, $username, $authname, $pwdhash )
11901208
/*
11911209
* Now lets write the new file
11921210
*/
1193-
file_put_contents($filename, $output);
1211+
if(trim($output) == '') {
1212+
unlink($filename);
1213+
} else {
1214+
file_put_contents($filename, $output);
1215+
}
11941216
}
11951217

11961218
/**

0 commit comments

Comments
 (0)