Log message #4202316

# At Username Text
# Sep 8th 2019, 09:39 challgren Think about scalability and using memory wisely
# Sep 8th 2019, 09:38 challgren And creating the file in memory will take up memory which you’ve said is a concern, and what happens when 10+ users request a zip file
# Sep 8th 2019, 09:37 COOurb thnx
# Sep 8th 2019, 09:36 challgren Example would be `$this->QueuedJobs->createJob('DeleteZip', ['filename' => $tmp_zip], ['notBefore' => strtotime('+1 hour')]);`
# Sep 8th 2019, 09:35 COOurb ye, but it's kinda sad
# Sep 8th 2019, 09:33 challgren Like I said, create the zip, create a queue task to clean up in a certain time and serve the zip file to the user. The queue will clean up the file at the specified time
# Sep 8th 2019, 09:33 COOurb it's ok
# Sep 8th 2019, 09:33 COOurb yeah, I know there is ZipArchive built-in class
# Sep 8th 2019, 09:32 COOurb well, ok, I'll try that queue task plugin
# Sep 8th 2019, 09:32 challgren CakePHP provides no classes for zipping files. So you would need some other class in PHP or a native class provided by PHP
# Sep 8th 2019, 09:32 COOurb I mean, I saw /tmp directory
# Sep 8th 2019, 09:32 challgren What do you mean?
# Sep 8th 2019, 09:32 COOurb does cakephgp has something like that?
# Sep 8th 2019, 09:31 challgren You could but on a shared server anyone could access that file and you depend on the system to clean up the files
# Sep 8th 2019, 09:30 COOurb what if I use tmp directory via "php://tmp"?
# Sep 8th 2019, 09:29 challgren You realize there is no Zip class in cakephp
# Sep 8th 2019, 09:28 COOurb No correct way? Wow, that's upset.
# Sep 8th 2019, 09:27 challgren For my app I first check for the existing zip if not create the zip, then create a queue task to clean up the zip in 1 hour and then send the file to user
# Sep 8th 2019, 09:26 challgren Ok well you may miss responses from other people, but AFIK theres no correct way. The best way would be to generate it and send the zip and then clean up the temp file
# Sep 8th 2019, 09:25 COOurb so I can't
# Sep 8th 2019, 09:25 COOurb slack eats much RAM
# Sep 8th 2019, 09:25 challgren Also if you join us on slack you can see responses that may come in after you log off irc
# Sep 8th 2019, 09:25 COOurb Is there any example of correct way to do it? I mean, sending file without storing it permanently?
# Sep 8th 2019, 09:24 COOurb yeah, got it.
# Sep 8th 2019, 09:23 challgren You could add your task before calling return
# Sep 8th 2019, 09:23 COOurb As I know there is no execution after it
# Sep 8th 2019, 09:23 COOurb ok, but to send file to user I have to call 'return' or reach end of the action.
# Sep 8th 2019, 09:23 challgren https://github.com/dereuromark/cakephp-queue
# Sep 8th 2019, 09:22 COOurb queue task?
# Sep 8th 2019, 09:21 challgren You should be able to, or maybe a queue task to clean it up in a couple minutes
# Sep 8th 2019, 09:21 COOurb I mean, if I can't crete inmemory archive, can I send it then delete actual file?
# Sep 8th 2019, 09:21 COOurb Hey, can i call some functions after sending file to user?
# Sep 8th 2019, 09:20 COOurb nope
# Sep 8th 2019, 09:16 challgren https://github.com/maennchen/ZipStream-PHP might be better
# Sep 8th 2019, 09:15 challgren @coourb https://www.phpclasses.org/package/6110-PHP-Create-archives-of-compressed-files-in-ZIP-format.html might be helpful but its old
# Sep 8th 2019, 08:43 COOurb But I dunno how
# Sep 8th 2019, 08:42 COOurb inmemory archive
# Sep 8th 2019, 08:42 COOurb inmempo=
# Sep 8th 2019, 08:42 COOurb I think about creating archive but inmemry archive
# Sep 8th 2019, 08:42 COOurb how*
# Sep 8th 2019, 08:41 COOurb I need to send several files as response. Ho to do it?