Conditions | 7 |
Paths | 11 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public function onBeforeDelete() |
||
8 | { |
||
9 | // A workaround for that fact that Folder::onBeforeDelete() only removes |
||
10 | // the folder if only a _resampled dir exists. If the folder is empty |
||
11 | // and only has _resampled and _versions directories then delete it. |
||
12 | if ($this->owner->Filename && is_dir($this->owner->getFullPath())) { |
||
|
|||
13 | $items = scandir($this->owner->getFullPath()); |
||
14 | $versionsDir = FileVersion::VERSION_FOLDER; |
||
15 | |||
16 | // Remove . and .. items. |
||
17 | array_shift($items); |
||
18 | array_shift($items); |
||
19 | |||
20 | $delete = ( |
||
21 | count($items) == 1 && $items[0] == $versionsDir |
||
22 | || count($items) == 2 && $items == array('_resampled', $versionsDir) |
||
23 | ); |
||
24 | |||
25 | if ($delete) { |
||
26 | Filesystem::removeFolder($this->owner->getFullPath()); |
||
27 | } |
||
28 | } |
||
29 | } |
||
30 | } |
||
31 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.