Add config migrator to the update tab

This commit is contained in:
Belle Aerni committed 2022-10-28 20:41:23 -07:00
1 parent b8b59261d0
commit 625dfcf8aa
3 files changed
+40 -1

No files matched your search

+11 -1
View File
@@ -150,7 +150,7 @@ class Box_Update
}
//Migrate the configuration file
$this->di['tools']->updateConfig();
$this->performConfigUpdate();
// clean up things
$this->di['tools']->emptyFolder(BB_PATH_CACHE);
@@ -158,4 +158,14 @@ class Box_Update
rmdir(BB_PATH_ROOT.'/install');
return true;
}
/**
* Perform config file update
*
* @throws Exception
*/
public function performConfigUpdate()
{
return $this->di['tools']->updateConfig();
}
}
+18
View File
@@ -111,6 +111,24 @@ class Admin extends \Api_Abstract
return true;
}
/**
* Update FOSSBilling config.
*
* @return bool
*
* @throws Box_Exception
* @throws Exception
*/
public function update_config($data)
{
$updater = $this->di['updater'];
$updater->performConfigUpdate();
$this->di['logger']->info('Updated FOSSBilling config');
return true;
}
/**
* Update existing extension.
*
@@ -109,6 +109,17 @@
</a>
<hr>
<h3>{{ 'Migrate configuration file'|trans }}</h3>
<p class="text-muted">{{ 'Use this too to automatically migrate your configuration file to be compatible with the latest FOSSBilling changes. Note: this is only needed when performing manual updates'|trans }}</p>
<a href="{{ 'api/admin/extension/update_config'|link }}" class="btn btn-primary api-link" data-api-confirm="If you run into any issues, you can revert to the old config with will be saved as bb-config.php.old." data-api-msg="Migration complete">
<svg class="icon">
<use xlink:href="#refresh" />
</svg>
{{ 'Migrate configuration'|trans }}
</a>
<hr>
<h3>{{ 'Manual update'|trans }}</h3>
<p>{{ 'Manual update is a solution when auto updater can not work on current installation environment'|trans }}</p>