silverstripe/sapphire — pull request #301 by stojg (2012-04-11 12:40:26+00:00)
Title: 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

If a member is logged in the following happens:

For the homepage three calls are made to Controller::init()

- RootURLController::handleRequest
- ModelAsController::handleRequest
- ContentController::init()

For typical non root pages it will only be two.

Every call to database_is_ready() will trigger the following queries:

SHOW FULL FIELDS IN "Member"
SHOW FULL FIELDS IN "Group"
SHOW FULL FIELDS IN "Permission"

My change is to assume that no db schema structures are made during runtime.