I agree. I actually just changed the frontend adapter to use the ActionsInterface last night as I was hooking up to the DI container.
https://github.com/Molajo/Filesystem/blob/master/Adapter/ActionsInterface.phpThe Adapter was using the following - but it was really an over simplification so I went with both (will combine) Sounds like you agree:
https://github.com/Molajo/Filesystem/blob/master/Adapter/AdapterInterface.phpThere are other interfaces that define Metadata, :
https://github.com/Molajo/Filesystem/blob/master/Adapter/AdapterInterface.phpThe system interface (important for those filesystems that require credentials)
https://github.com/Molajo/Filesystem/blob/master/Adapter/SystemInterface.phpAnd, it will have a fileupload interface (not done) (Still not sure if it should be in the HTTP package or the Filesystem package or both).
Now it instantiates a Filesystem type, like Local
$local = new Molajo/Filesystem/Adapter('Local');
// Read a file
$results = $local->read('path/to/file.txt');
// Metadata for file or folder
$results = $local->getMetadata('path');
// List folders and files - recursively is optional
$results = $local->getList('path', $recursive);
// Deletes a file or folder - optionally removing subdirectories (safety)
$results = $local->delete('can/be/folder/or/file.txt', $delete_subdirectories);
// Copies a file or folder/files to target, can be copied between filesystems
$results = $local->copy('source/folder/or/file.txt', 'target/folder', 'target-file-name.txt', $replace, $target-filesystem);
// Moves a file or folder/files to target, can be copied between filesystems
$results = $local->move('source/folder/or/file.txt', 'target/folder', 'target-file-name.txt', $replace, $target-filesystem);
// ChangeOwner
$results = $local->changeOwner('folder/or/file.txt', $username);
// Change Group
$results = $local->changeGroup('folder/or/file.txt', $groupid);
// Change Permission
$results = $local->changePermission('folder/or/file.txt', $permission);
// Touch
$results = $local->touch('folder/or/file.txt', $modification_time, $access_time);
Is that heading the right direction?
Thanks for your feedback.
Absolutely.
Regards,
Andrew Eddie