2 if (!defined('CIVI_SETUP')) {
3 exit("Installation plugins must only be loaded by the installer.\n");
6 \Civi\Setup
::dispatcher()
7 ->addListener('civi.setupui.run', function (\Civi\Setup\UI\Event\UIBootEvent
$e) {
9 \Civi\Setup
::log()->info(sprintf('[%s] Parse inputs', basename(__FILE__
)));
12 * @var \Civi\Setup\UI\SetupController $ctrl
14 $ctrl = $e->getCtrl();
15 $values = $e->getField('advanced', array());
17 $placeholderDb = 'mysql://USER:PASS@HOST/DB';
19 if (empty($values['db']) ||
$values['db'] === $placeholderDb) {
20 $e->getModel()->extras
['advanced']['db'] = $placeholderDb;
23 $e->getModel()->extras
['advanced']['db'] = trim($values['db']);
24 $e->getModel()->db
= \Civi\Setup\DbUtil
::parseDsn(trim($values['db']));
27 }, \Civi\Setup
::PRIORITY_LATE
);
29 \Civi\Setup
::dispatcher()
30 ->addListener('civi.setupui.boot', function (\Civi\Setup\UI\Event\UIBootEvent
$e) {
31 \Civi\Setup
::log()->info(sprintf('[%s] Register blocks', basename(__FILE__
)));
34 * @var \Civi\Setup\UI\SetupController $ctrl
36 $ctrl = $e->getCtrl();
38 $ctrl->blocks
['advanced'] = array(
40 'file' => __DIR__
. DIRECTORY_SEPARATOR
. 'advanced.tpl.php',
44 }, \Civi\Setup
::PRIORITY_PREPARE
);