function deploy_item in Deploy - Content Staging 6
Deploy a specified item to a remote server.
Parameters
$item: The item being deployed.
3 calls to deploy_item()
- deploy_item_batch in ./
deploy.module - Wrapper function to deploy_item() with batch API goodness.
- deploy_plan in ./
deploy.module - Deploy the specified plan to a remote server
- drush_deploy in includes/
deploy.drush.inc - Deploy a plan from the command line with drush.
File
- ./
deploy.module, line 775 - Deployment API which enables modules to deploy items between servers.
Code
function deploy_item($item) {
// By default, xmlrpc.inc is only included when xmlrpc() is called.
// Since I am using xmlrpcerror() as an error handler (unfortunately)
// there is an edge case where I'll need this loaded before I've called
// xmlrpc(). So I include it manually here.
include_once './includes/xmlrpc.inc';
// Static error flag so that we can use it between calls and not have to
// handle errors in the batch process.
$deploy_fatal = variable_get('deploy_fatal', FALSE);
// If nothing has previously errored out, then try and deploy the current item.
// Otherwise, note in the log that this item was not deployed due to previous error.
if (!$deploy_fatal) {
// Call the module's deployment function.
$xmlrpc_result = module_invoke($item['module'], 'deploy', $item['data']);
// If it results in failure, log the error message and set the $deploy_fatal
// flag. Otherise log success and move onto the next one.
if ($xmlrpc_result === FALSE) {
variable_set('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.');
}
// And log the results.
db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", variable_get('deploy_log_id', ''), $item['module'], $item['description'], $result, $message);
}