MDL-36466 cache: improved handling of exceptions during initialisation.

This commit is contained in:
Sam Hemelryk
2012-11-26 08:11:59 +13:00
parent f42c34a38a
commit 7383a7e2a0
4 changed files with 127 additions and 13 deletions
+7 -3
View File
@@ -122,12 +122,15 @@ class cache_config {
/**
* Loads the configuration file and parses its contents into the expected structure.
*
* @param array|false $configuration Can be used to force a configuration. Should only be used when truly required.
* @return boolean
*/
public function load() {
public function load($configuration = false) {
global $CFG;
$configuration = $this->include_configuration();
if ($configuration === false) {
$configuration = $this->include_configuration();
}
$this->configstores = array();
$this->configdefinitions = array();
@@ -425,7 +428,8 @@ class cache_config {
*/
public function get_stores_for_definition(cache_definition $definition) {
// Check if MUC has been disabled.
if (defined('NO_CACHE_STORES') && NO_CACHE_STORES !== false) {
$factory = cache_factory::instance();
if ($factory->is_disabled()) {
// Yip its been disabled.
// To facilitate this we are going to always return an empty array of stores to use.
// This will force all cache instances to use the cachestore_dummy.