Skip to content
Snippets Groups Projects
Commit c7386c8b authored by Jared Hancock's avatar Jared Hancock
Browse files

upgrade: Actually re-fetch the config from database

This patch fixes the issue where the configuration was not properly
reloaded during an upgrade. The configuration items were stashed in the
Config class and were not re-fetched from the ::load() method.
Additionally, this patch forces the ORM cached objects to be flushed on
each loop through the automated upgrader to ensure that cached data
which might have been modified directly in the database during the
database process is destroyed.
parent cf8af132
No related branches found
No related tags found
No related merge requests found
...@@ -30,10 +30,6 @@ class Config { ...@@ -30,10 +30,6 @@ class Config {
# new settings and the corresponding default values. # new settings and the corresponding default values.
var $defaults = array(); # List of default values var $defaults = array(); # List of default values
# Items
var $items = null;
function __construct($section=null, $defaults=array()) { function __construct($section=null, $defaults=array()) {
if ($section) if ($section)
$this->section = $section; $this->section = $section;
...@@ -133,18 +129,11 @@ class Config { ...@@ -133,18 +129,11 @@ class Config {
function destroy() { function destroy() {
unset($this->session); unset($this->session);
if ($this->items) return $this->items()->delete() > 0;
$this->items->delete();
return true;
} }
function items() { function items() {
return ConfigItem::items($this->section, $this->section_column);
if (!isset($this->items))
$this->items = ConfigItem::items($this->section, $this->section_column);
return $this->items;
} }
} }
......
...@@ -51,12 +51,12 @@ class CliUpgrader extends Module { ...@@ -51,12 +51,12 @@ class CliUpgrader extends Module {
$cfg = $ost->getConfig(); $cfg = $ost->getConfig();
while (true) { while (true) {
if ($upgrader->getTask()) { // If there's anythin in the model cache (like a Staff
// If there's anythin in the model cache (like a Staff // object or something), ensure that changes to the database
// object or something), ensure that changes to the database // model won't cause crashes
// model won't cause crashes ModelInstanceManager::flushCache();
ModelInstanceManager::flushCache();
if ($upgrader->getTask()) {
// More pending tasks - doTasks returns the number of pending tasks // More pending tasks - doTasks returns the number of pending tasks
$this->stdout->write("... {$upgrader->getNextAction()}\n"); $this->stdout->write("... {$upgrader->getNextAction()}\n");
$upgrader->doTask(); $upgrader->doTask();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment