Abstract layer for working with file system
- arron
- Member | 464
I am really sorry, I was out of my mind when I was asking this question:-) Nette has its abstract layer, for example cache is using it.
But I found, that sessions is using native php functions. So what to do, when I want to save sessions somewhere else? There is some ISessionStorage, but it seems to not be used at all.
na1k wrote:
Is this what you are looking for?
Or you can implement custom file protocol (
mystorage://
) and use it with the Finder
That looks interesting, thank you.
Last edited by arron (2011-08-29 20:24)
- Jan Tvrdík
- Nette guru | 2595
arron wrote:
So what to do, when I want to save sessions somewhere else? There is some ISessionStorage, but it seems to not be used at all.
Just configure sessions to use your session storage via Nette\Http\Session::setStorage().
- vkrishn
- Member | 9
Is there implementation for simple file operations, like:
- Check if file/folder present.
- Create dir with desired permissions.
- Unlink
- Process fileperms() or stats(), symlinks.
- Guess file mime-type.
- Simple read/write operations.
Can this be part of util/finder?
Storages\FileStorage could use this common methods.
- vkrishn
- Member | 9
Some of the classes do have these methods, to some extend, implemented
internally.
Moving them to a common class perhaps Files.php under Nette\Utils or
Nette\Caching\Storages can be done.
Overall the above methods can be implemented in less than 10kb file size. Not calculating the removal of some codes from some files in Storages and Config.
Building a product based application often requires an installation phase and module update routines. Having them inbuilt in a framework would be great.
- David Grudl
- Nette Core | 8218
For simple file operations there is native class SplFileObject. (API is terrible, but better than nothing).
- vkrishn
- Member | 9
The closest would be,
- http://pear.php.net/package/File/ (20%) – more if required, part of which is in Storages/FileStorage
- http://pear.php.net/…e/File_Find/ (60%) – part of which I guess is already in Utils/Finder
- http://pear.php.net/…e/File_Util/ (80%)
- A simple file type guessing based on extension.
Reason:
To build/deploy a product based on nette framework would require such
routines.
Having them build in framework with nette style error handling.
Though implementing the above would be nice, I am in favour of a lightweight framework. :-)
Last edited by vkrishn (2012-03-22 05:52)