Skip to content

Commit

Permalink
ENH Don't use deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 18, 2024
1 parent 175c754 commit b02daa4
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 @@ -36,7 +36,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 @@ -113,7 +113,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 b02daa4

Please sign in to comment.