Skip to content

Commit

Permalink
Merge branch '3' into 4
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 19, 2024
2 parents 417299c + bce020b commit cba331d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Tasks/CheckExternalLinksTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function runLinksCheck($limit = null)

// Check value of html area
$page = $pageTrack->Page();
Deprecation::withNoReplacement(fn() => $this->log("Checking {$page->Title}"));
Deprecation::withSuppressedNotice(fn() => $this->log("Checking {$page->Title}"));
$htmlValue = Injector::inst()->create(HTMLValue::class, $page->Content);
if (!$htmlValue->isValid()) {
continue;
Expand All @@ -205,15 +205,15 @@ public function runLinksCheck($limit = null)
try {
$page->write();
} catch (ValidationException $ex) {
Deprecation::withNoReplacement(function () use ($page, $ex) {
Deprecation::withSuppressedNotice(function () use ($page, $ex) {
$this->log("Exception caught for {$page->Title}, skipping. Message: " . $ex->getMessage());
});
continue;
}

// Once all links have been created for this page update HasBrokenLinks
$count = $pageTrack->BrokenLinks()->count();
Deprecation::withNoReplacement(fn() => $this->log("Found {$count} broken links"));
Deprecation::withSuppressedNotice(fn() => $this->log("Found {$count} broken links"));
if ($count) {
$siteTreeTable = DataObject::getSchema()->tableName(SiteTree::class);
// Bypass the ORM as syncLinkTracking does not allow you to update HasBrokenLink to true
Expand Down
4 changes: 2 additions & 2 deletions tests/php/ExternalLinksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testLinks()
{
// Run link checker
$task = CheckExternalLinksTask::create();
Deprecation::withNoReplacement(fn() => $task->setSilent(true)); // Be quiet during the test!
Deprecation::withSuppressedNotice(fn() => $task->setSilent(true)); // Be quiet during the test!
$task->runLinksCheck();

// Get all links checked
Expand Down Expand Up @@ -114,7 +114,7 @@ public function testArchivedPagesAreHiddenFromReport()
{
// Run link checker
$task = CheckExternalLinksTask::create();
Deprecation::withNoReplacement(fn() => $task->setSilent(true)); // Be quiet during the test!
Deprecation::withSuppressedNotice(fn() => $task->setSilent(true)); // Be quiet during the test!
$task->runLinksCheck();

// Ensure report lists all broken links
Expand Down

0 comments on commit cba331d

Please sign in to comment.