Skip to content

Commit

Permalink
enable standaloneusers extension early in Standalone install
Browse files Browse the repository at this point in the history
  • Loading branch information
ufundo committed Feb 22, 2024
1 parent c005064 commit 071033b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions setup/plugins/init/StandaloneUsers.civi-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @file
*
* On "Standalone" UF, default policy is to enable `standaloneusers` and create user with admin role.
*
* Note: we need to enable 'standaloneusers' early, because it provides the session handler
*/

if (!defined('CIVI_SETUP')) {
Expand Down Expand Up @@ -32,6 +34,17 @@
$e->getModel()->extras = array_merge($defaults, $e->getModel()->extras);
});

\Civi\Setup::dispatcher()
->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent $e) {
if ($e->getModel()->cms !== 'Standalone') {
return;
}
Civi\Setup::log()->info('Enabling Standaloneusers extension early');
\civicrm_api3('Extension', 'enable', array(
'keys' => ['standaloneusers'],
));
}, \Civi\Setup::PRIORITY_MAIN - 150);

\Civi\Setup::dispatcher()
->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent $e) {
if ($e->getModel()->cms !== 'Standalone' || !in_array('standaloneusers', $e->getModel()->extensions)) {
Expand Down

0 comments on commit 071033b

Please sign in to comment.