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 // 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 = &drupal_static('civicrm_initialize', FALSE);
22 $failure = &drupal_static('civicrm_initialize_failure', FALSE);
26 system_rebuild_module_data();
27 module_enable(array('civicrm', 'civicrmtheme'));
28 drupal_flush_all_caches();
29 civicrm_install_set_drupal_perms();
31 }, \Civi\Setup
::PRIORITY_LATE
- 50);
33 function civicrm_install_set_drupal_perms() {
34 if (!function_exists('db_select')) {
35 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)');
39 'access all custom data',
40 'access uploaded files',
41 'make online contributions',
45 'register for events',
47 'view event participants',
48 'access CiviMail subscribe/unsubscribe pages',
51 // Adding a permission that has not yet been assigned to a module by
52 // a hook_permission implementation results in a database error.
54 $allPerms = array_keys(module_invoke_all('permission'));
55 foreach (array_diff($perms, $allPerms) as $perm) {
57 'Cannot grant the %perm permission because it does not yet exist.',
58 array('%perm' => $perm),
62 $perms = array_intersect($perms, $allPerms);
63 user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID
, $perms);
64 user_role_grant_permissions(DRUPAL_ANONYMOUS_RID
, $perms);