5 * Configure settings on the newly populated database.
8 if (!defined('CIVI_SETUP')) {
9 exit("Installation plugins must only be loaded by the installer.\n");
12 \Civi\Setup
::dispatcher()
13 ->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent
$e) {
14 if ($e->getModel()->cms
!== 'Backdrop') {
17 \Civi\Setup
::log()->info(sprintf('[%s] Flush CMS metadata', basename(__FILE__
)));
19 // If the admin activated the module first, and then ran web-based installer,
20 // then some hooks (eg hook_menu) may not fire until we fix this flag.
21 $initialized = &backdrop_static('civicrm_initialize', FALSE);
22 $failure = &backdrop_static('civicrm_initialize_failure', FALSE);
26 system_rebuild_module_data();
27 module_enable(array('civicrm', 'civicrmtheme'));
28 backdrop_flush_all_caches();
29 civicrm_install_set_backdrop_perms();
30 }, \Civi\Setup
::PRIORITY_LATE +
50);
32 function civicrm_install_set_backdrop_perms() {
34 'access all custom data',
35 'access uploaded files',
36 'make online contributions',
40 'register for events',
42 'view event participants',
43 'access CiviMail subscribe/unsubscribe pages',
46 // Adding a permission that has not yet been assigned to a module by
47 // a hook_permission implementation results in a database error.
49 $allPerms = array_keys(module_invoke_all('permission'));
50 foreach (array_diff($perms, $allPerms) as $perm) {
52 'Cannot grant the %perm permission because it does not yet exist.',
53 array('%perm' => $perm),
57 $perms = array_intersect($perms, $allPerms);
58 user_role_grant_permissions(BACKDROP_AUTHENTICATED_ROLE
, $perms);
59 user_role_grant_permissions(BACKDROP_ANONYMOUS_ROLE
, $perms);