Commit 71a10d34 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Synched head with d6 branch. Works with drush 2.x and no longer needs to be...

Synched head with d6 branch. Works with drush 2.x and no longer needs to be enabled on a site, as it is no longer a module. Hosting has not been updated to point to the right place per server, so you have to create the symlink to the central drush.php yourself. I have not sorted out the version specific stuff yet either.
parent e6053db5
......@@ -9,7 +9,7 @@ function provision_mysql_provision_pre_install(&$data, $url = NULL) {
$data['db_host'] = ($data['db_host']) ? $data['db_host'] : PROVISION_DB_HOST;
# generate a random password for use
$data['db_passwd'] = user_password();
$data['db_passwd'] = provision_password();
$data['db_name'] = _provision_mysql_suggest_db_name($data, $url);
$data['db_user'] = $data['db_name'];
......
......@@ -22,7 +22,7 @@ function provision_db_connect() {
if (!$connection) {
provision_set_error(PROVISION_DB_ERROR);
provision_log('error', pt('Could not connect to the master database.'));
provision_log('error', dt('Could not connect to the master database.'));
}
else {
$success = @mysql_select_db('mysql', $connection);
......@@ -31,7 +31,7 @@ function provision_db_connect() {
}
else {
provision_set_error(PROVISION_DB_ERROR);
provision_log('error', pt('Could not select the mysql database.'));
provision_log('error', dt('Could not select the mysql database.'));
return FALSE;
}
}
......
......@@ -32,11 +32,11 @@ function _provision_mysql_new_site_db($db_name, $db_user, $db_passwd, $db_host)
$status = _provision_mysql_database_exists($db_name);
if ($status) {
provision_log('success', pt('Created @name database', array("@name" => $db_name)));
provision_log('success', dt('Created @name database', array("@name" => $db_name)));
}
else {
provision_set_error(PROVISION_DB_ERROR);
provision_log("error", pt("Could not create @name database", array("@name" => $db_name)));
provision_log("error", dt("Could not create @name database", array("@name" => $db_name)));
}
return $status;
//TODO : Test to confirm that the database is actually writeable. Taking this on faith for now.
......@@ -48,9 +48,9 @@ function _provision_mysql_new_site_db($db_name, $db_user, $db_passwd, $db_host)
function _provision_mysql_destroy_site_db($db_name, $db_user, $db_passwd, $db_host) {
if ( _provision_mysql_database_exists($data['db_name']) ) {
provision_log("notice", t("Dropping database @dbname", array('@dbname' => $db_name)));
provision_log("notice", dt("Dropping database @dbname", array('@dbname' => $db_name)));
if (!_provision_mysql_drop_database($db_name)) {
provision_log("warning", t("Failed to drop database @dbname", array('@dbname' => $db_name)));
provision_log("warning", dt("Failed to drop database @dbname", array('@dbname' => $db_name)));
}
}
......@@ -63,7 +63,7 @@ function _provision_mysql_destroy_site_db($db_name, $db_user, $db_passwd, $db_ho
provision_log("notice", "Revoking privileges");
_provision_mysql_flush_privileges();
if (!_provision_mysql_revoke($db_name, $db_user)) {
provision_log("warning", t("Failed to revoke user privileges"));
provision_log("warning", dt("Failed to revoke user privileges"));
}
}
......@@ -89,7 +89,7 @@ function _provision_mysql_can_create_database() {
_provision_mysql_create_database($test);
if (_provision_mysql_database_exists($test)) {
if (!_provision_mysql_drop_database($test)) {
provision_log("warning", t("Failed to drop database @dbname", array('@dbname' => $test)));
provision_log("warning", dt("Failed to drop database @dbname", array('@dbname' => $test)));
}
return TRUE;
}
......@@ -108,18 +108,18 @@ function _provision_mysql_revoke($name, $username, $host = '') {
function _provision_mysql_import_dump($dump_file, $db_name, $db_user, $db_passwd, $db_host) {
$exists = provision_path("exists", $dump_file, TRUE,
t('Found database dump at @path.'),
t('No database dump was found at @path.'),
dt('Found database dump at @path.'),
dt('No database dump was found at @path.'),
PROVISION_FRAMEWORK_ERROR);
if ($exists) {
$readable = provision_path("readable", $dump_file, TRUE, t('Database dump at @path is readable'),
t('The database dump at @path could not be read.'),
$readable = provision_path("readable", $dump_file, TRUE, dt('Database dump at @path is readable'),
dt('The database dump at @path could not be read.'),
PROVISION_PERM_ERROR);
if ($readable) {
provision_log("notice", sprintf("Importing database using command: mysql -u%s -p%s -h%s %s < %s",
$db_user, $db_passwd, $db_host, $db_name, $dump_file));
if (!provision_shell_exec("mysql -u%s -p%s -h%s %s < %s", $db_user, $db_passwd, $db_host, $db_name, $dump_file )) {
provision_log("error", t("Database import failed"));
provision_log("error", dt("Database import failed"));
}
}
}
......
......@@ -12,7 +12,7 @@ function provision_mysql_provision_pre_restore(&$data, $url = NULL) {
$data['old_db_host'] = $data['db_host'];
# generate a random password for use
$data['db_passwd'] = user_password();
$data['db_passwd'] = provision_password();
$data['db_name'] = _provision_mysql_suggest_db_name($data, $url);
$data['db_user'] = $data['db_name'];
......@@ -38,8 +38,8 @@ function provision_mysql_provision_pre_restore_rollback(&$data, $url = NULL) {
// made. Which could go on infinitely if something is really long.
function provision_mysql_provision_post_restore(&$data, $url = NULL) {
provision_path('unlink', 'sites/'. $url .'/database.sql', TRUE,
t("Removed dump file @path after restoring from it"),
t("Could not remove dump file @path"), PROVISION_PERM_ERROR);
dt("Removed dump file @path after restoring from it"),
dt("Could not remove dump file @path"), PROVISION_PERM_ERROR);
_provision_mysql_destroy_site_db($data['old_db_name'], $data['old_db_user'], $data['old_db_passwd'], $data['old_db_host']);
}
......@@ -13,10 +13,10 @@ function provision_mysql_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) {
if (!_provision_mysql_can_create_database()) {
provision_set_error(PROVISION_DB_ERROR | PROVISION_FRAMEWORK_ERROR);
provision_log('error', t('Unable to create new databases.'));
provision_log('error', dt('Unable to create new databases.'));
}
else {
provision_log("message", t('Mysql can create new databases.'));
provision_log("message", dt('Mysql can create new databases.'));
}
}
}
......
......@@ -21,8 +21,8 @@ function provision_drupal_provision_backup_validate(&$data, $url = NULL, $backup
if ($backup_file) {
if ( provision_path("exists", $backup_file, FALSE,
t("Backing site up to @path."),
t("Back up file @path already exists."),
dt("Backing site up to @path."),
dt("Back up file @path already exists."),
PROVISION_FRAMEWORK_ERROR)) {
$data['backup_file'] = $backup_file;
}
......
......@@ -2,7 +2,7 @@
// $Id$
require_once(dirname(__FILE__) . '/../provision.inc');
require_once('provision_drupal.module');
require_once('provision_drupal.drush.inc');
$url = ($argv[1]) ? $argv[1] : null;
provision_external_init($url);
......
......@@ -25,8 +25,6 @@ function provision_drupal_provision_install_validate() {
function provision_drupal_provision_pre_install(&$data, $url = NULL) {
// This is the actual drupal provisioning requirements.
_provision_drupal_create_directories($url, $data['profile']);
// Requires at least the database settings to complete.
_provision_drupal_create_settings_file($data, $url);
}
/**
......@@ -36,6 +34,9 @@ function provision_drupal_provision_pre_install(&$data, $url = NULL) {
* weird problems such as the multiple database connections don't confuse drupal.
*/
function provision_drupal_provision_install(&$data, $url = NULL) {
// Requires at least the database settings to complete.
_provision_drupal_create_settings_file($data, $url);
$cmd = sprintf("php %s/drupal_install.php %s %s %s %s", dirname(__FILE__), escapeshellarg($url), escapeshellarg($data['profile']), escapeshellarg($data['language']), escapeshellarg($data['client_email']));
provision_exec($cmd, $data);
}
......@@ -57,7 +58,7 @@ function provision_drupal_provision_install_rollback(&$data, $url = NULL) {
function provision_drupal_provision_post_install(&$data, $url = NULL) {
$data['installed'] = TRUE;
_provision_drupal_maintain_aliases($url, $data);
provision_path("chmod", "./sites/$url/settings.php", 0440, t("Secured settings.php with safe permissions"));
provision_path("chmod", "./sites/$url/settings.php", 0440, dt("Secured settings.php with safe permissions"));
_provision_drupal_rebuild_caches($data, $url);
}
......@@ -8,6 +8,7 @@
* and all the install api code.
*/
include_once('cvs_deploy.inc');
/**
* Initialize the platform / site
......@@ -47,7 +48,7 @@ function provision_drupal_provision_finalize(&$data, $url = NULL) {
function _provision_drupal_url_required() {
if (PROVISION_CONTEXT_PLATFORM) {
provision_set_error(PROVISION_FRAMEWORK_ERROR);
provision_log('error', pt('You need to specify the URL argument for this command'));
provision_log('error', dt('You need to specify the URL argument for this command'));
}
}
......@@ -96,7 +97,7 @@ function _provision_drupal_valid_not_installed_site() {
if (PROVISION_CONTEXT_SITE) {
if (_provision_drupal_site_installed(PROVISION_ACTIVE_URL)) {
provision_set_error(PROVISION_SITE_INSTALLED);
provision_log('error', pt('This site has already been installed.'));
provision_log('error', dt('This site has already been installed.'));
}
}
}
......@@ -133,13 +134,20 @@ function _provision_drupal_default_template() {
* because the modules might provide additional information about the site.
*/
function _provision_drupal_create_settings_file(&$data, $url = NULL) {
provision_log('notice', t("Generate settings.php file"));
provision_log('notice', dt("Generate settings.php file"));
if (provision_path("exists", "sites/$url/settings.php")) {
provision_path("chmod", "sites/$url/settings.php", 0640,
t('Changed permissions of settings.php to @confirm'),
t('Could not change permissions of settings.php to @confirm'));
dt('Changed permissions of settings.php to @confirm'),
dt('Could not change permissions of settings.php to @confirm'));
}
$data['extra_config'] = "# Extra configuration from modules:\n";
foreach (drush_command_implements('provision_drupal_config') as $module) {
$data['extra_config'] .= "# -- $module settings --\n";
$data['extra_config'] .= module_invoke($module, 'provision_drupal_config', $url, $data) . "\n";
}
$fp = fopen("sites/$url/settings.php", "w");
$text = variable_get('provision_drupal_settings_template', _provision_drupal_default_template());
fwrite($fp, "<?php\n". provision_render_config($text, $data));
......@@ -147,11 +155,11 @@ function _provision_drupal_create_settings_file(&$data, $url = NULL) {
# Change the permissions of the file
provision_path("chmod", "sites/$url/settings.php", 0440,
t('Changed permissions of settings.php to @confirm'),
t('Could not change permissions of settings.php to @confirm'));
dt('Changed permissions of settings.php to @confirm'),
dt('Could not change permissions of settings.php to @confirm'));
provision_path("chgrp", "sites/$url/settings.php", PROVISION_WEB_GROUP,
t('Change group ownership of settings.php to @confirm'),
t('Could not change group ownership of settings.php to @confirm'));
dt('Change group ownership of settings.php to @confirm'),
dt('Could not change group ownership of settings.php to @confirm'));
}
/**
......@@ -179,24 +187,24 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
foreach ($paths as $path => $perm) {
if (!is_dir($path)) {
provision_path("mkdir", $path, TRUE,
t("Created <code>@path</code>"),
t("Could not create <code>@path</code>"),
dt("Created <code>@path</code>"),
dt("Could not create <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
}
provision_path("chmod", $path, $perm,
t("Changed permissions of <code>@path</code> to @confirm"),
t("Could not change permissions <code>@path</code> to @confirm"),
dt("Changed permissions of <code>@path</code> to @confirm"),
dt("Could not change permissions <code>@path</code> to @confirm"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
}
foreach ($grps as $path) {
provision_path("chown", $path, PROVISION_SCRIPT_USER,
t("Changed ownership of <code>@path</code>"),
t("Could not change ownership <code>@path</code>"),
dt("Changed ownership of <code>@path</code>"),
dt("Could not change ownership <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
provision_path("chgrp", $path, PROVISION_WEB_GROUP,
t("Changed group ownership of <code>@path</code>"),
t("Could not change group ownership <code>@path</code>"));
dt("Changed group ownership of <code>@path</code>"),
dt("Could not change group ownership <code>@path</code>"));
}
}
......@@ -218,7 +226,7 @@ function _provision_find_profiles() {
include_once('includes/install.inc');
if (!$dir = opendir("./profiles")) {
provision_log('error', t("Cannot find profiles directory"));
provision_log('error', dt("Cannot find profiles directory"));
return FALSE;
}
while (FALSE !== ($name = readdir($dir))) {
......@@ -239,7 +247,7 @@ function _provision_find_profiles() {
$languages['en'] = 1;
// Find languages available
$files = array_keys(file_scan_directory('./profiles/' . $name . '/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_keys(drush_scan_directory('./profiles/' . $name . '/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
......@@ -249,7 +257,7 @@ function _provision_find_profiles() {
}
$profile->info['languages'] = array_keys($languages);
$return[$name] = $profile;
provision_log('notice', t('found install profile %name', array('%name' => $name)));
provision_log('notice', dt('found install profile %name', array('%name' => $name)));
}
return $return;
......@@ -266,7 +274,7 @@ function provision_drupal_find_sites() {
}
closedir($dir);
} else {
provision_log("error", t("Cannot find sites directory"));
provision_log("error", dt("Cannot find sites directory"));
$sites = FALSE;
}
return $sites;
......@@ -292,10 +300,6 @@ function _provision_drupal_get_cvs_versions($files) {
function _provision_drupal_import_site(&$data, $url = NULL) {
if (!($data = provision_get_site_data($url))) {
$data = array(); // initialize site data to empty array
}
$cmd = sprintf("php %s/drupal_import.php %s", dirname(__FILE__), escapeshellarg($url));
if (provision_exec($cmd, $data)) {
$data['installed'] = TRUE;
......@@ -303,9 +307,6 @@ function _provision_drupal_import_site(&$data, $url = NULL) {
else {
$data['installed'] = FALSE;
}
provision_save_site_data($url, $data);
return $data;
}
/**
......@@ -339,8 +340,8 @@ function _provision_drupal_maintain_aliases($data, $url) {
unset($old_aliases[$alias]);
}
provision_path("symlink", $url, PROVISION_DOCROOT_PATH . "/sites/" . $alias,
t("Created symlink for alias @alias", array("@alias" => $alias)),
t("Could not create symlink for alias @alias", array("@alias" => $alias)));
dt("Created symlink for alias @alias", array("@alias" => $alias)),
dt("Could not create symlink for alias @alias", array("@alias" => $alias)));
}
// Delete existing aliases that are no longer present
_provision_drupal_delete_aliases(array_keys($old_aliases));
......@@ -354,7 +355,9 @@ function _provision_drupal_maintain_aliases($data, $url) {
function _provision_drupal_delete_aliases($aliases) {
foreach ($aliases as $alias) {
provision_path("unlink", PROVISION_DOCROOT_PATH . "/sites/" . $alias, TRUE,
t("Removed symlink for alias @alias", array("@alias" => $alias)),
t("Could not remove symlink for alias @alias", array("@alias" => $alias)));
dt("Removed symlink for alias @alias", array("@alias" => $alias)),
dt("Could not remove symlink for alias @alias", array("@alias" => $alias)));
}
}
......@@ -30,6 +30,8 @@
$conf['cache'] = 1;
$conf['clean_url'] = 1;
<?php print $extra_config; ?>
/**
* This was added from Drupal 5.2 onwards.
*/
......@@ -46,7 +48,6 @@
}
}
# Additional host wide configuration settings. Useful for safely specifying configuration settings.
if (file_exists('<?php print PROVISION_CONFIG_PATH . '/' ?>includes/global.inc')) {
include_once('<?php print PROVISION_CONFIG_PATH . '/' ?>includes/global.inc');
......
......@@ -28,8 +28,8 @@ function provision_drupal_provision_restore_validate(&$data, $url = null, $resto
_provision_drupal_valid_installed_site();
$exists = provision_path("exists", $restore_file, TRUE,
pt("Restoring site from @path"),
pt("Could not find backup file @path"),
dt("Restoring site from @path"),
dt("Could not find backup file @path"),
PROVISION_FRAMEWORK_ERROR);
if ($exists) {
$data['restore_file'] = $restore_file;
......@@ -43,8 +43,8 @@ function provision_drupal_provision_pre_restore(&$data, $url, $restore_file) {
provision_invoke('backup', &$data, $url);
provision_path("extract", $data['restore_file'], PROVISION_SITES_PATH ."/$url.restore",
pt('Successfully extracted the contents of @path'),
pt('Failed to extract the contents of @path'),
dt('Successfully extracted the contents of @path'),
dt('Failed to extract the contents of @path'),
PROVISION_PERM_ERROR, PROVISION_FRAMEWORK_ERROR);
}
......@@ -62,8 +62,8 @@ function provision_drupal_provision_restore(&$data, $url) {
$old = PROVISION_SITES_PATH ."/$url.restore";
$new = PROVISION_SITES_PATH ."/$url";
provision_path("switch_paths", $old, $new ,
pt('Swapping out the @path and @confirm directories was successful.'),
pt('Swapping the @path and @confirm directories has failed.'),
dt('Swapping out the @path and @confirm directories was successful.'),
dt('Swapping the @path and @confirm directories has failed.'),
PROVISION_PERM_ERROR);
// make sure it has the latest site data available
_provision_drupal_create_settings_file($data, $url);
......
......@@ -16,14 +16,14 @@ function provision_drupal_provision_verify_validate() {
*/
function provision_drupal_provision_verify(&$data, $url = null) {
if (PROVISION_CONTEXT_PLATFORM) {
_provision_create_dir(PROVISION_CONFIG_PATH, t('Provision configuration'), 0700);
_provision_create_dir(PROVISION_BACKUP_PATH, t('Web server configuration'), 0700);
provision_path("writable", "sites", TRUE, t("Drupal sites directory is writable by the provisioning script"),
t("Drupal sites directory is not writable by the provisioning script"), PROVISION_PERM_ERROR);
_provision_create_dir(PROVISION_CONFIG_PATH, dt('Provision configuration'), 0700);
_provision_create_dir(PROVISION_BACKUP_PATH, dt('Web server configuration'), 0700);
provision_path("writable", "sites", TRUE, dt("Drupal sites directory is writable by the provisioning script"),
dt("Drupal sites directory is not writable by the provisioning script"), PROVISION_PERM_ERROR);
$data['sites'] = array_keys((array) provision_drupal_find_sites()); // return list of hosted sites. used to determine whether or not to import.
$data['platform'] = array('short_name' => 'drupal', 'version' => VERSION);
provision_log('notice', t("This platform is running @short_name @version",
$data['platform'] = array('short_name' => 'drupal', 'version' => drush_drupal_version());
provision_log('notice', dt("This platform is running @short_name @version",
array('@short_name' => 'drupal', '@version' => VERSION)));
$data['profiles'] = _provision_find_profiles();
$cmd = sprintf("php %s/drupal_verify.php", dirname(__FILE__));
......@@ -34,12 +34,12 @@ function provision_drupal_provision_verify(&$data, $url = null) {
_provision_drupal_maintain_aliases($data, $url);
// Requires at least the database settings to complete.
_provision_drupal_create_settings_file($data, $url);
$cmd = sprintf("php %s/drupal_verify.php %s", dirname(__FILE__), $url);
#$cmd = sprintf("php %s/drupal_verify.php %s", dirname(__FILE__), $url);
#provision_exec($cmd, $data);
}
provision_exec($cmd, $data);
if (is_array($data['modules'])) {
// get the correct version names for everything.
$data['modules'] = _provision_drupal_get_cvs_versions($data['modules']);
#$data['modules'] = _provision_drupal_get_cvs_versions($data['modules']);
}
}
......
......@@ -38,6 +38,77 @@
* @defgroup provisiondrush Command line interface for Provision.
* @{
*/
include_once('provision.inc');
include_once('provision.path.inc');
provision_init();
/**
* Implementation of hook_init
*
* Provide defines for all the major paths and settings.
* These are settings that must not be modified during the running of the
* program, but are configurable.
*/
function provision_init() {
// Do not allow the program to be run as the root user. ever
$name = posix_getpwuid(posix_geteuid());
if ($name['name'] == 'root') {
provision_log('error', 'You are running the provision script as the root user. Exiting');
provision_set_error(PROVISION_FRAMEWORK_ERROR);
provision_output($url);
}
// Load requested additional modules
#provision_load_from_args();
// Set up defines for platform
$docroot = provision_get_option(array("r", "root"), $_SERVER['PWD']);
$backend = provision_get_option(array('b', 'backend'), 0);
define("PROVISION_DRUSH_BACKEND", $backend);
define('PROVISION_DOMAIN', $_SERVER['HTTP_HOST']);
// Paths
$path = ($docroot) ? $docroot : $_SERVER['DOCUMENT_ROOT'];
define('PROVISION_DOCROOT_PATH', rtrim($path, '/'));
define('PROVISION_SITES_PATH', rtrim($path, '/') .'/sites');
define('PROVISION_DRUSH_PATH', './drush.php');
$parts = explode("/", rtrim($path, '/'));
array_pop($parts);
define('PROVISION_PARENT_PATH', rtrim(implode("/" , $parts), '/'));
define('PROVISION_BACKUP_PATH',
provision_get_option('backup_path', PROVISION_PARENT_PATH . '/backups'));
define('PROVISION_CONFIG_PATH',
provision_get_option('config_path', PROVISION_PARENT_PATH .'/config'));
define('PROVISION_VHOST_PATH', PROVISION_CONFIG_PATH .'/vhost.d');
// Commands
define('PROVISION_RESTART_CMD',
provision_get_option('restart_cmd', _provision_default_restart_cmd()));
// System account
$info = posix_getgrgid(posix_getgid());
define('PROVISION_WEB_GROUP',
provision_get_option('web_group', $info['name'] ));
define('PROVISION_SCRIPT_USER',
provision_get_option('script_user', get_current_user() ));
// Redirection urls
define('PROVISION_MASTER_URL',
provision_get_option('master_url', $GLOBALS['base_url']));
define('PROVISION_WEB_DISABLE_URL', PROVISION_MASTER_URL .'/provision/disabled');
define('PROVISION_WEB_MAINTENENCE_URL', PROVISION_MASTER_URL .'/provision/maintenance');
// Database
define('PROVISION_MASTER_DB',
provision_get_option('master_db', $GLOBALS['db_url']));
$db = parse_url(PROVISION_MASTER_DB);
define('PROVISION_DB_USER', $db['user']);
define('PROVISION_DB_PASSWD', $db['pass']);
define('PROVISION_DB_HOST', $db['host']);
// Drupal does not support multiple types of connections in the same session
preg_match("$^([a-z]*)://$", $GLOBALS['db_url'], $matches);
define('PROVISION_DB_TYPE', $matches[1]);
}
/**
* Implementation of hook_drush_command().
......@@ -47,58 +118,61 @@ function provision_drush_command() {
$items['provision install'] = array(
'callback' => 'provision_command',
'callback arguments' => array('install'),
'arguments' => array('domain.com' => t('The domain of the site to install.')),
'description' => t('Provision a new site using the provided data.')
'arguments' => array('domain.com' => dt('The domain of the site to install.')),
'description' => dt('Provision a new site using the provided data.'),
'bootstrap' => DRUPAL_BOOTSTRAP_CONFIGURATION
);
$items['provision import'] = array(
'callback' => 'provision_command',
'callback arguments' => array('import'),
'arguments' => array('domain.com' => t('The domain of the site to import.')),
'description' => t('Turn an already running site into a provisioned site.')
'arguments' => array('domain.com' => dt('The domain of the site to import.')),
'description' => dt('Turn an already running site into a provisioned site.'),
'bootstrap' => DRUPAL_BOOTSTRAP_CONFIGURATION
);
$items['provision update'] = array(
'callback' => 'provision_command',
'callback arguments' => array('update'),
'arguments' => array('domain.com' => t('The domain of the site to update.')),
'description' => t('Run any outstanding updates on the site.')
'arguments' => array('domain.com' => dt('The domain of the site to update.')),
'description' => dt('Run any outstanding updates on the site.')
);
$items['provision backup'] = array(
'callback' => 'provision_command',
'callback arguments' => array('backup'),
'arguments' => array('domain.com' => t('The domain of the site to back up.')),
'optional arguments' => array('backup-file' => t('The file to save the backup to. This will be a gzipped tarball.')),
'description' => t('Generate a back up for the site.')
'arguments' => array('domain.com' => dt('The domain of the site to back up.')),
'optional arguments' => array('backup-file' => dt('The file to save the backup to. This will be a gzipped tarball.')),
'description' => dt('Generate a back up for the site.')
);
$items['provision enable'] = array(
'callback' => 'provision_command',
'callback arguments' => array('enable'),
'arguments' => array('domain.com' => t('The domain of the site to enable (only if enabled).')),
'arguments' => array('domain.com' => dt('The domain of the site to enable (only if enabled).')),
'description' => 'Enable a disabled site.'
);
$items['provision disable'] = array(
'callback' => 'provision_command',
'callback arguments' => array('disable'),
'arguments' => array('domain.com' => t('The domain of the site to disable (only if disabled).')),
'arguments' => array('domain.com' => dt('The domain of the site to disable (only if disabled).')),
'description' => 'Disable a site.'
);
$items['provision verify'] = array(
'callback' => 'provision_command',
'callback arguments' => array('verify'),
'arguments' => array('domain.com' => t('The domain of the site to verify).')),
'description' => 'Verify that the provisioning framework is correctly installed.'
'arguments' => array('domain.com' => dt('The domain of the site to verify).')),
'description' => 'Verify that the provisioning framework is correctly installed.',
'bootstrap' => DRUPAL_BOOTSTRAP_CONFIGURATION,
);
$items['provision restore'] = array(
'callback' => 'provision_command',
'callback arguments' => array('restore'),
'description' => 'Restore the site to a previous backup. This will also generate a backup of the site as it was.',
'arguments' => array('domain.com' => t('The domain of the site to be restored'),
'site_backup.tar.gz' => t('The backup to restore the site to.'))
'arguments' => array('domain.com' => dt('The domain of the site to be restored'),
'site_backup.tar.gz' => dt('The backup to restore the site to.'))
);
$items['provision delete'] = array(
......@@ -111,7 +185,7 @@ function provision_drush_command() {
'callback' => 'provision_command',
'callback arguments' => array('cron'),
'description' => 'Run cron process for site.',
'arguments' => array('domain.com' => t('The domain of the site to be processed'))
'arguments' => array('domain.com' => dt('The domain of the site to be processed'))
);
if (!function_exists('hosting_setup')) {
......@@ -139,8 +213,8 @@ function _provision_setup() {
$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'),
dt('Created symlink for drush.php file'),