*/
function linkchecker_install() {
$linkchecker_default_impersonate_account = User::load(1);
- \Drupal::configFactory()->getEditable('linkchecker.settings')->set('error.impersonate_account', $linkchecker_default_impersonate_account->getAccountName())->save();
+ \Drupal::configFactory()->getEditable('linkchecker.settings')->set(
+ 'error.impersonate_account',
+ $linkchecker_default_impersonate_account->getAccountName()
+ )->save();
}
/**
*/
function linkchecker_schema() {
- $schema['linkchecker_block_custom'] = array(
+ $schema['linkchecker_block_custom'] = [
'description' => 'Stores all link references for custom blocks.',
- 'fields' => array(
- 'bid' => array(
+ 'fields' => [
+ 'bid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {block_custom}.bid.',
- ),
- 'lid' => array(
+ ],
+ 'lid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {linkchecker_link}.lid.',
- ),
- ),
- 'primary key' => array('bid', 'lid'),
- 'foreign keys' => array(
- 'bid' => array(
+ ],
+ ],
+ 'primary key' => ['bid', 'lid'],
+ 'foreign keys' => [
+ 'bid' => [
'table' => 'block_custom',
- 'columns' => array('bid' => 'bid'),
- ),
- 'lid' => array(
+ 'columns' => ['bid' => 'bid'],
+ ],
+ 'lid' => [
'table' => 'linkchecker_link',
- 'columns' => array('lid' => 'lid'),
- ),
- ),
- 'indexes' => array('lid' => array('lid')),
- );
+ 'columns' => ['lid' => 'lid'],
+ ],
+ ],
+ 'indexes' => ['lid' => ['lid']],
+ ];
- $schema['linkchecker_comment'] = array(
+ $schema['linkchecker_comment'] = [
'description' => 'Stores all link references for comments.',
- 'fields' => array(
- 'cid' => array(
+ 'fields' => [
+ 'cid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {comment}.cid.',
- ),
- 'lid' => array(
+ ],
+ 'lid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {linkchecker_link}.lid.',
- ),
- ),
- 'primary key' => array('cid', 'lid'),
- 'foreign keys' => array(
- 'cid' => array(
+ ],
+ ],
+ 'primary key' => ['cid', 'lid'],
+ 'foreign keys' => [
+ 'cid' => [
'table' => 'comment',
- 'columns' => array('cid' => 'cid'),
- ),
- 'lid' => array(
+ 'columns' => ['cid' => 'cid'],
+ ],
+ 'lid' => [
'table' => 'linkchecker_link',
- 'columns' => array('lid' => 'lid'),
- ),
- ),
- 'indexes' => array('lid' => array('lid')),
- );
+ 'columns' => ['lid' => 'lid'],
+ ],
+ ],
+ 'indexes' => ['lid' => ['lid']],
+ ];
- $schema['linkchecker_node'] = array(
+ $schema['linkchecker_node'] = [
'description' => 'Stores all link references for nodes.',
- 'fields' => array(
- 'nid' => array(
+ 'fields' => [
+ 'nid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {node}.nid.',
- ),
- 'lid' => array(
+ ],
+ 'lid' => [
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Unique {linkchecker_link}.lid.',
- ),
- ),
- 'primary key' => array('nid', 'lid'),
- 'foreign keys' => array(
- 'nid' => array(
+ ],
+ ],
+ 'primary key' => ['nid', 'lid'],
+ 'foreign keys' => [
+ 'nid' => [
'table' => 'node',
- 'columns' => array('nid' => 'nid'),
- ),
- 'lid' => array(
+ 'columns' => ['nid' => 'nid'],
+ ],
+ 'lid' => [
'table' => 'linkchecker_link',
- 'columns' => array('lid' => 'lid'),
- ),
- ),
- 'indexes' => array('lid' => array('lid')),
- );
+ 'columns' => ['lid' => 'lid'],
+ ],
+ ],
+ 'indexes' => ['lid' => ['lid']],
+ ];
- $schema['linkchecker_link'] = array(
+ $schema['linkchecker_link'] = [
'description' => 'Stores all links.',
- 'fields' => array(
- 'lid' => array(
+ 'fields' => [
+ 'lid' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique link ID.',
- ),
- 'urlhash' => array(
+ ],
+ 'urlhash' => [
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'description' => 'The indexable hash of the {linkchecker_link}.url.',
- ),
- 'url' => array(
+ ],
+ 'url' => [
'type' => 'text',
'not null' => TRUE,
'description' => 'The full qualified link.',
- ),
- 'method' => array(
+ ],
+ 'method' => [
'type' => 'varchar',
'length' => 4,
'default' => 'HEAD',
'not null' => TRUE,
'description' => 'The method for checking links (HEAD, GET, POST).',
- ),
- 'code' => array(
+ ],
+ 'code' => [
'type' => 'int',
'not null' => TRUE,
'default' => -1,
'description' => 'HTTP status code from link checking.',
- ),
- 'error' => array(
+ ],
+ 'error' => [
'type' => 'text',
'not null' => FALSE,
'description' => 'The error message received from the remote server while doing link checking.',
- ),
- 'fail_count' => array(
+ ],
+ 'fail_count' => [
'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(
+ ],
+ 'last_checked' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp of the last link check.',
- ),
- 'status' => array(
+ ],
+ 'status' => [
'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'),
- ),
- );
+ ],
+ ],
+ 'primary key' => ['lid'],
+ 'unique keys' => ['urlhash' => ['urlhash']],
+ 'indexes' => [
+ 'method' => ['method'],
+ 'code' => ['code'],
+ 'fail_count' => ['fail_count'],
+ 'last_checked' => ['last_checked'],
+ 'status' => ['status'],
+ ],
+ ];
return $schema;
}
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::config('linkchecker.settings')->set('scan_blocks');
drupal_set_message(t('Link checks for blocks have been disabled.'));
}
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::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.'));
}