FIX Handle thrown exceptions because of obsolete class names
This commit is contained in:
parent
a119add32e
commit
c9f5ca6c72
|
@ -14,6 +14,7 @@ use SilverStripe\ExternalLinks\Model\BrokenExternalPageTrackStatus;
|
||||||
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
|
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\ValidationException;
|
||||||
|
|
||||||
class CheckExternalLinksTask extends BuildTask
|
class CheckExternalLinksTask extends BuildTask
|
||||||
{
|
{
|
||||||
|
@ -194,7 +195,12 @@ class CheckExternalLinksTask extends BuildTask
|
||||||
// Update content of page based on link fixes / breakages
|
// Update content of page based on link fixes / breakages
|
||||||
$htmlValue->saveHTML();
|
$htmlValue->saveHTML();
|
||||||
$page->Content = $htmlValue->getContent();
|
$page->Content = $htmlValue->getContent();
|
||||||
$page->write();
|
try {
|
||||||
|
$page->write();
|
||||||
|
} catch (ValidationException $ex) {
|
||||||
|
$this->log("Exception caught for {$page->Title}, skipping. Message: " . $ex->getMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
Loading…
Reference in New Issue