ENH Don't use deprecated method (#149)

This commit is contained in:
Guy Sartorelli 2024-09-19 11:28:20 +12:00 committed by GitHub
parent 175c75419a
commit bce020bea8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -187,7 +187,7 @@ class CheckExternalLinksTask extends BuildTask
// Check value of html area // Check value of html area
$page = $pageTrack->Page(); $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); $htmlValue = Injector::inst()->create(HTMLValue::class, $page->Content);
if (!$htmlValue->isValid()) { if (!$htmlValue->isValid()) {
continue; continue;
@ -205,7 +205,7 @@ class CheckExternalLinksTask extends BuildTask
try { try {
$page->write(); $page->write();
} catch (ValidationException $ex) { } 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()); $this->log("Exception caught for {$page->Title}, skipping. Message: " . $ex->getMessage());
}); });
continue; continue;
@ -213,7 +213,7 @@ class CheckExternalLinksTask extends BuildTask
// Once all links have been created for this page update HasBrokenLinks // Once all links have been created for this page update HasBrokenLinks
$count = $pageTrack->BrokenLinks()->count(); $count = $pageTrack->BrokenLinks()->count();
Deprecation::withNoReplacement(fn() => $this->log("Found {$count} broken links")); Deprecation::withSuppressedNotice(fn() => $this->log("Found {$count} broken links"));
if ($count) { if ($count) {
$siteTreeTable = DataObject::getSchema()->tableName(SiteTree::class); $siteTreeTable = DataObject::getSchema()->tableName(SiteTree::class);
// Bypass the ORM as syncLinkTracking does not allow you to update HasBrokenLink to true // Bypass the ORM as syncLinkTracking does not allow you to update HasBrokenLink to true

View File

@ -36,7 +36,7 @@ class ExternalLinksTest extends FunctionalTest
{ {
// Run link checker // Run link checker
$task = CheckExternalLinksTask::create(); $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(); $task->runLinksCheck();
// Get all links checked // Get all links checked
@ -113,7 +113,7 @@ class ExternalLinksTest extends FunctionalTest
{ {
// Run link checker // Run link checker
$task = CheckExternalLinksTask::create(); $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(); $task->runLinksCheck();
// Ensure report lists all broken links // Ensure report lists all broken links