fetch()) { drush_log(dt("Destroying @resource", array('@resource' => $resource->uri))); $context = $resource->context; if (!$context) { drush_log(dt('Context missing for resource @resource, guessing', array('@resource' => $resource->uri)), 'warning'); $context = $resource->uri; } provision_backend_invoke($context, 'provision-delete'); } drush_log(dt('Destroying platforms'), 'info'); $query = db_query("SELECT n.title AS uri, h.name AS context FROM {node} n INNER JOIN {hosting_platform} p LEFT JOIN {hosting_context} h ON h.nid = n.nid WHERE n.type = '%s' AND p.status != %d AND h.name != '%s'", 'platform', -2, d('@hostmaster')->platform->name); while ($resource = $query->fetch()) { drush_log(dt("Destroying @resource", array('@resource' => $resource->uri))); $context = $resource->context; if (!$context) { drush_log(dt('Context missing for platform @resource, ignoring', array('@resource' => $resource->uri)), 'warning'); } else { provision_backend_invoke($context, 'provision-delete'); } } drush_log(dt('Destroying servers'), 'info'); $query = db_query("SELECT n.title AS uri, h.name AS context FROM {node} n LEFT JOIN {hosting_context} h ON h.nid = n.nid WHERE n.type = '%s' AND h.name != '%s' AND h.name != '%s'", 'server', d('@hostmaster')->server->name, d('@hostmaster')->db_server->name); while ($resource = $query->fetch()) { drush_log(dt("Destroying @resource", array('@resource' => $resource->uri))); $context = $resource->context; if (!$context) { drush_log(dt('Context missing for platform @resource, ignoring', array('@resource' => $resource->uri)), 'warning'); } else { provision_backend_invoke($context, 'provision-delete'); } } } drush_log(dt('Destroying main hostmaster site'), 'info'); provision_backend_invoke('@hostmaster', 'provision-delete'); drush_log(dt('Removing crontab'), 'info'); exec('crontab -r'); drush_log(dt('Removing alias'), 'info'); $config = new Provision_Config_Drushrc_Alias('@hostmaster'); $config->unlink(); }