mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Better solution for previous commit. On Linux glob might return false. Check prior to casting to array.
From the PHP manual: on some systems it is impossible to distinguish between empty match and an error.
This commit is contained in:
@@ -96,10 +96,10 @@ class AdminPlugin extends Plugin
|
||||
|
||||
// check for existence of a user account
|
||||
$account_dir = $file_path = $this->grav['locator']->findResource('account://');
|
||||
$user_check = (array) glob($account_dir . '/*.yaml');
|
||||
$user_check = glob($account_dir . '/*.yaml');
|
||||
|
||||
// If no users found, go to register
|
||||
if (count($user_check) == 0 || (count($user_check) == 1 && reset($user_check) == false)) {
|
||||
if ($user_check == false || count((array)$user_check) == 0) {
|
||||
if (!$this->isAdminPath()) {
|
||||
$this->grav->redirect($this->base);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user