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);
|
$allFields = DataObject::getSchema()->fieldSpecs($this->owner);
|
||||||
$linkedPages = [];
|
$linkedPages = [];
|
||||||
$anyBroken = false;
|
$anyBroken = false;
|
||||||
|
$hasTrackedFields = false;
|
||||||
foreach ($allFields as $field => $fieldSpec) {
|
foreach ($allFields as $field => $fieldSpec) {
|
||||||
$fieldObj = $this->owner->dbObject($field);
|
$fieldObj = $this->owner->dbObject($field);
|
||||||
if ($fieldObj instanceof DBHTMLText) {
|
if ($fieldObj instanceof DBHTMLText) {
|
||||||
|
$hasTrackedFields = true;
|
||||||
// Merge links in this field with global list.
|
// Merge links in this field with global list.
|
||||||
$linksInField = $this->trackLinksInField($field, $anyBroken);
|
$linksInField = $this->trackLinksInField($field, $anyBroken);
|
||||||
$linkedPages = array_merge($linkedPages, $linksInField);
|
$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)
|
// Soft support for HasBrokenLink db field (e.g. SiteTree)
|
||||||
if ($this->owner->hasField('HasBrokenLink')) {
|
if ($this->owner->hasField('HasBrokenLink')) {
|
||||||
$this->owner->HasBrokenLink = $anyBroken;
|
$this->owner->HasBrokenLink = $anyBroken;
|
||||||
|
Loading…
Reference in New Issue
Block a user