Skip to content

Commit

Permalink
Merge pull request #39 from creative-commoners/pulls/2.0/handle-obsol…
Browse files Browse the repository at this point in the history
…ete-class-names

FIX Handle thrown exceptions because of obsolete class names
  • Loading branch information
NightJar authored Nov 29, 2017
2 parents e21c0ad + c9f5ca6 commit 6cf7a46
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Tasks/CheckExternalLinksTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\ValidationException;

class CheckExternalLinksTask extends BuildTask
{
Expand Down Expand Up @@ -194,7 +195,12 @@ public function runLinksCheck($limit = null)
// Update content of page based on link fixes / breakages
$htmlValue->saveHTML();
$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
$count = $pageTrack->BrokenLinks()->count();
Expand Down

0 comments on commit 6cf7a46

Please sign in to comment.