summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-08-16 08:54:12 -0300
committerRenato Botelho <renato@netgate.com>2017-08-16 11:03:12 -0300
commit439baa2a4b016769de90a1a9b7f9c9970f6387ac (patch)
tree4341f11a510fcae29f771b866687c5f94d073cef
parent3bf669d5337ac66e78397c1b238d287333d10736 (diff)
downloadpfsense-439baa2a4b016769de90a1a9b7f9c9970f6387ac.zip
pfsense-439baa2a4b016769de90a1a9b7f9c9970f6387ac.tar.gz
Check if specific config upgrade code already ran and skip it
-rw-r--r--src/etc/inc/config.lib.inc27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc
index 469cead..80e212d 100644
--- a/src/etc/inc/config.lib.inc
+++ b/src/etc/inc/config.lib.inc
@@ -450,17 +450,30 @@ function convert_config() {
if (file_exists("/etc/inc/upgrade_config_custom.inc")) {
include_once("upgrade_config_custom.inc");
}
+
+ if (!is_array($config['system']['already_run_config_upgrade'])) {
+ $config['system']['already_run_config_upgrade'] = array();
+ }
+ $already_run =& $config['system']['already_run_config_upgrade'];
+
/* Loop and run upgrade_VER_to_VER() until we're at current version */
while ($config['version'] < $g['latest_config']) {
$cur = $config['version'] * 10;
$next = $cur + 1;
- $migration_function = sprintf('upgrade_%03d_to_%03d', $cur, $next);
- if (function_exists($migration_function)) {
- $migration_function();
- }
- $migration_function = "{$migration_function}_custom";
- if (function_exists($migration_function)) {
- $migration_function();
+ $migration_function = sprintf('upgrade_%03d_to_%03d', $cur,
+ $next);
+
+ foreach (array("", "_custom") as $suffix) {
+ $migration_function .= $suffix;
+ if (!function_exists($migration_function)) {
+ continue;
+ }
+ if (isset($already_run[$migration_function])) {
+ /* Already executed, skip now */
+ unset($already_run[$migration_function]);
+ } else {
+ $migration_function();
+ }
}
$config['version'] = sprintf('%.1f', $next / 10);
if (platform_booting()) {
OpenPOWER on IntegriCloud