function deploy_log in Deploy - Content Staging 7.2
Same name and namespace in other branches
- 7.3 deploy.module \deploy_log()
Helper function to log deployments.
This function also logs to the watchdog log for more visibility.
Parameters
mixed $key: Can be either an existing key (UUID) or a string of a plan name indicating that a new deployment is started and a key needs to be generated.
integer $status: Status code.
string $message: A message to log.
array $variables: Placeholder variables to be used in $message.
5 calls to deploy_log()
- DeployEndpoint::deploy in includes/
DeployEndpoint.inc - Deploys all entities over to the endpoint.
- DeployEndpoint::publish in includes/
DeployEndpoint.inc - Publishes all entities on the endpoint. Happens after deployment.
- DeployPlan::deploy in includes/
DeployPlan.inc - Deploy the plan.
- DeployProcessorBatch::deploy in plugins/
DeployProcessorBatch.inc - Main processing method that should hand over the aggregator to the endpoint to deploy all the entities.
- DeployProcessorQueue::deploy in plugins/
DeployProcessorQueue.inc - Main processing method that should hand over the aggregator to the endpoint to deploy all the entities.
1 string reference to 'deploy_log'
- deploy_plan_get_status in ./
deploy.module - Helper function to recieve the status of a plan.
File
- ./
deploy.module, line 460 - Deploy module functions.
Code
function deploy_log($key, $status, $message = '', $variables = array(), $timestamp = NULL) {
// Log to watchdog for more visibility.
$info = deploy_status_info($status);
if ($status == DEPLOY_STATUS_FAILED) {
watchdog_exception('deploy', $message);
}
else {
watchdog('deploy', $info['keyed message'], array(
'%key' => $key,
), $info['watchdog']);
}
if ($timestamp === NULL) {
$timestamp = time();
}
// If the key isn't a UUID, then it's a plan name indicating that a new
// deployment has started.
if ($key && !uuid_is_valid($key)) {
$plan_name = $key;
$key = uuid_generate();
db_insert('deploy_deployments')
->fields(array(
'plan_name' => $plan_name,
'uuid' => $key,
))
->execute();
}
if (uuid_is_valid($key)) {
// Add the log entry for this deployment.
$lid = db_insert('deploy_log')
->fields(array(
'uuid' => $key,
'status' => $status,
'message' => $message,
'timestamp' => $timestamp,
))
->execute();
// Update the log pointer for this deployment.
db_update('deploy_deployments')
->fields(array(
'lid' => $lid,
))
->condition('uuid', $key)
->execute();
return $key;
}
return FALSE;
}