function deploy_services_client_unpublish_entity_from_endpoint in Deploy Services Client 7
Unpublishes an entity from a Deployment endpoint.
The endpoint is first contacted to see if the entity exists there and is currently published. If so, only then is an actual request to unpublish the entity made.
Parameters
EntityMetadataWrapper $entity: The entity object to unpublish. Construct this by calling entity_metadata_wrapper() on a normal Drupal entity.
DeployEndpoint $endpoint: The endpoint object (as returned by deploy_endpoint_load()) representing the Deployment endpoint on which a request will be made to unpublish the entity.
Return value
TRUE if the entity was unpublished on the endpoint, or FALSE if it did not exist on the endpoint or did exist but was already unpublished there.
Throws
1 string reference to 'deploy_services_client_unpublish_entity_from_endpoint'
- deploy_services_client_unpublish_entity_from_plan_endpoints in ./
deploy_services_client.module - Unpublishes an entity from endpoints associated with a Deployment plan.
File
- ./
deploy_services_client.module, line 108 - Provides a Services client which communicates with Deployment endpoints.
Code
function deploy_services_client_unpublish_entity_from_endpoint(EntityMetadataWrapper $entity, DeployEndpoint $endpoint) {
$success = FALSE;
$client = new DeployServicesClient($endpoint);
$client
->login();
if (($entity_data = $client
->get($entity)) && !empty($entity_data['status'])) {
// @todo: If the unpublish method can be changed to have a return value, we
// should return that, rather than assuming the entity was always
// unpublished successfully.
$client
->unpublish($entity);
$success = TRUE;
}
$client
->logout();
return $success;
}