Skip to content

Commit

Permalink
10.5: [Installer] Allow the installer to force a sync of bundled asse…
Browse files Browse the repository at this point in the history
…ts (automations, packages, resources, workflows).
  • Loading branch information
jstanden committed Sep 6, 2024
1 parent 52a04e2 commit a44e3ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions api/Application.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ static function update() {
return TRUE;
}

static function initBundledResources() {
static function initBundledResources($force=false) {
// Load packages
if(0 == DAO_PackageLibrary::count()) {
if($force || 0 == DAO_PackageLibrary::count()) {
$dir = new RecursiveDirectoryIterator(realpath(APP_PATH . '/features/cerberusweb.core/packages/library/'));
$iter = new RecursiveIteratorIterator($dir);
$regex = new RegexIterator($iter, '/^.+\.json/i', RecursiveRegexIterator::GET_MATCH);
Expand All @@ -604,7 +604,7 @@ static function initBundledResources() {
}

// Load automations
if(0 == DAO_Automation::count()) {
if($force || 0 == DAO_Automation::count()) {
$dir = new DirectoryIterator(realpath(APP_PATH . '/features/cerberusweb.core/assets/automations/'));
$iter = new IteratorIterator($dir);
$regex = new RegexIterator($iter, '/^.+\.json/i', RegexIterator::MATCH);
Expand All @@ -620,7 +620,7 @@ static function initBundledResources() {
}

// Load resources
if(0 == DAO_Resource::count()) {
if($force || 0 == DAO_Resource::count()) {
$dir = new DirectoryIterator(realpath(APP_PATH . '/features/cerberusweb.core/assets/resources/'));
$iter = new IteratorIterator($dir);
$regex = new RegexIterator($iter, '/^.+\.json/i', RegexIterator::MATCH);
Expand All @@ -636,7 +636,7 @@ static function initBundledResources() {
}

// Init tutorial
if(!DAO_Workflow::getByName('cerb.tutorial')) {
if($force || !DAO_Workflow::getByName('cerb.tutorial')) {
$error = null;
$new_workflow = new Model_Workflow();
$new_workflow->name = 'cerb.tutorial';
Expand Down
2 changes: 1 addition & 1 deletion install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ function cerbInstallerCheckWriteablePath($path) {
$contents = sprintf('<?php define(\'APP_BUILD_CACHED\', %s);', APP_BUILD);
file_put_contents($path, $contents);

CerberusApplication::initBundledResources();
CerberusApplication::initBundledResources(force: true);

// Success
$tpl->assign('step', STEP_OUTGOING_MAIL);
Expand Down

0 comments on commit a44e3ab

Please sign in to comment.