diff options
Diffstat (limited to 'mod/file/classes/FilePluginFile.php')
-rw-r--r-- | mod/file/classes/FilePluginFile.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mod/file/classes/FilePluginFile.php b/mod/file/classes/FilePluginFile.php new file mode 100644 index 000000000..edf914231 --- /dev/null +++ b/mod/file/classes/FilePluginFile.php @@ -0,0 +1,31 @@ +<?php + +/** + * Override the ElggFile + */ +class FilePluginFile extends ElggFile { + protected function initializeAttributes() { + parent::initializeAttributes(); + + $this->attributes['subtype'] = "file"; + } + + public function __construct($guid = null) { + parent::__construct($guid); + } + + public function delete() { + + $thumbnails = array($this->thumbnail, $this->smallthumb, $this->largethumb); + foreach ($thumbnails as $thumbnail) { + if ($thumbnail) { + $delfile = new ElggFile(); + $delfile->owner_guid = $this->owner_guid; + $delfile->setFilename($thumbnail); + $delfile->delete(); + } + } + + return parent::delete(); + } +} |