function deploy_pushform_submit in Deploy - Content Staging 5
submit handler for deployment push form
File
- ./
deploy.module, line 625
Code
function deploy_pushform_submit($form_id, $form_values) {
global $user;
$pid = $form_values['pid'];
$plan = deploy_get_plan($pid);
$sid = $form_values['sid'];
$server = deploy_get_server($sid);
$url = $server['url'];
$api_key = $server['api_key'];
$deploy_fatal = FALSE;
// rather than save foreign keys out to the server/plan/user in the log,
// I'm saving actual identifying data. This keeps the log pure in case
// associated data gets deleted.
$dlid = db_next_id('{deploy_log}_dlid');
db_query("insert into {deploy_log} (dlid, plan, server, username, ts) values (%d, '%s', '%s', '%s', %d)", $dlid, $plan['name'], $server['description'], $user->name, time());
$items = db_query("select * from {deploy_plan_items} where pid = %d order by weight", $pid);
while ($item = db_fetch_array($items)) {
if (!$deploy_fatal) {
$xmlrpc_result = call_user_func($item['module'] . '_deploy', $url, $api_key, $item['data']);
if ($xmlrpc_result === FALSE) {
$deploy_fatal = TRUE;
$result = t('Error');
$message = xmlrpc_error_msg();
}
else {
$result = t('Success');
$message = '';
}
}
else {
$result = t('Not Sent');
$message = t('Item not sent due to prior fatal error.');
}
$dldid = db_next_id('{deploy_log_details}_dldid');
db_query("insert into {deploy_log_details} (dldid, dlid, module, description, result, message) values (%d, %d, '%s', '%s', '%s', '%s')", $dldid, $dlid, $item['module'], $item['description'], $result, $message);
}
return "/admin/build/deploy/logs/details/{$dlid}";
}