- don't delete everything if the path is the domains document-root (protect basedir, awstats|webalizer-dir and place default index), fixes #273
refs #273
This commit is contained in:
@@ -342,7 +342,7 @@ elseif($page == 'htaccess')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||||
$options_indexes = makeyesno('options_indexes', '1', '0', '1');
|
$options_indexes = makeyesno('options_indexes', '1', '0', '0');
|
||||||
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
|
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,18 @@ class ApsInstaller extends ApsParser
|
|||||||
$this->db->query('DELETE FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
$this->db->query('DELETE FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||||
|
|
||||||
//remove data, #273
|
//remove data, #273
|
||||||
|
if($this->DomainPath != '' && $this->DomainPath != '/') {
|
||||||
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/');
|
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/');
|
||||||
|
} else {
|
||||||
|
// save awstats/webalizer folder if it's the docroot
|
||||||
|
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/', true);
|
||||||
|
// place standard-index file
|
||||||
|
$loginname = getLoginNameByUid($Row['CustomerID']);
|
||||||
|
if($loginname !== false)
|
||||||
|
{
|
||||||
|
storeDefaultIndex($loginname, $this->RealPath . $this->DomainPath . '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -400,9 +400,9 @@ class ApsParser
|
|||||||
* unlink files recursively
|
* unlink files recursively
|
||||||
*
|
*
|
||||||
* @param dir directory to delete recursive
|
* @param dir directory to delete recursive
|
||||||
|
* @param boolean whether the base-directory should be kept or not
|
||||||
*/
|
*/
|
||||||
|
protected function UnlinkRecursive($Dir, $save_base = false)
|
||||||
protected function UnlinkRecursive($Dir)
|
|
||||||
{
|
{
|
||||||
if(!$DirHandle = @opendir($Dir))return;
|
if(!$DirHandle = @opendir($Dir))return;
|
||||||
|
|
||||||
@@ -411,6 +411,12 @@ class ApsParser
|
|||||||
if($Object == '.'
|
if($Object == '.'
|
||||||
|| $Object == '..')continue;
|
|| $Object == '..')continue;
|
||||||
|
|
||||||
|
if($save_base
|
||||||
|
&& (strtoupper($Object) == 'AWSTATS' || strtoupper($Object) == 'WEBALIZER')
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(!@unlink($Dir . '/' . $Object))
|
if(!@unlink($Dir . '/' . $Object))
|
||||||
{
|
{
|
||||||
self::UnlinkRecursive($Dir . '/' . $Object);
|
self::UnlinkRecursive($Dir . '/' . $Object);
|
||||||
@@ -418,8 +424,11 @@ class ApsParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
closedir($DirHandle);
|
closedir($DirHandle);
|
||||||
|
if(!$save_base)
|
||||||
|
{
|
||||||
@rmdir($Dir);
|
@rmdir($Dir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function provides package management for admins
|
* function provides package management for admins
|
||||||
|
|||||||
Reference in New Issue
Block a user