Comments (9)
Sorry, I was wrong when I tried to guess where the problem was.
I'm not sure of being right again, that's the reason I don't PR, but this change worked for me. I changed this in AbstractListener:
protected function _afterDeleteFile(Event $event) {
$this->_handleLegacyEvent($event);
$afterDeleteEvent = new Event('FileStorage.afterDeleteFile', $this, [
'entity' => $event->result,
'adapter' => $this->storageAdapter($event->result['adapter'])
]);
EventManager::instance()->dispatch($afterDeleteEvent);
}
with this:
protected function _afterDeleteFile(Event $event) {
$this->_handleLegacyEvent($event);
$afterDeleteEvent = new Event('FileStorage.afterDeleteFile', $this, [
// use passed entity here...
'entity' => $event->data['entity'],
'adapter' => $this->storageAdapter($event->data['entity']->adapter)
]);
EventManager::instance()->dispatch($afterDeleteEvent);
}
And now it works for me.
from cakephp-file-storage.
Hey, sorry for the delay but I'm very busy this week with work and private stuff. I'll review this in detail when I have the time. I understand the problem and see the fix but I need to review it more deeply and see if this doesn't have any side effects.
from cakephp-file-storage.
I'm not sure if it is related to this bug, but I've noted that even when the files are deleted correctly, the container folders are not. So I end up with a lot of empty nested folders. Is this the way it is supposed to work?
from cakephp-file-storage.
I'm aware of that but never gave it a priority because it doesn't hurt.
The problem is you need to know if the file resides alone on this folder or not to delete the folder without accidentally deleting other files. The default config is that it should use one folder at the end of the nested path for each file which is using the uuid as name. But if you configure it different you can end up with many files in the same folder.
from cakephp-file-storage.
@choma please try 1.1-dev I've fixed the code in the 1.1 branch.
from cakephp-file-storage.
Nope!
It didn't fixed the issue for me. You still need to change the 390 line, by this:
'adapter' => $this->storageAdapter($event->data['entity']->adapter)
There is where the bug is in fact, sorry if wasn't clear in my previous comments.
I just changed the previous line because I thought it would create other problems.
from cakephp-file-storage.
No problem, I've made the change.
Any reason you didn't do the change yourself and created a pull request?
from cakephp-file-storage.
I'm sorry I didn't. I'm still trying to understand the code, I'm not sure how the change will affect the rest of it. And I never learned to do php tests, so I'm not sure how to handle them.
But hopefully, with some more time using the plugin I'll be able to give you a hand :)
Thanks for the great plugin!
from cakephp-file-storage.
Welcome, I'm glad you like it. Let me know if you need something else.
I can't admit that the plugin isn't the most easy one to use but I think it is the most powerful on with the best architecture. And I keep improving it. 2.0 will drop a lot of legacy code and make things more easy. I'm not happy with the image processing right now, it's still to tight coupled and interwoven with the storage related code.
from cakephp-file-storage.
Related Issues (20)
- No versions of jpeg files HOT 4
- Keep a Change Log HOT 2
- Can't save file when creating related model HOT 2
- Upgrading from v1 to v2 HOT 7
- Tag current 2.0 version with next semver tag HOT 1
- How can one add to the list of supported adapter classes? HOT 5
- No image manipulation or correct url paths being returned HOT 2
- updating docs HOT 3
- Todo: Add migration guide from Cake 3 to 4 HOT 2
- updating docs
- Class could be found HOT 4
- Followed the guidelines in documentations server complaints 'Burzum\FileStorage\Event\LocalFileStorageListener' not found HOT 3
- Created a script to upload files to S3 - files uploaded but script throws error The listener `Burzum\FileStorage\Storage\Listener\LocalListener` doesn't allow the `\Gaufrette\Adapter\AwsS3` adapter class! Probably because it can't work with it HOT 4
- cakephp/cakephp 4.0.x dependency issue HOT 7
- Version 4.0 (complete rewrite) HOT 3
- Antipattern showcase
- Link in docs is broken
- Issues with upload for 1:1 HOT 1
- Issues installing via composer HOT 8
- Looking for a new maintainer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-file-storage.