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 system_rebuild_module_data();
20 module_enable(array('civicrm', 'civicrmtheme'));
21 backdrop_flush_all_caches();
22 civicrm_install_set_backdrop_perms();
23 }, \Civi\Setup
::PRIORITY_LATE +
50);
25 function civicrm_install_set_backdrop_perms() {
27 'access all custom data',
28 'access uploaded files',
29 'make online contributions',
33 'register for events',
35 'view event participants',
36 'access CiviMail subscribe/unsubscribe pages',
39 // Adding a permission that has not yet been assigned to a module by
40 // a hook_permission implementation results in a database error.
42 $allPerms = array_keys(module_invoke_all('permission'));
43 foreach (array_diff($perms, $allPerms) as $perm) {
45 'Cannot grant the %perm permission because it does not yet exist.',
46 array('%perm' => $perm),
50 $perms = array_intersect($perms, $allPerms);
51 user_role_grant_permissions(BACKDROP_AUTHENTICATED_ROLE
, $perms);
52 user_role_grant_permissions(BACKDROP_ANONYMOUS_ROLE
, $perms);