interface/lib/classes/aps_crawler.inc.php | ●●●●● patch | view | raw | blame | history | |
server/lib/classes/aps_installer.inc.php | ●●●●● patch | view | raw | blame | history | |
server/lib/classes/file.inc.php | ●●●●● patch | view | raw | blame | history |
interface/lib/classes/aps_crawler.inc.php
@@ -98,7 +98,7 @@ foreach($files as $file) { if($file != '.' && $file != '..') if(filetype($dir.'/'.$file) == 'dir') rrmdir($dir.'/'.$file); if(filetype($dir.'/'.$file) == 'dir') $this->removeDirectory($dir.'/'.$file); else @unlink($dir.'/'.$file); } reset($files); server/lib/classes/aps_installer.inc.php
@@ -397,8 +397,28 @@ // Now delete an existing folder (affects install and removal in the same way) @chdir($this->local_installpath); if(file_exists($this->local_installpath)) exec("rm -Rf ".escapeshellarg($this->local_installpath).'*'); else mkdir($this->local_installpath, 0777, true); if(file_exists($this->local_installpath)){ // make sure we don't delete error and stats folders if($this->local_installpath == $this->document_root.'/'){ if(is_dir($this->document_root)){ $files = array_diff(scandir($this->document_root), array('.','..','error','stats')); foreach($files as $file){ if(is_dir($this->document_root.'/'.$file)){ $app->file->removeDirectory($this->document_root.'/'.$file); } else { @unlink($this->document_root.'/'.$file); } } } else { @unlink($this->document_root); mkdir($this->document_root, 0777, true); } } else { exec("rm -Rf ".escapeshellarg($this->local_installpath).'*'); } } else { mkdir($this->local_installpath, 0777, true); } if($this->handle_type == 'install') { server/lib/classes/file.inc.php
@@ -268,6 +268,23 @@ } return $passed; } function removeDirectory($dir){ //TODO: implement something to delete files/directories recursively that are owned by a certain user or group if(is_dir($dir)){ $files = array_diff(scandir($dir), array('.','..')); if(is_array($files) && !empty($files)){ foreach($files as $file){ if(is_dir($dir.'/'.$file)){ $this->removeDirectory($dir.'/'.$file); } else { @unlink($dir.'/'.$file); } } } @rmdir($dir); } } } ?>