Backup client data with ServerConnect - PHP

Backup client data with ServerConnect - PHP

I want to make a backup for my client so that they can keep their data of each "project" they create.

Can you guys give me some input on what else i can do... or consider.

  1. I will create a table called backups.. that will have a id, uid, timestamp, title of the backup. So the client can select out of a list of projects which one to backup... Then when the client press backup.
  2. It will insert this project into the database... create a unique folder from the uid on the server.
  3. Export the sql data to a csv and save that to the uid folder
  4. Export eg images.. eg.. look for the images, dupicate them into a folder
  5. Zip the folder
  6. And then after a day with the timestamp delete it from the server. / or can be done manually by the client.

BUT here is where i need some work around.. or help... How can this serverconnect keep running even if the client closed the page.... because the CSV data will be fairly quick.. BUT the images.. might be 5000 images per project.... please note its not on a S3 .. the images are stored on the server itself...

my worry is.. if the client leaves the page.. then the serverconnect will stop...

Is there a way,... that when the client click make backup.. it will keep doing its thing regardless.... eg "duplicating" those images into a folder.... and then ziping it as per server connect action??

Hi friend,

<?php
ignore_user_abort(true);
//set_time_limit(0);

I don't know how to apply in Wappler, it has to be applied to the Server Action and not the webpage itself

Hi Apple... cool.. so you say,, if i add this to my server connect file at the top.... ignore_user_abort(true); it will keep on running even if the page is closed... that will be cool bananas....

ill manually add it just below.
require('../../../dmxConnectLib/dmxConnect.php');

let me give that a go........

I’d love to hear how you implement this @Mozzi … I need this ignore abort option for my checkout…

If your plan doesn’t work, could you do it as a custom function? :thinking:

I’m surprised it isn’t just a standard option in a server action…

Hi Anthony... i have not gone that far yet.. BUT.. Apple gave the idea.. and found this How to set php ignore user abort in Server Connect? - #8 by transcoderm ... seems like transcoderm made it work ...

"*I managed to work around the session locking or synchronous script issues (whatever they are) by using the Fetch API. Instead of using a dynamic event, I use a static event on success/done to call the SA mail API using a JavaScript function. This way, my mail script can run in the background without interfering with the current page." --- transcoderm

as im ziping a folder.. it seems to still do the trick even if i leave the page.. so for my use case scenario... it seems to zip without having to add ignore_user_abort(true);