getAccessControlHandler('node')->countGrants(); if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) { $value = \Drupal::translation()->formatPlural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count)); } else { $value = t('Disabled'); } $requirements['node_access'] = array( 'title' => t('Node Access Permissions'), 'value' => $value, 'description' => t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. Rebuild permissions', array( ':rebuild' => \Drupal::url('node.configure_rebuild_confirm'), )), ); } return $requirements; } /** * Implements hook_schema(). * ** //TODO Have not yet set export schema for CTOOLS as CTOOLS is not yet a part of Drupal 8 */ function heartbeat8_schema() { $schema['heartbeat_messages'] = array( 'description' => 'Table that contains predefined messages that can be used in heartbeat views.', 'fields' => array( 'hid' => array( 'description' => 'Primary Key: Unique heartbeat_messages event ID.', 'type' => 'serial', 'not null' => TRUE, ), 'message_id' => array( 'description' => 'The message id which is unique to identify activity.', 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => '', ), 'description' => array( 'description' => 'Description and help text', 'type' => 'text', 'not null' => FALSE, 'size' => 'big' ), 'message' => array( 'type' => 'text', 'not null' => TRUE, 'size' => 'big', 'description' => 'Text of log message to be passed into the ) function.', //'alias' => 'message_orig', // Internal heartbeat field/property ), 'message_concat' => array( 'type' => 'text', 'not null' => TRUE, 'size' => 'big', 'description' => 'Text of translatable log message for in concatenated form.', //'alias' => 'message_concat_orig', // Internal heartbeat field/property ), 'perms' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 4, 'description' => 'Permissions for this message.', ), 'group_type' => array( 'type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'single', 'description' => 'The group type of the template', ), 'concat_args' => array( 'description' => 'Arguments for concatenation message.', 'type' => 'blob', 'serialize' => TRUE, 'not null' => FALSE, ), 'variables' => array( 'description' => 'Variables to parse into the message (used in message).', 'type' => 'blob', 'serialize' => TRUE, 'not null' => FALSE, ), 'attachments' => array( 'description' => 'Attachments on messages.', 'type' => 'blob', 'serialize' => TRUE, 'not null' => FALSE, ), ), 'primary key' => array('hid'), 'indexes' => array( 'message_id' => array('message_id'), ), ); $schema['heartbeat_activity'] = array( 'description' => 'Table that contains logs of all user triggerable actions.', 'fields' => array( 'uaid' => array( 'type' => 'serial', 'not null' => TRUE, 'description' => 'Primary Key: Unique heartbeat_activity event ID.', ), 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The {users}.uid of the user who triggered the event (requester).', ), 'uid_target' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0, 'description' => 'The target User ID', ), 'nid' => array( 'description' => 'The Node ID.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, ), 'nid_target' => array( 'description' => 'The target Node ID (E.g. Group id, node reference, ...).', 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, ), 'cid' => array( 'description' => 'The target comment ID (optional).', 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, ), 'access' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'tiny', 'description' => 'Access for this message to others.', 'default' => 0, ), 'message_id' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => '', 'description' => 'The message id which links to the heartbeat message.', ), 'timestamp' => array( 'description' => 'The activity\'s unix timestamp when action occurred', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'language' => array( 'type' => 'varchar', 'length' => 12, 'not null' => FALSE, 'default' => 'en', 'description' => 'language for a log".', ), 'variables' => array( 'type' => 'text', 'not null' => FALSE, 'size' => 'big', 'description' => 'Serialized array of variables that match the message string and that is passed into the ) function.', ), 'in_group' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'big', 'description' => 'Indicates whether the activity is related to a group', 'default' => 0, ), ), 'primary key' => array('uaid'), 'indexes' => array( 'timestamp' => array('timestamp'), 'uid' => array('uid'), 'message_id' => array('message_id'), 'uid_target' => array('uid_target'), 'nid' => array('nid'), 'nid_target' => array('nid_target'), 'cid' => array('cid'), 'language' => array('language'), ), ); $schema['heartbeat_activity']['fields']['in_group'] = array( 'type' => 'int', 'not null' => TRUE, 'size' => 'big', 'description' => 'Indicates whether the activity is related to a group.', 'default' => 0, ); $schema['heartbeat_activity']['indexes']['in_group'] = array('in_group'); $schema['heartbeat_user_templates'] = heartbeat_install_table_user_templates(); $schema['heartbeat_streams'] = array( 'description' => 'Table that contains heartbeat streams.', // CTools export definitions. // 'export' => array( // 'key' => 'class', // 'key name' => 'name', // 'primary key' => 'class', // 'bulk export' => TRUE, // 'identifier' => 'heartbeatstream', // 'object' => 'HeartbeatStreamConfig', // 'default hook' => 'heartbeat_stream_info', // 'load callback' => '_heartbeat_stream_config_load', // 'load all callback' => '_heartbeat_stream_config_load_all', // 'can disable' => TRUE, // 'api' => array( // 'owner' => 'heartbeat', // 'api' => 'heartbeat', // 'minimum_version' => 1, // 'current_version' => 1, // ), // ), 'fields' => array( 'class' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'Class of the stream to load.', ), 'real_class' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'Real Class of the stream to load.', ), 'name' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'Name of the stream. Cloned streams will have the same object but same cla ss.', ), 'module' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'The module that defines the class and where the query builder is located. ', ), 'title' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'Human readable name of the stream.', ), 'path' => array( 'type' => 'varchar', 'length' => 250, 'not null' => TRUE, 'default' => '', 'description' => 'Path to the stream object.', ), 'settings' => array( 'description' => 'Serialized settings for this stream.', 'type' => 'blob', 'serialize' => TRUE, 'not null' => FALSE, ), 'variables' => array( 'description' => 'Variables to parse into the message (used in message).', 'type' => 'blob', 'serialize' => TRUE, 'not null' => FALSE, ), 'real_class' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'default' => '', 'description' => 'Real Class of the stream to load', ) ), 'primary key' => array('class'), 'indexes' => array( 'name' => array('name'), ), ); //TODO determine if these foreign keys are to be added // db_add_unique_key('heartbeat_activity', 'uaid', array('uaid')); // db_add_unique_key('heartbeat_activity', 'uaid_uid', array('uaid', 'uid')); // db_add_unique_key('heartbeat_activity', 'uaid_nid', array('uaid', 'nid')); // db_add_unique_key('heartbeat_activity', 'uaid_uid_nid', array('uaid', 'uid', 'nid')) return $schema; } function heartbeat_install_table_user_templates() { return array( 'description' => 'Table that connects translations of the same activity.', 'fields' => array( 'uid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'The referenced user ID.', ), 'message_id' => array( 'type' => 'varchar', 'length' => 250, 'not null' => FALSE, 'default' => '', 'description' => 'The template message ID.', ), 'status' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'The status of the template.', ), ), ); }