Closed nao-pon closed 8 years ago
I'm not really sure what this does. Do we really need hasDir()
?
Can't we just do this for _subdirs:
protected function _subdirs($path)
{
$contents = $this->fs->listContents($path);
$dirs = array_filter($contents, function($item){
return $item['type'] == 'dir';
});
return ! empty($dirs);
}
And to check if the folder/file exists:
try {
$meta = $this->fs->getMetadata($path);
} catch (\Exception $e) {
return array();
}
It seems that FTP and local are now returning true on has()
calls for directories. Do we still need the hasDir
call?
There is an adapter that contains the value of the hasDir to metadata. (Such as flysystem-google-drive). We can be the perfect cache that does not cause the API calls such adapter. Like a demo site.
Can't you just return true
on the has($dir)
call?
has($dir) is "exists "$dir"?" but hasDir($dir) is "Have "$dir" sub-dirctory?".
Okay but checking the listContents() has the same effect, right? Both require an API call.
And for what reason do we need to check if they have subdirs?
On flysystem-google-drive, To optimize the API call gets the value of hasDir() in the target directory listContents().
And for what reason do we need to check if they have subdirs?
If there is a sub-directory in the tree view of elFinder comes out a triangle icon.
It's just that we need a lot of extra stuff, just for the Google Drive stuff, because it's different then the other drivers..
I agree. I want to create something that corresponds to also other adapter hasDir. But does not have the time...
For GoogleDrive adapter chooses to pass adapter loaded with cached adapter.
Thanks! :laughing:
prototype quality
ensureParentDirectories
method (for item ID base adapter)