mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
ENH Don't use deprecated method (#149)
This commit is contained in:
parent
175c75419a
commit
bce020bea8
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user