X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Flinkchecker%2Fsrc%2FForm%2FLinkCheckerAdminSettingsForm.php;fp=web%2Fmodules%2Fcontrib%2Flinkchecker%2Fsrc%2FForm%2FLinkCheckerAdminSettingsForm.php;h=10b3ec63aff570acd06ca7e1c708b80b9a6e6c9d;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=f49ae59c3371238c7af81723be3717237527ea90;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php b/web/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php index f49ae59c3..10b3ec63a 100644 --- a/web/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php +++ b/web/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php @@ -42,7 +42,9 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { ]; $block_custom_dependencies = '
'; - $block_custom_dependencies .= $this->t('Requires: @module-list', ['@module-list' => (\Drupal::moduleHandler()->moduleExists('block') ? $this->t('@module (enabled)', ['@module' => 'Block']) : $this->t('@module (disabled)', ['@module' => 'Block']))]); + $block_custom_dependencies .= $this->t('Requires: @module-list', + [ + '@module-list' => (\Drupal::moduleHandler()->moduleExists('block') ? $this->t('@module (enabled)', ['@module' => 'Block']) : $this->t('@module (disabled)', ['@module' => 'Block']))]); $block_custom_dependencies .= '
'; $form['general']['linkchecker_scan_blocks'] = [ @@ -120,7 +122,7 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { $filter_descriptions = []; foreach ($filter_info as $name => $filter) { if (in_array($name, explode('|', LINKCHECKER_DEFAULT_FILTER_BLACKLIST))) { - $filter_options[$name] = $this->t('@title (Recommended)', array('@title' => $filter->getLabel())); + $filter_options[$name] = $this->t('@title (Recommended)', ['@title' => $filter->getLabel()]); } else { $filter_options[$name] = $filter->getLabel(); @@ -138,14 +140,16 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { ]; $form['tag']['linkchecker_filter_blacklist'] = array_merge($form['tag']['linkchecker_filter_blacklist'], $filter_descriptions); - $count_lids_enabled = db_query("SELECT count(lid) FROM {linkchecker_link} WHERE status = :status", array(':status' => 1))->fetchField(); - $count_lids_disabled = db_query("SELECT count(lid) FROM {linkchecker_link} WHERE status = :status", array(':status' => 0))->fetchField(); - $form['check'] = [ + $count_lids_enabled = db_query("SELECT count(lid) FROM {linkchecker_link} WHERE status = :status", [':status' => 1])->fetchField(); + $count_lids_disabled = db_query("SELECT count(lid) FROM {linkchecker_link} WHERE status = :status", [':status' => 0])->fetchField(); + + // httprl module does not exists yet for D8 + /* $form['check'] = [ '#type' => 'details', '#title' => $this->t('Check settings'), '#description' => $this->t('For simultaneous link checks it is recommended to install the HTTP Parallel Request & Threading Library. This may be necessary on larger sites with very many links (30.000+), but will also improve overall link check duration on smaller sites. Currently the site has @count links (@count_enabled enabled / @count_disabled disabled).', [':httprl' => 'http://drupal.org/project/httprl', '@count' => $count_lids_enabled+$count_lids_disabled, '@count_enabled' => $count_lids_enabled, '@count_disabled' => $count_lids_disabled]), '#open' => TRUE, - ]; + ];*/ $form['check']['linkchecker_check_library'] = [ '#type' => 'select', '#title' => $this->t('Check library'), @@ -153,7 +157,7 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { '#default_value' => $config->get('check.library'), '#options' => [ 'core' => $this->t('Drupal core'), - 'httprl' => $this->t('HTTP Parallel Request & Threading Library'), + // 'httprl' => $this->t('HTTP Parallel Request & Threading Library'), ], ]; $form['check']['linkchecker_check_connections_max'] = [ @@ -195,9 +199,9 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { '#default_value' => $config->get('check.disable_link_check_for_urls'), '#type' => 'textarea', '#title' => $this->t('Do not check the link status of links containing these URLs'), - '#description' => $this->t('By default this list contains the domain names reserved for use in documentation and not available for registration. See RFC 2606, Section 3 for more information. URLs on this list are still extracted, but the link setting Check link status becomes automatically disabled to prevent false alarms. If you change this list you need to clear all link data and re-analyze your content. Otherwise this setting will only affect new links added after the configuration change.', array(':rfc-2606' => 'http://www.rfc-editor.org/rfc/rfc2606.txt')), + '#description' => $this->t('By default this list contains the domain names reserved for use in documentation and not available for registration. See RFC 2606, Section 3 for more information. URLs on this list are still extracted, but the link setting Check link status becomes automatically disabled to prevent false alarms. If you change this list you need to clear all link data and re-analyze your content. Otherwise this setting will only affect new links added after the configuration change.', [':rfc-2606' => 'http://www.rfc-editor.org/rfc/rfc2606.txt']), ]; - //@fixme: constants no longer exists. + // @fixme: constants no longer exists. $form['check']['linkchecker_logging_level'] = [ '#default_value' => $config->get('logging.level'), '#type' => 'select', @@ -222,7 +226,7 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { $form['error']['linkchecker_impersonate_account'] = [ '#type' => 'textfield', '#title' => $this->t('Impersonate user account'), - '#description' => $this->t('If below error handling actions are executed they can be impersonated with a custom user account. By default this is user %name, but you are able to assign a custom user to allow easier identification of these automatic revision updates. Make sure you select a user with full permissions on your site or the user may not able to access and save all content.', array('%name' => $linkchecker_default_impersonate_account->getAccountName())), + '#description' => $this->t('If below error handling actions are executed they can be impersonated with a custom user account. By default this is user %name, but you are able to assign a custom user to allow easier identification of these automatic revision updates. Make sure you select a user with full permissions on your site or the user may not able to access and save all content.', ['%name' => $linkchecker_default_impersonate_account->getAccountName()]), '#size' => 30, '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', @@ -230,7 +234,7 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { ]; $form['error']['linkchecker_action_status_code_301'] = [ '#title' => $this->t('Update permanently moved links'), - '#description' => $this->t('If enabled, outdated links in content providing a status Moved Permanently (status code 301) are automatically updated to the most recent URL. If used, it is recommended to use a value of three to make sure this is not only a temporarily change. This feature trust sites to provide a valid permanent redirect. A new content revision is automatically created on link updates if create new revision is enabled in the content types publishing options. It is recommended to create new revisions for all link checker enabled content types. Link updates are nevertheless always logged in recent log entries.', array(':dblog' => Url::fromRoute('dblog.overview')->toString(), ':content_types' => Url::fromRoute('entity.node_type.collection')->toString())), + '#description' => $this->t('If enabled, outdated links in content providing a status Moved Permanently (status code 301) are automatically updated to the most recent URL. If used, it is recommended to use a value of three to make sure this is not only a temporarily change. This feature trust sites to provide a valid permanent redirect. A new content revision is automatically created on link updates if create new revision is enabled in the content types publishing options. It is recommended to create new revisions for all link checker enabled content types. Link updates are nevertheless always logged in recent log entries.', [':dblog' => Url::fromRoute('dblog.overview')->toString(), ':content_types' => Url::fromRoute('entity.node_type.collection')->toString()]), '#type' => 'select', '#default_value' => $config->get('error.action_status_code_301'), '#options' => [ @@ -310,7 +314,9 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { // Validate impersonation user name. $linkchecker_impersonate_account = user_load_by_name($form_state->getValue('linkchecker_impersonate_account')); - if (empty($linkchecker_impersonate_account->id())) { +// @TODO: Cleanup +// if (empty($linkchecker_impersonate_account->id())) { + if ($linkchecker_impersonate_account && empty($linkchecker_impersonate_account->id())) { $form_state->setErrorByName('linkchecker_impersonate_account', $this->t('User account %name cannot found.', ['%name' => $form_state->getValue('linkchecker_impersonate_account')])); } } @@ -380,10 +386,10 @@ class LinkCheckerAdminSettingsForm extends ConfigFormBase { * blocks. */ function submitClearAnalyzeLinks(array &$form, FormStateInterface $form_state) { - db_truncate('linkchecker_block_custom')->execute(); - db_truncate('linkchecker_comment')->execute(); - db_truncate('linkchecker_node')->execute(); - db_truncate('linkchecker_link')->execute(); + \Drupal::database()->truncate('linkchecker_block_custom')->execute(); + \Drupal::database()->truncate('linkchecker_comment')->execute(); + \Drupal::database()->truncate('linkchecker_node')->execute(); + \Drupal::database()->truncate('linkchecker_link')->execute(); // Start batch and analyze all nodes. $node_types = linkchecker_scan_node_types();