mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
elofgren: BUGFIX: Edge case fix to prevent execution timeout if a page has 50 identical broken links by only highlighting them once.
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41822 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ca366a15c7
commit
4a0b7e1d6d
@ -42,11 +42,17 @@ class HtmlEditorField extends TextareaField {
|
|||||||
$link = Director::makeRelative($link);
|
$link = Director::makeRelative($link);
|
||||||
$broken = false;
|
$broken = false;
|
||||||
if(ereg('^([A-Za-z0-9_\-]+)/?(#.*)?$', $link, $parts)) {
|
if(ereg('^([A-Za-z0-9_\-]+)/?(#.*)?$', $link, $parts)) {
|
||||||
if(!DataObject::get_one("SiteTree", "URLSegment = '$parts[1]'", false)) $broken = true;
|
if(!DataObject::get_one("SiteTree", "URLSegment = '$parts[1]'", false)) {
|
||||||
|
$broken = true;
|
||||||
|
// Prevents execution timeouts if a page has 50 identical broken links by only highlighting them once
|
||||||
|
$alreadyHighlighted[$parts[1]] = true;
|
||||||
|
}
|
||||||
} else if($link[0] == '/') {
|
} else if($link[0] == '/') {
|
||||||
$broken = true;
|
$broken = true;
|
||||||
} else if(ereg('^assets/',$link)) {
|
} else if(ereg('^assets/',$link)) {
|
||||||
if(!DataObject::get_one("File", "Filename = '$link'", false)) $broken = true;
|
if(!DataObject::get_one("File", "Filename = '$link'", false)) {
|
||||||
|
$broken = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a class. Note that this might create multiple class attributes, which are stripped below
|
// Add a class. Note that this might create multiple class attributes, which are stripped below
|
||||||
|
Loading…
Reference in New Issue
Block a user