File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -403,13 +403,27 @@ class SFTP extends Server {
403
403
}
404
404
}
405
405
406
+ protected function recursive_remove($file_or_directory, $if_dir = false) {
407
+ $parent = dirname($file_or_directory);
408
+ if ($this->connection->delete($file_or_directory, $if_dir)) {
409
+ $filelist = $this->connection->nlist($parent);
410
+ foreach ($filelist as $file) {
411
+ if ($file != '.' and $file != '..') {
412
+ return false;
413
+ }
414
+ }
415
+
416
+ $this->recursive_remove($parent, true);
417
+ }
418
+ }
419
+
406
420
public function mkdir($file) {
407
421
$this->connection->mkdir($file);
408
422
logmessage("Created directory: $file");
409
423
}
410
424
411
425
public function unset_file($file) {
412
- $this->connection->delete ($file, true );
426
+ $this->recursive_remove ($file, false );
413
427
logmessage("Deleted: $file");
414
428
}
415
429
You can’t perform that action at this time.
0 commit comments