mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-06-16 01:31:34 +02:00
Merge pull request #39 from creative-commoners/pulls/2.0/handle-obsolete-class-names
FIX Handle thrown exceptions because of obsolete class names
This commit is contained in:
commit
6cf7a466fb
|
@ -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
Block a user