BUGFIX #3329: Improved speed of folder creation in files + images

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@69943 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-01-09 03:02:42 +00:00
parent f9c25b2465
commit 48a9a5c0ba

View File

@ -211,7 +211,7 @@ class Folder extends File {
function onBeforeDelete() {
if($children = $this->AllChildren()) {
if($this->ID && ($children = $this->AllChildren())) {
foreach($children as $child) {
if(!$this->Filename || !$this->Name || !file_exists($this->getFullPath())) {
$child->setField('Name',null);
@ -261,7 +261,7 @@ class Folder extends File {
* Returns true if this folder has children
*/
public function hasChildren() {
return $this->myChildren() && $this->myChildren()->Count() > 0;
return $this->ID && $this->myChildren() && $this->myChildren()->Count() > 0;
}
/**
@ -270,7 +270,7 @@ class Folder extends File {
public function autosetFilename() {
parent::autosetFilename();
if($children = $this->AllChildren()) {
if($this->ID && ($children = $this->AllChildren())) {
$this->write();
foreach($children as $child) {
@ -287,7 +287,7 @@ class Folder extends File {
protected function resetFilename($renamePhysicalFile = true) {
parent::resetFilename($renamePhysicalFile);
if($children = $this->AllChildren()) {
if($this->ID && ($children = $this->AllChildren())) {
$this->write();
foreach($children as $child) {