mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch '4.13' into 4
This commit is contained in:
commit
01d389ec44
@ -116,15 +116,22 @@ class SiteTreeLinkTracking extends DataExtension
|
||||
$allFields = DataObject::getSchema()->fieldSpecs($this->owner);
|
||||
$linkedPages = [];
|
||||
$anyBroken = false;
|
||||
$hasTrackedFields = false;
|
||||
foreach ($allFields as $field => $fieldSpec) {
|
||||
$fieldObj = $this->owner->dbObject($field);
|
||||
if ($fieldObj instanceof DBHTMLText) {
|
||||
$hasTrackedFields = true;
|
||||
// Merge links in this field with global list.
|
||||
$linksInField = $this->trackLinksInField($field, $anyBroken);
|
||||
$linkedPages = array_merge($linkedPages, $linksInField);
|
||||
}
|
||||
}
|
||||
|
||||
// We need a boolean flag instead of checking linkedPages because it can be empty when pages are removed
|
||||
if (!$hasTrackedFields) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Soft support for HasBrokenLink db field (e.g. SiteTree)
|
||||
if ($this->owner->hasField('HasBrokenLink')) {
|
||||
$this->owner->HasBrokenLink = $anyBroken;
|
||||
|
Loading…
Reference in New Issue
Block a user