Skip to content

Commit

Permalink
Fix bootstrap chicken and egg condition #50
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed Jun 12, 2024
1 parent 7f7e90b commit 7a857e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
21 changes: 10 additions & 11 deletions classes/cache_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,22 @@ private function generate_config_array(): array {
// Generate locks.
$locks = $this->generate_locks();

// Get the siteidentifier. Copies pattern from cache_config.
// Uses 'forcedcache' if not known.
if (!empty($CFG->siteidentifier)) {
$siteidentifier = md5((string) $CFG->siteidentifier);
} else {
$siteidentifier = 'forcedcache';
}

// Throw it all into an array and return.
return array(
'siteidentifier' => $siteidentifier,
$config = [
'stores' => $stores,
'modemappings' => $modemappings,
'definitions' => $definitions,
'definitionmappings' => $definitionmappings,
'locks' => $locks
);
];

// Get the siteidentifier. Copies pattern from cache_config.
if (!empty($CFG->siteidentifier)) {
$config['siteidentifier'] = md5((string) $CFG->siteidentifier);
}

return $config;

}

/**
Expand Down
6 changes: 5 additions & 1 deletion classes/cache_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public function create_config_instance($writer = false) {
$this->configs[$class]->load();
}

$this->set_state(self::STATE_READY);
if (empty($CFG->siteidentifier)) {
$this->set_state(self::STATE_STORES_DISABLED);
} else {
$this->set_state(self::STATE_READY);
}

// Return the instance.
return $this->configs[$class];
Expand Down

0 comments on commit 7a857e4

Please sign in to comment.