Created
February 1, 2016 23:01
-
-
Save sb-relaxt-at/20b834ab89e8fd18e4f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function updateFilesystem() { | |
$filenameBeforeUpdate = $this->Filename; | |
parent::updateFilesystem(); | |
if($filenameBeforeUpdate != $this->Filename){ | |
// in this case the filename has changed due to a changed parent | |
// we need to write the change to the db, otherwise the children won't see it | |
$this->write(); | |
// no need to proceed as this method has already been called again by the write above | |
return; | |
} | |
// unmodified from here on | |
if($this->ID && ($children = $this->AllChildren())) { | |
foreach($children as $child) { | |
$child->updateFilesystem(); | |
$child->write(); // might be only necessary if it is a file? | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment