View Single Post
  #4  
Old 15th June 2012, 10:08
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,383
Thanks: 833
Thanked 5,485 Times in 4,317 Posts
Default

It would be great of course if you could implement it in ispconfig directly

Such a script requires actions as root user, so it has to be be splitted into a interface part where you can define the settings like remote server IP, root password and database login. The interface part then writes the config data as an action to the sys_remoteaction and a server side plugin must be registered for the action event and start the migration. So there is no need for a additional database table for such a job. The new action framework has been added in SVN and will be part of 3.0.5.

A SQL query to insert a action might look like this:

Code:
$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
								"VALUES (".
								(int)$this->form->dataRecord['server_id'] . ", " .
								time() . ", " .
								"'backup_restore', " .
								"'".$backup_id."', " .
								"'pending', " .
								"''" .
								")";
Instead of the $backup_id you can also add several parameters as serialized array.


For the server side plugin, see new backup plugin as example for using the actions framework:

/usr/local/ispconfig/server/plugins-available/backup_plugin.inc.php
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote