From bce020bea8f1a040c0af228f37348ecc3927a4d6 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:28:20 +1200 Subject: [PATCH] ENH Don't use deprecated method (#149) --- 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