From b02daa42077f18437d1bc29fcb3132f98d383ad9 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 18 Sep 2024 10:52:50 +1200 Subject: [PATCH] ENH Don't use deprecated method --- src/Tasks/CheckExternalLinksTask.php | 6 +++--- tests/php/ExternalLinksTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Tasks/CheckExternalLinksTask.php b/src/Tasks/CheckExternalLinksTask.php index 9dbb851..a9d3224 100644 --- a/src/Tasks/CheckExternalLinksTask.php +++ b/src/Tasks/CheckExternalLinksTask.php @@ -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; @@ -205,7 +205,7 @@ 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; @@ -213,7 +213,7 @@ public function runLinksCheck($limit = null) // 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 diff --git a/tests/php/ExternalLinksTest.php b/tests/php/ExternalLinksTest.php index c6dd4a6..29ab4ee 100644 --- a/tests/php/ExternalLinksTest.php +++ b/tests/php/ExternalLinksTest.php @@ -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 @@ -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