Implement XML-RPC function to finish a job
This commit is contained in:
@@ -45,6 +45,7 @@ class Xmlrpc extends CI_Controller {
|
|||||||
|
|
||||||
$config['functions']['heartbeat'] = array('function' => 'Xmlrpc._heartbeat');
|
$config['functions']['heartbeat'] = array('function' => 'Xmlrpc._heartbeat');
|
||||||
$config['functions']['get_job'] = array('function' => 'Xmlrpc._get_job');
|
$config['functions']['get_job'] = array('function' => 'Xmlrpc._get_job');
|
||||||
|
$config['functions']['job_done'] = array('function' => 'Xmlrpc._job_done');
|
||||||
$config['object'] = $this;
|
$config['object'] = $this;
|
||||||
|
|
||||||
$this->xmlrpcs->initialize($config);
|
$this->xmlrpcs->initialize($config);
|
||||||
@@ -118,4 +119,27 @@ class Xmlrpc extends CI_Controller {
|
|||||||
return $this->xmlrpc->send_response($response);
|
return $this->xmlrpc->send_response($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _job_done($request) {
|
||||||
|
$this->load->model('job');
|
||||||
|
$parameters = $request->output_parameters();
|
||||||
|
$server = $this->server->getBySecret($parameters[0]);
|
||||||
|
|
||||||
|
//TODO: Auth
|
||||||
|
//if($server)
|
||||||
|
// return $this->xmlrpc->send_error_message('100', 'Invalid Access');
|
||||||
|
$parameters = $parameters[1];
|
||||||
|
|
||||||
|
$job_id = $parameters[0];
|
||||||
|
|
||||||
|
$update = array(
|
||||||
|
'finished_at' => mysql_now(),
|
||||||
|
'progress' => 100
|
||||||
|
);
|
||||||
|
$this->job->update($job_id, $update);
|
||||||
|
$response = array(array(
|
||||||
|
'success' => array('true', 'string'),
|
||||||
|
), 'struct');
|
||||||
|
return $this->xmlrpc->send_response($response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user