Skip to content

Commit e0da232

Browse files
author
ChenCatherine
committed
Make shares folder become optional when private folder is enabled.
1 parent 115a365 commit e0da232

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/config/lfm.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
// If true, private folders will be created for each signed-in user.
2727
'allow_multi_user' => true,
28+
// If true, share folder will be created when allow_multi_user is true.
29+
'allow_share_folder' => true,
2830

2931
// The database column to identify a user. Make sure the value is unique.
3032
// Ex: When set to 'id', the private folder of user will be named as the user id.
@@ -104,11 +106,10 @@
104106
| Image / Folder Setting
105107
|--------------------------------------------------------------------------
106108
*/
107-
109+
108110
'thumb_img_width' => 200,
109111
'thumb_img_height' => 200,
110112

111-
112113
/*
113114
|--------------------------------------------------------------------------
114115
| File Extension Information

src/controllers/FolderController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getFolders()
2222
$folder_types['user'] = 'root';
2323
}
2424

25-
if (true) {
25+
if (parent::allowMultiUser() && parent::enabledShareFolder()) {
2626
$folder_types['share'] = 'shares';
2727
}
2828

src/middlewares/CreateDefaultFolder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ private function checkDefaultFolderExists($type = 'share')
2323
return;
2424
}
2525

26+
if ($type === 'share' && (!$this->enabledShareFolder() || !$this->allowMultiUser())) {
27+
return;
28+
}
29+
2630
$path = $this->getRootFolderPath($type);
2731

2832
$this->createFolderByPath($path);

src/traits/LfmHelpers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ public function allowMultiUser()
226226
return config('lfm.allow_multi_user') === true;
227227
}
228228

229+
public function enabledShareFolder()
230+
{
231+
return config('lfm.allow_share_folder') === true;
232+
}
233+
229234

230235
/****************************
231236
*** File System ***

0 commit comments

Comments
 (0)