Hey I finally got around to looking at the automated restore, only to find it was extremely simple and easily added to your tool.
In gui/public/client/backup.php I found the following function, and send_request() appears to be essentially the same as /var/www/imscp/engine/imscp-rqst-mngr in that it calls the daemon to make the changes. If/how you implement the one line of SQL is up to you, but personally I think specifying it via domain name would be better 99% of the time, and it's only one more line. You could have both, with the domain code calling the ID code.
I've only skimmed your code thus-far, but if you really want I could send something more for you. This is really all you need though right?
- /**
- * Schedule backup restoration.
- *
- * @param int $userId Customer unique identifier
- * @return void
- */
- function scheduleBackupRestoration($userId)
- {
- exec_query("UPDATE `domain` SET `domain_status` = ? WHERE `domain_admin_id` = ?", array('torestore', $userId));
- send_request();
- write_log($_SESSION['user_logged'] . ": scheduled backup restoration.", E_USER_NOTICE);
- set_page_message(tr('Backup has been successfully scheduled for restoration.'), 'success');
- }
Display More
Edit: Just wanted to note again for nux etc, if this was how imscp called the commands, via a central library. This action in backup.php could read do_action('restore_domain', $userId); and we could call it via do_action.php restore_domain X. Exactly like you've been building but without code reuse and maintained with imscp, so no future mismatches. It could be moved there gradually too. I'll happily help with this, though I don't know where anything is. If I made a big effort and created the library and updated these other files to reference it, would it even be included?