Merge pull request #301 from stojg/database-is-ready-checks

MINOR Security::database_is_ready() check are doing duplicate DB queries...
This commit is contained in:
Ingo Schommer 2012-04-11 06:38:22 -07:00
commit aed5e93da2

View File

@ -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
*
@ -801,6 +809,8 @@ class Security extends Controller {
// 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';
$requiredTables[] = 'Permission';
@ -822,6 +832,7 @@ class Security extends Controller {
if($missingFields) return false;
}
self::$database_is_ready = true;
return true;
}