mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
f9c25b2465
commit
48a9a5c0ba
@ -211,7 +211,7 @@ class Folder extends File {
|
|||||||
|
|
||||||
|
|
||||||
function onBeforeDelete() {
|
function onBeforeDelete() {
|
||||||
if($children = $this->AllChildren()) {
|
if($this->ID && ($children = $this->AllChildren())) {
|
||||||
foreach($children as $child) {
|
foreach($children as $child) {
|
||||||
if(!$this->Filename || !$this->Name || !file_exists($this->getFullPath())) {
|
if(!$this->Filename || !$this->Name || !file_exists($this->getFullPath())) {
|
||||||
$child->setField('Name',null);
|
$child->setField('Name',null);
|
||||||
@ -261,7 +261,7 @@ class Folder extends File {
|
|||||||
* Returns true if this folder has children
|
* Returns true if this folder has children
|
||||||
*/
|
*/
|
||||||
public function hasChildren() {
|
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() {
|
public function autosetFilename() {
|
||||||
parent::autosetFilename();
|
parent::autosetFilename();
|
||||||
|
|
||||||
if($children = $this->AllChildren()) {
|
if($this->ID && ($children = $this->AllChildren())) {
|
||||||
$this->write();
|
$this->write();
|
||||||
|
|
||||||
foreach($children as $child) {
|
foreach($children as $child) {
|
||||||
@ -287,7 +287,7 @@ class Folder extends File {
|
|||||||
protected function resetFilename($renamePhysicalFile = true) {
|
protected function resetFilename($renamePhysicalFile = true) {
|
||||||
parent::resetFilename($renamePhysicalFile);
|
parent::resetFilename($renamePhysicalFile);
|
||||||
|
|
||||||
if($children = $this->AllChildren()) {
|
if($this->ID && ($children = $this->AllChildren())) {
|
||||||
$this->write();
|
$this->write();
|
||||||
|
|
||||||
foreach($children as $child) {
|
foreach($children as $child) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user