From 240562395ae526cecbe7db40213bbe8e06fd3493 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 21 Dec 2021 14:02:41 +0100 Subject: [PATCH] fix(install): check internal dependencies only before activation in some cases, it may be impossible to clean, install or upgrade the plugin --- setup.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/setup.php b/setup.php index 70f8ddfc0..cb241c1a3 100644 --- a/setup.php +++ b/setup.php @@ -92,14 +92,18 @@ function plugin_formcreator_check_prerequisites() { $prerequisitesSuccess = false; } - if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) { - echo "Run composer install --no-dev in the plugin directory
"; - $prerequisitesSuccess = false; - } + $plugin = new Plugin(); + $plugin->getFromDBbyDir('formcreator'); + if ($plugin->fields['state'] == Plugin::NOTACTIVATED) { + if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) { + echo "Run composer install --no-dev in the plugin directory
"; + $prerequisitesSuccess = false; + } - if (!is_readable(__DIR__ . '/lib/.yarn-integrity') || !is_file(__DIR__ . '/lib/.yarn-integrity')) { - echo "Run yarn install --prod in the plugin directory
"; - $prerequisitesSuccess = false; + if (!is_readable(__DIR__ . '/lib/.yarn-integrity') || !is_file(__DIR__ . '/lib/.yarn-integrity')) { + echo "Run yarn install --prod in the plugin directory
"; + $prerequisitesSuccess = false; + } } return $prerequisitesSuccess;