filesize(), filectime() and filetype() functions fail on certain folders.
protected function createServerFileList($node, $relative_path) {
// ...
$files = file_scan_directory($directory, '/.*/', ['recurse' => false]);
debug($files);
// outputs all files in $directory
foreach ($files as $key => $file) {
$file->size = filesize($file->uri);
$file->type = filetype($file->uri);
$file->timestamp = filectime($file->uri);
return $files;
}directory contains directories and files. For the files, the stat functions performs well. But for most (not all) of the directories the stat() functions will fail:
User warning: stat(): No such file or directory in Twistor\FlysystemStreamWrapper->triggerError() (line 887 of
vendor\twistor\flysystem-stream-wrapper\src\FlysystemStreamWrapper.php).
Warning: filesize(): stat failed for s3://documenten in Drupal\filebrowser\ServerFileList->createServerFileList() (line 87 of modules\filebrowser\src\ServerFileList.php).
User warning: stat(): No such file or directory in Twistor\FlysystemStreamWrapper->triggerError() (line 887 of vendor\twistor\flysystem-stream-wrapper\src\FlysystemStreamWrapper.php).
Warning: filetype(): Lstat failed for s3://documenten in Drupal\filebrowser\ServerFileList->createServerFileList() (line 88 of modules\filebrowser\src\ServerFileList.php).
User warning: stat(): No such file or directory in Twistor\FlysystemStreamWrapper->triggerError() (line 887 of vendor\twistor\flysystem-stream-wrapper\src\FlysystemStreamWrapper.php).
Warning: filectime(): stat failed for s3://documenten in Drupal\filebrowser\ServerFileList->createServerFileList() (line 90 of modules\filebrowser\src\ServerFileList.php).$schemes['s3'] = [ 'driver' => 's3', 'config' => [ 'key' => key, 'secret' => secret, 'region' => 'eu-west-1', 'bucket' => 'nftr', #Optional configuration settings. #'options' => [ # 'ACL' => 'public-read', # 'StorageClass' => 'REDUCED_REDUNDANCY', #], #'protocol' => 'https', #'prefix' => 'prefix', #'cname' => 'static.example.com', // A cname that resolves to your bucket. Used for URL generation. ], 'cache' => TRUE, // Creates a metadata cache to speed up lookups. ];
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | flysystem_s3-2808579-3.patch | 1.13 KB | twistor |
Comments
Comment #2
twistor commentedComment #3
twistor commentedCan you make sure league/flysystem-aws-s3-v3 is up-to-date. Should be at version 1.0.11.
Then, try this patch.
Comment #4
clivesj commentedCan you supply the link to the patch?
Comment #5
twistor commentedoops, I forgot the patch.
Comment #6
twistor commentedIs the problem that some of these directories were create by Drupal, and that some were not? If so, then this patch should fix it.
Comment #7
clivesj commentedI was trying to find out if there was any consistencies between the failing directories. But couldn't find any.
As a matter of fact I can not reproduce the errors on my today's trials. Even the ones failing before. I have been switching between PHP versions. I am wondering whether caching is involved.
Any way I would like to propose to put the the issue status to *postponed - maintainer needs more info* until I can come back with more specific feedback.
Comment #8
twistor commentedAnother thing to check would be the S3 permissions.
Comment #9
deviantintegral commentedSounds like we can close this, unless we've got a reproduction for it?
Comment #10
clivesj commentedYes, thank you.