Skip to content

Commit 47bd460

Browse files
committed
create directoryIsEmpty() in LfmHelper
1 parent 52c06ff commit 47bd460

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/controllers/DeleteController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getDelete()
2929
}
3030

3131
if (File::isDirectory($file_to_delete)) {
32-
if (sizeof(File::files($file_to_delete)) != 0) {
32+
if (!parent::directoryIsEmpty($file_to_delete)) {
3333
return $this->error('delete-folder');
3434
}
3535

src/traits/LfmHelpers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ public function createFolderByPath($path)
174174
}
175175
}
176176

177+
public function directoryIsEmpty($directory_path)
178+
{
179+
return count(File::allFiles($directory_path)) == 0;
180+
}
181+
177182

178183
/****************************
179184
*** Miscellaneouses ***

0 commit comments

Comments
 (0)