Module which tracks external broken links in SilverStripe CMS pages
Go to file
2017-11-27 17:41:17 +13:00
_config Update unit tests to be rid of Phockito 2017-11-27 15:14:16 +13:00
.tx re-add transifex config as it was removed from the wrong branch. 2017-11-27 11:23:36 +13:00
javascript BUG Indicator stuck on 0% until you refresh the page. 2014-08-13 15:39:29 +12:00
lang Update language files to contain new namespaced classnames 2017-11-27 16:42:36 +13:00
src Update UPDATE query to use true table name, not assumed one 2017-11-27 15:30:34 +13:00
tests Update unit tests to be rid of Phockito 2017-11-27 15:14:16 +13:00
.editorconfig Added standard .editorconfig file 2015-12-17 10:34:43 +13:00
.gitattributes Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
.scrutinizer.yml Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
.travis.yml Convert to new cache layer, clean up other overlooked points in the ss4 upgrade 2017-11-27 11:19:58 +13:00
.upgrade.yml FIX Linting errors for code cleanliness 2017-11-23 13:19:00 +13:00
changelog.md Update changelog for 1.0.5 2016-05-18 17:14:35 +12:00
code-of-conduct.md Added standard code of conduct 2015-11-21 20:13:30 +13:00
codecov.yml Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
composer.json Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
license.md Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
phpcs.xml.dist Update tests & left over fixes from upgrader tool 2017-11-23 14:54:27 +13:00
phpunit.xml.dist Update supporting items for SilverStripe 4 conventions 2017-11-22 14:01:40 +13:00
README.md Update readme in light of ss4 compatibility enhancements 2017-11-27 17:41:17 +13:00

External links

Build Status Scrutinizer Code Quality codecov

Introduction

The external links module is a task and ModelAdmin to track and to report on broken external links.

Maintainer Contact

Requirements

  • SilverStripe ^4.0

Note: For a SilverStripe 3.x compatible version, please use the 1.x release line.

Features

  • Add external links to broken links reports
  • Add a task to track external broken links

Installation

  1. Require the module via composer: composer require silverstripe/externallinks
  2. Run /dev/build in your browser to rebuild the database.
  3. Run the following task http://path.to.silverstripe/dev/tasks/CheckExternalLinks to check for broken external links

Report

A new report is added called 'External Broken links report'. When viewing this report, a user may press the "Create new report" button which will trigger an ajax request to initiate a report run.

In this initial ajax request this module will do one of two things, depending on which modules are included:

  • If the queuedjobs module is installed, a new queued job will be initiated. The queuedjobs module will then manage the progress of the task.
  • If the queuedjobs module is absent, then the controller will fallback to running a buildtask in the background. This is less robust, as a failure or error during this process will abort the run.

In either case, the background task will loop over every page in the system, inspecting all external urls and checking the status code returned by requesting each one. If a URL returns a response code that is considered "broken" (defined as < 200 or > 302) then the ss-broken css class will be assigned to that url, and a line item will be added to the report. If a previously broken link has been corrected or fixed, then this class is removed.

In the actual report generated the user can click on any broken link item to either view the link in their browser, or edit the containing page in the CMS.

While a report is running the current status of this report will be displayed on the report details page, along with the status. The user may leave this page and return to it later to view the ongoing status of this report.

Any subsequent report may not be generated until a prior report has completed.

Dev task

Run the following task http://path.to.silverstripe/dev/tasks/CheckExternalLinks to check your site for external broken links.

Queued job

If you have the queuedjobs module installed you can set the task to be run every so often.

Whitelisting codes

If you want to ignore or whitelist certain http codes this can be setup via IgnoreCodes in the config.yml file in mysite/_config

    SilverStripe\ExternalLinks\Tasks\CheckExternalLinksTask:
      IgnoreCodes:
        - 401
        - 403
        - 501