barryvdh / elfinder-flysystem-driver

elFinder driver for Flysystem
183 stars 41 forks source link

support adapter method `getUrl()` if exists #5

Closed nao-pon closed 9 years ago

barryvdh commented 9 years ago

Which adapters have these?

nao-pon commented 9 years ago

copy.com driver. I sent pull request https://github.com/thephpleague/flysystem-copy/pull/8 .

barryvdh commented 9 years ago

I'm not sure how reliable this is, because there are a lot of magic methods to call functions, like in plugins. And in cached adapters etc. Perhaps use a try/catch to try to get the url?

nao-pon commented 9 years ago

@barryvdh Thanks!

It's right of you to say certainly. I'm thinking to use in the inherited class in my project.

try/catch is necessary!

nao-pon commented 9 years ago

That this was rejected, I misunderstood.

Is there a possibility merged by using try/cache?

barryvdh commented 9 years ago

I didn't say it was rejected, but could probably be simplified a bit. Maybe not checking the url but just the try catch

barryvdh commented 9 years ago

Hmm, let me think about this. Not really sure what the best way is. Usually extra functionality for Flysystem is provided with a plugin, so perhaps I could create a plugin for the url functionality.

nao-pon commented 9 years ago

Yet, I don't understand well about flysystem so I have expectations for your plugin!

barryvdh commented 9 years ago

I've added a Plugin which does pretty much the same. Not really good yet, I'd rather check if an actual implementation has a specific method, so you know what to expect, instead of blindly calling getUrl().

I didn't really test this much, because I don't use Copy.com or other drivers that have public urls.. Can you give it a try?

nao-pon commented 9 years ago

It's great! I tested.. worked fine. But it need set $stat['url']=1 in _stat() for call getUrl().

nao-pon commented 9 years ago

How about #7