function deploy_manager_get_entities in Deploy - Content Staging 7.3
Same name and namespace in other branches
- 7.2 deploy.manager.inc \deploy_manager_get_entities()
Returns the items for a given plan.
Parameters
$plan_name: Name of the managed plan to fetch entities from.
2 calls to deploy_manager_get_entities()
- DeployAggregatorManaged::getEntities in plugins/
DeployAggregatorManaged.inc - Get aggregated entities.
- deploy_services_diff_plan in modules/
deploy_services/ deploy_services.services.inc - Services targeted action to show diff of all entities of a plan
File
- ./
deploy.manager.inc, line 13 - Deploy module functions for handling managed entities in plans.
Code
function deploy_manager_get_entities($plan_name) {
$entities = array();
$result = db_query("SELECT * FROM {deploy_manager_entities} WHERE plan_name = :plan_name ORDER BY timestamp", array(
':plan_name' => $plan_name,
));
foreach ($result as $record) {
$entities[] = array(
'type' => $record->entity_type,
'id' => $record->entity_id,
'revision_id' => $record->revision_id,
);
}
// If the plan fetched from the database is empty, try fetch default UUID
// entities (keyed with this plan name).
if (empty($entities)) {
if (module_exists('features')) {
features_include_defaults(array(
'uuid_entities',
));
}
$plans = module_invoke_all('uuid_default_entities');
if (isset($plans[$plan_name])) {
foreach ($plans[$plan_name] as $entity) {
// We don't want entities that has a cause, i.e. not dependencies, because
// those'll be taken care of when the service iterates over the queue.
if (empty($entity->__metadata['cause'])) {
$entity_type = $entity->__metadata['type'];
$entity_info = entity_get_info($entity_type);
$entity_ids = entity_get_id_by_uuid($entity_type, array(
$entity->{$entity_info['entity keys']['uuid']},
));
$entity_id = reset($entity_ids);
if (!empty($entity_id)) {
$entities[] = array(
'type' => $entity_type,
'id' => $entity_id,
);
}
}
}
}
}
return $entities;
}