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:
Ingo Schommer 2007-09-15 00:05:49 +00:00
parent ca366a15c7
commit 4a0b7e1d6d
1 changed files with 8 additions and 2 deletions

View File

@ -42,11 +42,17 @@ class HtmlEditorField extends TextareaField {
$link = Director::makeRelative($link);
$broken = false;
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] == '/') {
$broken = true;
} 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