mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Security::database_is_ready() check are doing duplicate DB queries for Members.
The will make sure that if the database has been ready once, it is ready for the rest of the request
This commit is contained in:
parent
5750eb02b1
commit
a9509a610d
@ -104,6 +104,14 @@ class Security extends Controller {
|
||||
*/
|
||||
static $force_database_is_ready = null;
|
||||
|
||||
/**
|
||||
* When the database has once been verified as ready, it will not do the
|
||||
* checks again.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $database_is_ready = false;
|
||||
|
||||
/**
|
||||
* Set location of word list file
|
||||
*
|
||||
@ -800,6 +808,8 @@ class Security extends Controller {
|
||||
public static function database_is_ready() {
|
||||
// Used for unit tests
|
||||
if(self::$force_database_is_ready !== NULL) return self::$force_database_is_ready;
|
||||
|
||||
if(self::$database_is_ready) return self::$database_is_ready;
|
||||
|
||||
$requiredTables = ClassInfo::dataClassesFor('Member');
|
||||
$requiredTables[] = 'Group';
|
||||
@ -822,6 +832,7 @@ class Security extends Controller {
|
||||
|
||||
if($missingFields) return false;
|
||||
}
|
||||
self::$database_is_ready = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user