123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <?php
- use Drupal\Core\Field\BaseFieldDefinition;
- use Drupal\user\RoleInterface;
- function heartbeat_requirements($phase) {
- $requirements = array();
- if ($phase === 'runtime') {
-
-
-
- $grant_count = \Drupal::entityManager()->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. <a href=":rebuild">Rebuild permissions</a>', array(
- ':rebuild' => \Drupal::url('node.configure_rebuild_confirm'),
- )),
- );
- }
- return $requirements;
- }
- function heartbeat_schema() {
- $schema['heartbeat_friendship'] = array(
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'uid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'uid_target' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- 'default' => 0,
- ),
- 'status' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'size' => 'tiny',
- 'default' => -1,
- ),
- 'created' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'uid_relation' => array('uid', 'uid_target')
- )
- );
- $schema['heartbeat_term_usage'] = array(
- 'fields' => array(
- 'id' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'tid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'timestamp' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- ),
- 'primary key' => array('id'),
- 'unique keys' => array(
- 'tid_use' => array('tid', 'timestamp')
- )
- );
-
- 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.',
- ),
- ),
- );
- }
- function heartbeat_uninstall() {
- $entities = \Drupal::service("entity.query")->get("heartbeat")->execute();
- foreach($entities as $entity) {
- $heartbeat = \Drupal::service("entity_type.manager")->getStorage("heartbeat")->load($entity);
- $heartbeat->delete();
- }
- $entities = \Drupal::service("entity.query")->get("heartbeat_stream")->execute();
- foreach($entities as $entity) {
- $heartbeat = \Drupal::service("entity_type.manager")->getStorage("heartbeat_stream")->load($entity);
- $heartbeat->delete();
- }
- }
|