Commit 72da049b authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

#321944 - provision setup command added. this is a subset of the hosting setup...

#321944 - provision setup command added. this is a subset of the hosting setup command and is only visible when the hosting module is not installed. This handles configuration of filesystem and the drush.php symlink
parent 83f2f551
......@@ -281,6 +281,13 @@ function provision_drush_command() {
'description' => 'Delete a site.'
);
if (!function_exists('hosting_setup')) {
$items['provision setup'] = array(
'callback' => '_provision_setup_cmd',
'description' => 'Initialize this platform to be able to create hosted sites.',
);
}
/*
// Not implemented yet.
$items['provision deploy'] = array(
......@@ -664,3 +671,43 @@ function _provision_delete($url) {
provision_output($url, $data);
}
/**
* Initial setup of platform
*
* Creates symlink to drush.php
* Creates config path
* Creates drushrc path
*
* This function is re-used by the hosting_setup command, as it is a superset of this functionality.
*/
function _provision_setup() {
$success = TRUE;
$drush_path = sprintf("%s/%s/drush.php", PROVISION_DOCROOT_PATH, drupal_get_path('module', 'drush'));
$success &= provision_path('symlink', $drush_path, PROVISION_DOCROOT_PATH . '/drush.php',
t('Created symlink for drush.php file'),
t('Could not create symlink for drush.php'),
PROVISION_FRAMEWORK_ERROR);
$success &= _provision_create_dir(PROVISION_CONFIG_PATH, t('Config path'), 0700);
$success &= _provision_create_dir(PROVISION_DRUSHRC_PATH, t('Drush config path'), 0700);
return $success;
}
/**
* Drush command wrapper for the setup of the platform
*/
function _provision_setup_cmd() {
_provision_setup();
// @TODO use provision_output for this, but we need pretty print first.
$logs = provision_get_log();
foreach ($logs as $log) {
print "$log[message]\n";
}
if (provision_get_error()) {
print "\nThe command did not complete successfully, please fix the issues and re-run this script.";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment