mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
#177 - Don't let people create a page name the same as a class name
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@49186 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
eda6a3b7e4
commit
bee4f9423a
@ -777,7 +777,7 @@ class SiteTree extends DataObject {
|
||||
'';
|
||||
|
||||
$count = 1;
|
||||
while(DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")) {
|
||||
while(class_exists($this->URLSegment) || DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")) {
|
||||
$count++;
|
||||
$this->URLSegment = ereg_replace('-[0-9]+$','', $this->URLSegment) . "-$count";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user