suggestion SplFileInfo
| From: | Arnold Daniels | Date: | Mon, 26 Feb 2007 19:48:32 +0000 |
| Subject: | suggestion SplFileInfo | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-28159@lists.php.net to get a copy of this message | ||
Hi,
I've got a few feature suggestions for SplFileInfo and DirectoryIteratorRecursive. I'm creating yet another php file manager. I've noticed that I needed to add quite some code to make it act the way gnome nautilus does. I believe these feature would be a good addition.
SplFileInfo:
- Add parameter $flags to constructor. The flags are passed to any fileinfo object created.
- Add flags FOLLOW_LINK_ALWAYS, FOLLOW_LINK_EXISTS, FOLLOW_LINK_NEVER for the constructor. Functions as getPerms and getOwner will look at this setting.
- Add getBasename, to get the basename of either a dir or file.
- Function getLinkTarget, does readlink($this->getPathname())
- Function getRealpath, does realpath($this->getPathname())
- Function getOwnerName and getGroupName
- Function isHidden, to check wether a file is hidden
- Functions getTypeInfo and getMime, to get info of the file using libmagic
- Function setDirInfoClass, set a info class specially for directories
DirectoryIteratorRecursive:
- Add flag DIRS_ONLY for the constructor, to only loop through directories
- Add flag WITHOUT_HIDDEN_FILES for the constructor, not to loop through hidden files
- Function getFileCount
If you like these features, but don't have time to implement them, I can see if I can write a patch. I'm quite new at writing PHP extensions, but I know the basics.
Best regards,
Arnolds