[setup] have ConfigSaveEvent save the config

This commit is contained in:
Shish 2024-06-18 17:02:36 +01:00 committed by Shish
parent f69d5a297f
commit 68d87e3a84
2 changed files with 1 additions and 6 deletions

View file

@ -344,7 +344,6 @@ class Setup extends Extension
$this->theme->display_page($page, $panel); $this->theme->display_page($page, $panel);
} elseif ($event->page_matches("setup/save", method: "POST", permission: Permissions::CHANGE_SETTING)) { } elseif ($event->page_matches("setup/save", method: "POST", permission: Permissions::CHANGE_SETTING)) {
send_event(new ConfigSaveEvent($config, $event->POST)); send_event(new ConfigSaveEvent($config, $event->POST));
$config->save();
$page->flash("Config saved"); $page->flash("Config saved");
$page->set_mode(PageMode::REDIRECT); $page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("setup")); $page->set_redirect(make_link("setup"));
@ -407,11 +406,8 @@ class Setup extends Extension
} }
} }
} }
$config->save();
log_warning("setup", "Configuration updated"); log_warning("setup", "Configuration updated");
foreach (\Safe\glob("data/cache/*.css") as $css_cache) {
unlink($css_cache);
}
log_warning("setup", "Cache cleared");
} }
public function onCliGen(CliGenEvent $event): void public function onCliGen(CliGenEvent $event): void

View file

@ -149,7 +149,6 @@ class UserConfig extends Extension
$target_config = UserConfig::get_for_user($duser->id); $target_config = UserConfig::get_for_user($duser->id);
send_event(new ConfigSaveEvent($target_config, $event->POST)); send_event(new ConfigSaveEvent($target_config, $event->POST));
$target_config->save();
$page->flash("Config saved"); $page->flash("Config saved");
$page->set_mode(PageMode::REDIRECT); $page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("user_config")); $page->set_redirect(make_link("user_config"));