5 * Finalize any extra CMS changes in Drupal.
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
!== 'Drupal') {
17 \Civi\Setup
::log()->info(sprintf('[%s] Flush CMS metadata', basename(__FILE__
)));
19 system_rebuild_module_data();
20 module_enable(array('civicrm', 'civicrmtheme'));
21 drupal_flush_all_caches();
22 civicrm_install_set_drupal_perms();
24 }, \Civi\Setup
::PRIORITY_LATE
- 50);
26 function civicrm_install_set_drupal_perms() {
27 if (!function_exists('db_select')) {
28 db_query('UPDATE {permission} SET perm = CONCAT( perm, \', access CiviMail subscribe/unsubscribe pages, access all custom data, access uploaded files, make online contributions, profile listings and forms, register for events, view event info, view event participants\') WHERE rid IN (1, 2)');
32 'access all custom data',
33 'access uploaded files',
34 'make online contributions',
38 'register for events',
40 'view event participants',
41 'access CiviMail subscribe/unsubscribe pages',
44 // Adding a permission that has not yet been assigned to a module by
45 // a hook_permission implementation results in a database error.
47 $allPerms = array_keys(module_invoke_all('permission'));
48 foreach (array_diff($perms, $allPerms) as $perm) {
50 'Cannot grant the %perm permission because it does not yet exist.',
51 array('%perm' => $perm),
55 $perms = array_intersect($perms, $allPerms);
56 user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID
, $perms);
57 user_role_grant_permissions(DRUPAL_ANONYMOUS_RID
, $perms);