|
@@ -50,14 +50,8 @@ function htDeleteSite($dir, $domainType, $protocol) {
|
|
|
|
|
|
if ($domainType === 'onion') {
|
|
|
// Delete Tor config
|
|
|
- $torConf = file_get_contents(CONF['ht']['tor_config_path']);
|
|
|
- if ($torConf === false)
|
|
|
- serverError("Failed to read current Tor configuration.");
|
|
|
- $torConf = str_replace('HiddenServiceDir ' . CONF['ht']['tor_keys_path'] . '/' . $dir . '/
|
|
|
-HiddenServicePort 80 [::1]:' . CONF['ht']['internal_onion_http_port'] . '
|
|
|
-', '', $torConf);
|
|
|
- if (file_put_contents(CONF['ht']['tor_config_path'], $torConf) === false)
|
|
|
- serverError("Failed to write new Tor configuration.");
|
|
|
+ if (unlink(CONF['ht']['tor_config_path'] . '/' . $_SESSION['username'] . '/' . $dir) !== true)
|
|
|
+ serverError("Failed to delete Tor configuration.");
|
|
|
|
|
|
// Reload Tor
|
|
|
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['systemctl_path'] . " reload " . CONF['ht']['tor_service'], $output, $code);
|
|
@@ -65,7 +59,7 @@ HiddenServicePort 80 [::1]:' . CONF['ht']['internal_onion_http_port'] . '
|
|
|
serverError("Failed to reload Tor.");
|
|
|
|
|
|
// Delete Tor keys
|
|
|
- exec(CONF['ht']['sudo_path'] . " -u " . CONF['ht']['tor_user'] . " " . CONF['ht']['rm_path'] . " --recursive " . CONF['ht']['tor_keys_path'] . "/" . $dir, $output, $code);
|
|
|
+ exec(CONF['ht']['sudo_path'] . ' -u ' . CONF['ht']['tor_user'] . ' ' . CONF['ht']['rm_path'] . ' --recursive ' . CONF['ht']['tor_keys_path'] . '/' . $_SESSION['username'] . '/' . $dir, $output, $code);
|
|
|
if ($code !== 0)
|
|
|
serverError("Failed to delete Tor keys.");
|
|
|
}
|