[1.0.x] URL Status Scanner

Created on 24 March 2025, 16 days ago
Updated 25 March 2025, 15 days ago

The URL Status Scanner module allows the tracking of external URLs to get their location and response code. This module scan inside the base code of custom modules and themes; inside configuration objects; or inside content entities.

Project URL: https://www.drupal.org/project/url_status_scanner โ†’

๐Ÿ“Œ Task
Status

Needs review

Component

module

Created by

๐Ÿ‡จ๐Ÿ‡ดColombia gustavo.contreras

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect โ†’ for more details and Security advisory coverage application checklist โ†’ to understand what reviewers look for. Tips for ensuring a smooth review โ†’ gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
    • For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
    • Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications โ†’ , Application workflow โ†’ , What to cover in an application review โ†’ , and Tools to use for reviews โ†’ .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool โ†’ only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues โ†’ .

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    1. FILE: src/Service/UrlStatusScannerService.php

      /**
       * Construct the service.
       *
       * @param \Drupal\Core\Database\Connection $database
       *   The database connection.
       * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
       *   The config factory.
       * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity
       *   The entity object.
       * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
       *   The entity type bundle service.
       */
      public function __construct(

    FILE: src/Form/UrlStatusScannerDashboard.php

      /**
       * Construct the service.
       *
       * @param \Drupal\url_status_scanner\Service\UrlStatusScannerService $url_status_scanner_service
       *   The urlStatusScannerService.
       * @param \Drupal\Core\Database\Connection $database
       *   The database connection.
       * @param \Drupal\Core\Extension\ExtensionList $extension_list
       *   The module extension list service.
       */
      public function __construct(UrlStatusScannerService $url_status_scanner_service, Connection $database, ExtensionList $extension_list) {

    The documentation comment for constructors is not mandatory anymore, If it is given, the description must be โ€œConstructs a new [class name] objectโ€, where [class name] includes the class namespace.

    2. FILE: url_status_scanner.module

    /**
     * @file
     * Provides help documentation for the URL Status Scanner module.
     */

    The usual description for a .module file is โ€œHook implementations for the [module name] moduleโ€, where [module name] is the module name given in the .info.yml file.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    I do not have time for a complete review, but the following code needs to be changed.

    /**
     * Implements hook_install().
     */
    function url_status_scanner_install(): void {
      // Define the schema for the 'url_status_scanner' table.
      \Drupal::database()->schema()->createTable('url_status_scanner', [
        'fields' => [
          'id' => [
            'type' => 'serial',
            'not null' => TRUE,
            'description' => 'Primary key',
          ],
          'url' => [
            'type' => 'varchar',
            'length' => 256,
            'not null' => TRUE,
            'description' => 'The URL.',
          ],
          'location' => [
            'type' => 'varchar',
            'length' => 256,
            'not null' => TRUE,
            'description' => 'The URL location in the site.',
          ],
          'type' => [
            'type' => 'varchar',
            'length' => 16,
            'not null' => TRUE,
            'description' => 'The type of URL.',
          ],
          'status_code' => [
            'type' => 'int',
            'size' => 'small',
            'not null' => FALSE,
            'description' => 'The HTTP status code returned by the URL.',
          ],
        ],
        'primary key' => ['id'],
      ]);
    }
    
    /**
     * Implements hook_uninstall().
     */
    function url_status_scanner_uninstall(): void {
      // Drop the 'url_status_scanner' table when the module is uninstalled.
      \Drupal::database()->schema()->dropTable('url_status_scanner');
    }
    

    To create database tables when a module is installed, the hook to use is hook_schema(). Drupal core automatically deletes the database tables defined by that hook.

    The System module is never defined as dependency for a module because that is a module that is always installed by Drupal core. The only reason for defining that as dependency was to declare the compatibility with a specific Drupal core release, but that is now achieved with core_version_requirement.

    The Configuration Manager module allows importing and exporting configuration changes. The module is not using that module. It just uses the Configuration API, which does not require any extra module.

  • ๐Ÿ‡จ๐Ÿ‡ดColombia gustavo.contreras

    Tanks @vishal.kadam and @avpaderno for your comments, I have made a new commit and a push with the new changes.

    Please let me know if I should do anything else.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

  • ๐Ÿ‡จ๐Ÿ‡ดColombia gustavo.contreras

    Ok @vishal.kadam the current status is "Needs review", thank you.

    Please let me know if I should do anything else.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    Rest looks fine to me.

    Letโ€™s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

Production build 0.71.5 2024