Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Don't use deprecated method #149

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading