This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I see my storage/temp/uploads
folder is bigger than 4Gb.
And i unable found how to clearing that temporary dir and why is not clearing by default.
October version 1.1.0 build 382
temp_path
used in resizer https://github.com/octobercms/october/blob/f8f5e6e02273c81488542e51be50b5baed7a8af2/modules/system/classes/ImageResizer.php#L341-L341
Used also in File class: https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L973-L973
In the case with use remote filesystem storage like S3, original image needed to be copied to local filesystem into temp_path: https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L656-L656
But i not found solutions for automatic clearing this folder.
Is actual result, that dir contains tonns of megabytes.
Nop. cache:clear
clearing redis or file cache. But is not clearing files instorage/temp/*
folders.
$ du -hsx storage/temp/
4.1G storage/temp/
$ ./artisan cache:clear
Application cache cleared!
$ du -hsx storage/temp/
4.1G storage/temp/
A tried create solution, but a think that is needed more research https://github.com/alserom/octobercms_clearcachewidget/pull/21.
And i not sure, "what is that": Bug or wrong use case.
Temp files are supposed to be cleaned by the code that spawned them, the ImageResizer cleans up here (https://github.com/octobercms/october/blob/f8f5e6e02273c81488542e51be50b5baed7a8af2/modules/system/classes/ImageResizer.php#L326), and the File resizer cleans up here: https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L684
@LukeTowers ImageResizer and makeThumbStorage method remove temp file - it`s ok.
But getWidthAttribute and also getHeightAttribute methods make local copy of the file downloaded from s3-storage and not to be removed it.
Example stack trace:
- https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L971
- https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L751
- https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L432
- https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L532
- https://github.com/octobercms/library/blob/396f65dc139d0a62b7fb61b767e86aa57a115761/src/Database/Attach/File.php#L239
I can create bug-report in the github?
No, that's expected behaviour. If it didn't locally cache those files then every single time you rendered a page containing getWidthAttribute or getHeightAttribute you would have to redownload the image and calculate those values. How else would you have that functionality handle remote storage?
Yes. I understand. Repeated download every time it means slow down the page. i have no ideas for resolve this issue. May be i go to write code in lua on nginx and relocate get width/height functinality to proxy server and cached result on site. But i do not have lua-module on proxy nginx server and that is intrioduce biggs complexity of infrastructure.
In my case i interest width/height only the original image. May be, my way - save data of the width/height properties on th custom database model, also need getting this data from remote filesystem without downloaded multi megabytes files. That not public and not production-ready solution. And i think this topic is closed.
May be that is solution for future: User-defined object metadata: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
When uploading file to S3 - need save height/wight and other needs-calculating attributes. i got idea from https://stackoverflow.com/a/20247191/1790808
S3 minio also support metadata api: https://stackoverflow.com/questions/49230684/metadata-on-minio-object-storage
1-10 of 10