getEditable('linkchecker.settings')->set('error.impersonate_account', $linkchecker_default_impersonate_account->getAccountName())->save(); } /** * Implements hook_schema(). */ function linkchecker_schema() { $schema['linkchecker_block_custom'] = array( 'description' => 'Stores all link references for custom blocks.', 'fields' => array( 'bid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {block_custom}.bid.', ), 'lid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {linkchecker_link}.lid.', ), ), 'primary key' => array('bid', 'lid'), 'foreign keys' => array( 'bid' => array( 'table' => 'block_custom', 'columns' => array('bid' => 'bid'), ), 'lid' => array( 'table' => 'linkchecker_link', 'columns' => array('lid' => 'lid'), ), ), 'indexes' => array('lid' => array('lid')), ); $schema['linkchecker_comment'] = array( 'description' => 'Stores all link references for comments.', 'fields' => array( 'cid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {comment}.cid.', ), 'lid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {linkchecker_link}.lid.', ), ), 'primary key' => array('cid', 'lid'), 'foreign keys' => array( 'cid' => array( 'table' => 'comment', 'columns' => array('cid' => 'cid'), ), 'lid' => array( 'table' => 'linkchecker_link', 'columns' => array('lid' => 'lid'), ), ), 'indexes' => array('lid' => array('lid')), ); $schema['linkchecker_node'] = array( 'description' => 'Stores all link references for nodes.', 'fields' => array( 'nid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {node}.nid.', ), 'lid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Primary Key: Unique {linkchecker_link}.lid.', ), ), 'primary key' => array('nid', 'lid'), 'foreign keys' => array( 'nid' => array( 'table' => 'node', 'columns' => array('nid' => 'nid'), ), 'lid' => array( 'table' => 'linkchecker_link', 'columns' => array('lid' => 'lid'), ), ), 'indexes' => array('lid' => array('lid')), ); $schema['linkchecker_link'] = array( 'description' => 'Stores all links.', 'fields' => array( 'lid' => array( 'type' => 'serial', 'not null' => TRUE, 'description' => 'Primary Key: Unique link ID.', ), 'urlhash' => array( 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'description' => 'The indexable hash of the {linkchecker_link}.url.', ), 'url' => array( 'type' => 'text', 'not null' => TRUE, 'description' => 'The full qualified link.', ), 'method' => array( 'type' => 'varchar', 'length' => 4, 'default' => 'HEAD', 'not null' => TRUE, 'description' => 'The method for checking links (HEAD, GET, POST).', ), 'code' => array( 'type' => 'int', 'not null' => TRUE, 'default' => -1, 'description' => 'HTTP status code from link checking.', ), 'error' => array( 'type' => 'text', 'not null' => FALSE, 'description' => 'The error message received from the remote server while doing link checking.', ), 'fail_count' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'Fail count of unsuccessful link checks. No flapping detection. (Successful = 0, Unsuccessful = fail_count+1).', ), 'last_checked' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => 'Timestamp of the last link check.', ), 'status' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 1, 'description' => 'Boolean indicating if a link should be checked or not.', ), ), 'primary key' => array('lid'), 'unique keys' => array('urlhash' => array('urlhash')), 'indexes' => array( 'method' => array('method'), 'code' => array('code'), 'fail_count' => array('fail_count'), 'last_checked' => array('last_checked'), 'status' => array('status'), ), ); return $schema; } /** * Implements hook_modules_uninstalled(). * * If the core modules are disabled the integration need to be disabled. */ function linkchecker_modules_uninstalled($modules) { // Disable link checks for custom blocks. if (in_array('block', $modules)) { \Drupal::config('linkchecker.settings')->set('scan_blocks', 0); drupal_set_message(t('Link checks for blocks have been disabled.')); } // Disable link checks for comments. if (in_array('comment', $modules)) { foreach (node_type_get_names() as $type => $name) { // @fixme: This is incorrect. The variable is inside node.type.*.third_party.linkchecker //\Drupal::config('node.type.' . $type . '.third_party.linkchecker')->clear('scan_comment'); //\Drupal::service('config.manager'); //$type->unsetThirdPartySetting('linkchecker', 'scan_comment', $form_state->getValue('scan_comment')); } drupal_set_message(t('Link checks for comments have been disabled.')); } }