Show Restore Tracking info in Admin Backup/Transfer

Version 1.60.0

Feature
Finished

New "restore" type of process tracking for restores, similar to the existing backup process tracker. The Level 1 percent bar is based on the User-data only backup settings, meaning there will be 3 phases per user (if applicable): 1 - cpmove-to-DA conversion 2 - decryption 3 - user restore Each phase will go from 0 to 100% (although the first 1 are just full steps) The larger level 0 percent bar is as it is for backups, either 1 or 2 per User, depending on if there are ftp downloads involved. So 10 Users will have 10% steps, unless downloading from ftp, then will be 5% steps. The "Active Backups" table on CMD_ADMIN_BACKUP will have a new column after "Start Time" showing "Type". Each row will either be type "Backup" or "Restore" The "Backup ID" column will always be blank for restores, since restores don't have crons. =========== SSE STREAM Although the older JS method of calling browser function still works for this, we've added support for proper SSE streaming. To make use of the new streaming syntax, simply include type=sse in the stream request, eg: CMD_ADMIN_BACKUP?action=monitor&pid=555&get=tracking_data&type=sse The start of each stream will begin the line with "data: " The next part will be {} json data, followed by 2 newline characters. More/immediate data: lines could follow at any time, even in the same packet. DA does assemble all sections into one data packet, when possible. Possible data variables: finished: 0|1 #always sent percent: 0.00-100.00 #do not assume 100 means the stream is done. There are a few steps which will jump around. dynamic_text: <some text> dynamic_details: <some text> #items relating to file compression/growing: process_info: #not used, relates to add_process_info() JS function quota: 1234 #bytes, disk space used by the User account, to give a rought max size of the compressing file. quota_readable:" (Account Usage: 1.23 Meg)" filesize: 1234 #size of the tar.gz as it compresses. Compare this to quota for your % filesize_readable: 1.23 Meg ---- Sample: data: { "dynamic_text": "Restoring User from user.admin.backtest.tar.gz", "finished": "0" } data: { "dynamic_details": "Extracting backup_options.list", "finished": "0" } data: { "dynamic_details": "", "dynamic_text": "Backup Complete", "finished": "1", "percent": "100" } Note: The texts above will *not* be html encoded. The json encoding will ensure quotes are properly escaped, but ensure you html encode any scripts before inserting them into your document. =========== DEBUG If you have small restores but wish to see the progress and need to slow it down, use debug level 2019 in the dataskq. Eg, issue the restore through the GUI and quickly run: ./dataskq d2019 where each tracking "step" adds a 5 second sleep, allowing time to debug what the output is. =========== JSON The current_backups will have a new column called "type", set to backup or restore. "current_backups": { "0": { "pid": "7958", "id": "", "start": { "dayofmonth": "", "dayofweek": "", "hour": "", "minute": "", "month": "" }, "type": "restore", "who": { "select": [ "user.admin.backtest.tar.gz" ], "who": "selected" }, "where": "/home/admin/admin_backups", "progress": "0.00%", "details": "CMD_ADMIN_BACKUP?action=monitor&pid=7958" }, "info": { "columns": { "pid": "1", "id": "2", "start": "3", "type": "4", "who": "5", "where": "6", "progress": "7", "details": "8" }, "current_page": "1", "ipp": "99999", "rows": "1", "total_pages": "1" } },

Try DirectAdmin with a 30-day money back guarantee!