From 2cbd30a16e1f56f6dc05d6aa0fc02f6d5d0acfbb Mon Sep 17 00:00:00 2001 From: Justin Beaty Date: Mon, 7 Oct 2024 13:46:04 -0700 Subject: [PATCH] health-check --- app/Mage.php | 2 +- lib/MahoCLI/Commands/HealthCheck.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Mage.php b/app/Mage.php index 22cf559ef..ad14ab798 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -41,7 +41,7 @@ $loader = require_once BP . '/vendor/autoload.php'; if ($loader->getUseIncludePath() === false) { - die('Run: composer config use-include-path true; composer dump;'); + die('Fatal error, please run: ./maho health-check'); } diff --git a/lib/MahoCLI/Commands/HealthCheck.php b/lib/MahoCLI/Commands/HealthCheck.php index 9f20ef571..9ea05ada2 100644 --- a/lib/MahoCLI/Commands/HealthCheck.php +++ b/lib/MahoCLI/Commands/HealthCheck.php @@ -28,6 +28,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int { $hasErrors = false; + // Check for use-include-path in composer.json + $output->write('Checking composer.json... '); + $loader = require MAHO_ROOT_DIR . '/vendor/autoload.php'; + if ($loader->getUseIncludePath() === true) { + $output->writeln('OK'); + } else { + $hasErrors = true; + $output->writeln(''); + $output->writeln('Error: Detected invalid composer.json config:'); + $output->writeln('Run: composer config use-include-path true; composer dump;'); + $output->writeln(''); + } + // Check for M1 core files $output->write('Checking Magento/OpenMage core... '); $folders = [