From a41a290cf50a72361ceb43b46e478f697c5ec33f Mon Sep 17 00:00:00 2001 From: kingschnulli Date: Wed, 23 Sep 2026 16:37:10 +0200 Subject: [PATCH 1/6] Add repair for skipped Pimcore bundle installers --- scripts/repair-bundle-installers.php | 97 ++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 scripts/repair-bundle-installers.php diff --git a/scripts/repair-bundle-installers.php b/scripts/repair-bundle-installers.php new file mode 100644 index 0000000..2387226 --- /dev/null +++ b/scripts/repair-bundle-installers.php @@ -0,0 +1,97 @@ +#!/usr/bin/env php +getContainer(); + $repairedBundles = []; + + /** @var DataHubInstaller $dataHubInstaller */ + $dataHubInstaller = $container->get(DataHubInstaller::class); + + if ($dataHubInstaller->isInstalled() && dataHubInstallerArtifactsMissing()) { + fwrite(STDOUT, "Repairing PimcoreDataHubBundle installer state\n"); + $dataHubInstaller->install(); + $repairedBundles[] = 'PimcoreDataHubBundle'; + } + + /** @var DataImporterInstaller $dataImporterInstaller */ + $dataImporterInstaller = $container->get(DataImporterInstaller::class); + /** @var ApplicationLoggerInstaller $applicationLoggerInstaller */ + $applicationLoggerInstaller = $container->get(ApplicationLoggerInstaller::class); + + $dataImporterPermissionMissing = + Definition::getByKey(DataImporterInstaller::DATAHUB_ADAPTER_PERMISSION) === null; + + if ( + $dataImporterInstaller->isInstalled() + && ($dataImporterPermissionMissing || !$applicationLoggerInstaller->isInstalled()) + ) { + fwrite(STDOUT, "Repairing PimcoreDataImporterBundle installer state\n"); + $dataImporterInstaller->install(); + $repairedBundles[] = 'PimcoreDataImporterBundle'; + } + + if ($repairedBundles !== []) { + Cache::remove('studio_backend_user_permissions'); + fwrite( + STDOUT, + sprintf( + "Repaired bundle installer state: %s; cleared studio_backend_user_permissions\n", + implode(', ', $repairedBundles) + ) + ); + } else { + fwrite(STDOUT, "Bundle installer state is consistent; no repair required\n"); + } +} finally { + $kernel->shutdown(); +} + +function dataHubInstallerArtifactsMissing(): bool +{ + if (Definition::getByKey(DataHubInstaller::CONFIG_NAME) === null) { + return true; + } + + $db = Db::get(); + + foreach (['document', 'asset', 'object'] as $type) { + $table = 'plugin_datahub_workspaces_' . $type; + $exists = (int) $db->fetchOne( + 'SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = ?', + [$table] + ); + + if ($exists === 0) { + return true; + } + } + + return false; +} From ec543025125209cddc0095442422b8953f7fdd93 Mon Sep 17 00:00:00 2001 From: kingschnulli Date: Wed, 23 Sep 2026 16:37:44 +0200 Subject: [PATCH 2/6] Install Pimcore bundles before Doctrine migrations --- scripts/setup.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 159564f..92fc80a 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -205,7 +205,10 @@ install -d -o developer -g www-data -m 0775 \ chmod -R g+rwX "$app_dir/var" "$app_dir/public/var" +pimcore_was_installed=0 + if is_pimcore_installed; then + pimcore_was_installed=1 printf '%s\n' '==> Pimcore core already installed' else : "${PIMCORE_PRODUCT_KEY:?PIMCORE_PRODUCT_KEY is required for the initial Pimcore installation}" @@ -219,16 +222,18 @@ else run_dev env \ PIMCORE_APP_BUNDLES=0 \ vendor/bin/pimcore-install \ - --install-profile='App\Installer\SkeletonProfile' \ + --install-profile='App\\Installer\\SkeletonProfile' \ --no-interaction ) fi -printf '%s\n' '==> Warming development container' -run_console cache:warmup - -printf '%s\n' '==> Running Doctrine migrations' -run_console doctrine:migrations:migrate --no-interaction +if (( pimcore_was_installed )); then + printf '%s\n' '==> Checking legacy bundle installer state' + ( + cd "$app_dir" + run_dev php /opt/aggro/repair-bundle-installers.php + ) +fi printf '%s\n' '==> Installing application bundles' install_bundle PimcoreDataHubBundle @@ -239,7 +244,7 @@ install_bundle AggrosoftPimcoreShopwareBundle install_bundle AggrosoftPimcoreShirtnetworkBundle install_bundle AggrosoftPimcoreAgentBundle -printf '%s\n' '==> Running remaining migrations' +printf '%s\n' '==> Running Doctrine migrations' run_console doctrine:migrations:migrate --no-interaction printf '%s\n' '==> Applying idempotent application model upgrades' From 563ff26b7ba2502dd96fd52d0366552d238e19d1 Mon Sep 17 00:00:00 2001 From: kingschnulli Date: Wed, 23 Sep 2026 16:37:59 +0200 Subject: [PATCH 3/6] Test Pimcore setup installation order --- tests/setup-order-test.php | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/setup-order-test.php diff --git a/tests/setup-order-test.php b/tests/setup-order-test.php new file mode 100644 index 0000000..6628260 --- /dev/null +++ b/tests/setup-order-test.php @@ -0,0 +1,50 @@ + Date: Wed, 23 Sep 2026 16:38:06 +0200 Subject: [PATCH 4/6] Validate bundle repair and setup ordering --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2e857c..4af1770 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,8 +30,10 @@ jobs: bash -n scripts/composer-wrapper.sh bash -n scripts/setup.sh php -l scripts/generate-dev-composer.php + php -l scripts/repair-bundle-installers.php php -l scripts/verify-dev-composer-lock.php php tests/generate-dev-composer-test.php + php tests/setup-order-test.php build: needs: validate From dad12a7f3343af36cbf9525e31272ba20d13518a Mon Sep 17 00:00:00 2001 From: kingschnulli Date: Wed, 23 Sep 2026 16:38:48 +0200 Subject: [PATCH 5/6] Fix Pimcore install profile class escaping --- scripts/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 92fc80a..ff88f60 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -222,7 +222,7 @@ else run_dev env \ PIMCORE_APP_BUNDLES=0 \ vendor/bin/pimcore-install \ - --install-profile='App\\Installer\\SkeletonProfile' \ + --install-profile='App\Installer\SkeletonProfile' \ --no-interaction ) fi From d9ea8ce6b54e2103ae3e74d6006d94c17e06fe1a Mon Sep 17 00:00:00 2001 From: kingschnulli Date: Wed, 23 Sep 2026 16:41:12 +0200 Subject: [PATCH 6/6] Keep cache warmup before bundle installation --- scripts/setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/setup.sh b/scripts/setup.sh index ff88f60..ad17451 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -227,6 +227,9 @@ else ) fi +printf '%s\n' '==> Warming development container' +run_console cache:warmup + if (( pimcore_was_installed )); then printf '%s\n' '==> Checking legacy bundle installer state' (