From b647e6e0006ff4ea959d4afa94875224879bdf7b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 17 Nov 2025 15:36:13 +0100 Subject: [PATCH] running hooks can be prevented by setting env var SEEDDMS_NO_EXTENSION_HOOKS --- utils/console | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/utils/console b/utils/console index ed7d3c0d8..b7aae03f2 100755 --- a/utils/console +++ b/utils/console @@ -62,12 +62,26 @@ $application->add(new RepositoryextensionCommand($settings, $logger, $translator $application->add(new UpdateextensionCommand($settings, $logger, $translator, $extmgr)); $application->add(new DownloadextensionCommand($settings, $logger, $translator, $extmgr)); -if(isset($GLOBALS['SEEDDMS_HOOKS']['console'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['console'] as $hookObj) { - if (method_exists($hookObj, 'addCommand')) { - $hookObj->addCommand($application, ['settings'=>$settings, 'logger'=>$logger, 'translator'=>$translator, 'extmgr'=>$extmgr]); +/* If extension are not compatible with the current version of + * SeedDMS anymore, calling the hooks may fail and exit this + * script. Hence there no change to even disable an extension with + * `utils/console ext:configure --name --disable` + * In such a case the last resort is to set the environment variable + * SEEDDMS_NO_EXTENSION_HOOKS to any value, which will prevent calling + * any hooks. + */ +if (false === getenv('SEEDDMS_NO_EXTENSION_HOOKS')) { + if (isset($GLOBALS['SEEDDMS_HOOKS']['console'])) { + foreach ($GLOBALS['SEEDDMS_HOOKS']['console'] as $hookObj) { + if (method_exists($hookObj, 'addCommand')) { + $hookObj->addCommand($application, ['settings'=>$settings, 'logger'=>$logger, 'translator'=>$translator, 'extmgr'=>$extmgr]); + } } } +} else { + echo "NOT RUNNING HOOKS\n\n"; } $application->run(); + +// vim: ts=4 sw=4 expandtab