Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Security::database_is_ready() check are doing duplicate DB quer…

…ies for Members.

The will make sure that if the database has been ready once, it is ready for the rest of the request
  • Loading branch information...
commit a9509a610de28b96d2439e6d70bf5f3bc421a4fe 1 parent 5750eb0
Stig Lindqvist stojg authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 security/Security.php
11 security/Security.php
View
@@ -105,6 +105,14 @@ static function get_word_list() {
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
*
* @param string $wordListFile Location of word list file
@@ -800,6 +808,8 @@ static function encrypt_password($password, $salt = null, $algorithm = null, $me
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 @@ public static function database_is_ready() {
if($missingFields) return false;
}
+ self::$database_is_ready = true;
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.