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) { ...@@ -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; $data['db_host'] = ($data['db_host']) ? $data['db_host'] : PROVISION_DB_HOST;
# generate a random password for use # 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_name'] = _provision_mysql_suggest_db_name($data, $url);
$data['db_user'] = $data['db_name']; $data['db_user'] = $data['db_name'];
......
...@@ -22,7 +22,7 @@ function provision_db_connect() { ...@@ -22,7 +22,7 @@ function provision_db_connect() {
if (!$connection) { if (!$connection) {
provision_set_error(PROVISION_DB_ERROR); 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 { else {
$success = @mysql_select_db('mysql', $connection); $success = @mysql_select_db('mysql', $connection);
...@@ -31,7 +31,7 @@ function provision_db_connect() { ...@@ -31,7 +31,7 @@ function provision_db_connect() {
} }
else { else {
provision_set_error(PROVISION_DB_ERROR); 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; return FALSE;
} }
} }
......
...@@ -32,11 +32,11 @@ function _provision_mysql_new_site_db($db_name, $db_user, $db_passwd, $db_host) ...@@ -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); $status = _provision_mysql_database_exists($db_name);
if ($status) { 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 { else {
provision_set_error(PROVISION_DB_ERROR); 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; return $status;
//TODO : Test to confirm that the database is actually writeable. Taking this on faith for now. //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) ...@@ -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) { function _provision_mysql_destroy_site_db($db_name, $db_user, $db_passwd, $db_host) {
if ( _provision_mysql_database_exists($data['db_name']) ) { 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)) { 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 ...@@ -63,7 +63,7 @@ function _provision_mysql_destroy_site_db($db_name, $db_user, $db_passwd, $db_ho
provision_log("notice", "Revoking privileges"); provision_log("notice", "Revoking privileges");
_provision_mysql_flush_privileges(); _provision_mysql_flush_privileges();
if (!_provision_mysql_revoke($db_name, $db_user)) { 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() { ...@@ -89,7 +89,7 @@ function _provision_mysql_can_create_database() {
_provision_mysql_create_database($test); _provision_mysql_create_database($test);
if (_provision_mysql_database_exists($test)) { if (_provision_mysql_database_exists($test)) {
if (!_provision_mysql_drop_database($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; return TRUE;
} }
...@@ -108,18 +108,18 @@ function _provision_mysql_revoke($name, $username, $host = '') { ...@@ -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) { function _provision_mysql_import_dump($dump_file, $db_name, $db_user, $db_passwd, $db_host) {
$exists = provision_path("exists", $dump_file, TRUE, $exists = provision_path("exists", $dump_file, TRUE,
t('Found database dump at @path.'), dt('Found database dump at @path.'),
t('No database dump was found at @path.'), dt('No database dump was found at @path.'),
PROVISION_FRAMEWORK_ERROR); PROVISION_FRAMEWORK_ERROR);
if ($exists) { if ($exists) {
$readable = provision_path("readable", $dump_file, TRUE, t('Database dump at @path is readable'), $readable = provision_path("readable", $dump_file, TRUE, dt('Database dump at @path is readable'),
t('The database dump at @path could not be read.'), dt('The database dump at @path could not be read.'),
PROVISION_PERM_ERROR); PROVISION_PERM_ERROR);
if ($readable) { if ($readable) {
provision_log("notice", sprintf("Importing database using command: mysql -u%s -p%s -h%s %s < %s", 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)); $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 )) { 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) { ...@@ -12,7 +12,7 @@ function provision_mysql_provision_pre_restore(&$data, $url = NULL) {
$data['old_db_host'] = $data['db_host']; $data['old_db_host'] = $data['db_host'];
# generate a random password for use # 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_name'] = _provision_mysql_suggest_db_name($data, $url);
$data['db_user'] = $data['db_name']; $data['db_user'] = $data['db_name'];
...@@ -38,8 +38,8 @@ function provision_mysql_provision_pre_restore_rollback(&$data, $url = NULL) { ...@@ -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. // made. Which could go on infinitely if something is really long.
function provision_mysql_provision_post_restore(&$data, $url = NULL) { function provision_mysql_provision_post_restore(&$data, $url = NULL) {
provision_path('unlink', 'sites/'. $url .'/database.sql', TRUE, provision_path('unlink', 'sites/'. $url .'/database.sql', TRUE,
t("Removed dump file @path after restoring from it"), dt("Removed dump file @path after restoring from it"),
t("Could not remove dump file @path"), PROVISION_PERM_ERROR); 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']); _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() { ...@@ -13,10 +13,10 @@ function provision_mysql_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) { if (PROVISION_CONTEXT_PLATFORM) {
if (!_provision_mysql_can_create_database()) { if (!_provision_mysql_can_create_database()) {
provision_set_error(PROVISION_DB_ERROR | PROVISION_FRAMEWORK_ERROR); 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 { 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 ...@@ -21,8 +21,8 @@ function provision_drupal_provision_backup_validate(&$data, $url = NULL, $backup
if ($backup_file) { if ($backup_file) {
if ( provision_path("exists", $backup_file, FALSE, if ( provision_path("exists", $backup_file, FALSE,
t("Backing site up to @path."), dt("Backing site up to @path."),
t("Back up file @path already exists."), dt("Back up file @path already exists."),
PROVISION_FRAMEWORK_ERROR)) { PROVISION_FRAMEWORK_ERROR)) {
$data['backup_file'] = $backup_file; $data['backup_file'] = $backup_file;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// $Id$ // $Id$
require_once(dirname(__FILE__) . '/../provision.inc'); require_once(dirname(__FILE__) . '/../provision.inc');
require_once('provision_drupal.module'); require_once('provision_drupal.drush.inc');
$url = ($argv[1]) ? $argv[1] : null; $url = ($argv[1]) ? $argv[1] : null;
provision_external_init($url); provision_external_init($url);
......
...@@ -25,8 +25,6 @@ function provision_drupal_provision_install_validate() { ...@@ -25,8 +25,6 @@ function provision_drupal_provision_install_validate() {
function provision_drupal_provision_pre_install(&$data, $url = NULL) { function provision_drupal_provision_pre_install(&$data, $url = NULL) {
// This is the actual drupal provisioning requirements. // This is the actual drupal provisioning requirements.
_provision_drupal_create_directories($url, $data['profile']); _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) { ...@@ -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. * weird problems such as the multiple database connections don't confuse drupal.
*/ */
function provision_drupal_provision_install(&$data, $url = NULL) { 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'])); $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); provision_exec($cmd, $data);
} }
...@@ -57,7 +58,7 @@ function provision_drupal_provision_install_rollback(&$data, $url = NULL) { ...@@ -57,7 +58,7 @@ function provision_drupal_provision_install_rollback(&$data, $url = NULL) {
function provision_drupal_provision_post_install(&$data, $url = NULL) { function provision_drupal_provision_post_install(&$data, $url = NULL) {
$data['installed'] = TRUE; $data['installed'] = TRUE;
_provision_drupal_maintain_aliases($url, $data); _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); _provision_drupal_rebuild_caches($data, $url);
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* and all the install api code. * and all the install api code.
*/ */
include_once('cvs_deploy.inc');
/** /**
* Initialize the platform / site * Initialize the platform / site
...@@ -47,7 +48,7 @@ function provision_drupal_provision_finalize(&$data, $url = NULL) { ...@@ -47,7 +48,7 @@ function provision_drupal_provision_finalize(&$data, $url = NULL) {
function _provision_drupal_url_required() { function _provision_drupal_url_required() {
if (PROVISION_CONTEXT_PLATFORM) { if (PROVISION_CONTEXT_PLATFORM) {
provision_set_error(PROVISION_FRAMEWORK_ERROR); 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() { ...@@ -96,7 +97,7 @@ function _provision_drupal_valid_not_installed_site() {
if (PROVISION_CONTEXT_SITE) { if (PROVISION_CONTEXT_SITE) {
if (_provision_drupal_site_installed(PROVISION_ACTIVE_URL)) { if (_provision_drupal_site_installed(PROVISION_ACTIVE_URL)) {
provision_set_error(PROVISION_SITE_INSTALLED); 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() { ...@@ -133,13 +134,20 @@ function _provision_drupal_default_template() {
* because the modules might provide additional information about the site. * because the modules might provide additional information about the site.
*/ */
function _provision_drupal_create_settings_file(&$data, $url = NULL) { 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")) { if (provision_path("exists", "sites/$url/settings.php")) {
provision_path("chmod", "sites/$url/settings.php", 0640, provision_path("chmod", "sites/$url/settings.php", 0640,
t('Changed permissions of settings.php to @confirm'), dt('Changed permissions of settings.php to @confirm'),
t('Could not change 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"); $fp = fopen("sites/$url/settings.php", "w");
$text = variable_get('provision_drupal_settings_template', _provision_drupal_default_template()); $text = variable_get('provision_drupal_settings_template', _provision_drupal_default_template());
fwrite($fp, "<?php\n". provision_render_config($text, $data)); fwrite($fp, "<?php\n". provision_render_config($text, $data));
...@@ -147,11 +155,11 @@ function _provision_drupal_create_settings_file(&$data, $url = NULL) { ...@@ -147,11 +155,11 @@ function _provision_drupal_create_settings_file(&$data, $url = NULL) {
# Change the permissions of the file # Change the permissions of the file
provision_path("chmod", "sites/$url/settings.php", 0440, provision_path("chmod", "sites/$url/settings.php", 0440,
t('Changed permissions of settings.php to @confirm'), dt('Changed permissions of settings.php to @confirm'),
t('Could not change 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, provision_path("chgrp", "sites/$url/settings.php", PROVISION_WEB_GROUP,
t('Change group ownership of settings.php to @confirm'), dt('Change group ownership of settings.php to @confirm'),
t('Could not 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) { ...@@ -179,24 +187,24 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
foreach ($paths as $path => $perm) { foreach ($paths as $path => $perm) {
if (!is_dir($path)) { if (!is_dir($path)) {
provision_path("mkdir", $path, TRUE, provision_path("mkdir", $path, TRUE,
t("Created <code>@path</code>"), dt("Created <code>@path</code>"),
t("Could not create <code>@path</code>"), dt("Could not create <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR ); PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
} }
provision_path("chmod", $path, $perm, provision_path("chmod", $path, $perm,
t("Changed permissions of <code>@path</code> to @confirm"), dt("Changed permissions of <code>@path</code> to @confirm"),
t("Could not change permissions <code>@path</code> to @confirm"), dt("Could not change permissions <code>@path</code> to @confirm"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR ); PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
} }
foreach ($grps as $path) { foreach ($grps as $path) {
provision_path("chown", $path, PROVISION_SCRIPT_USER, provision_path("chown", $path, PROVISION_SCRIPT_USER,
t("Changed ownership of <code>@path</code>"), dt("Changed ownership of <code>@path</code>"),
t("Could not change ownership <code>@path</code>"), dt("Could not change ownership <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR ); PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
provision_path("chgrp", $path, PROVISION_WEB_GROUP, provision_path("chgrp", $path, PROVISION_WEB_GROUP,
t("Changed group ownership of <code>@path</code>"), dt("Changed group ownership of <code>@path</code>"),
t("Could not change group ownership <code>@path</code>")); dt("Could not change group ownership <code>@path</code>"));
} }
} }
...@@ -218,7 +226,7 @@ function _provision_find_profiles() { ...@@ -218,7 +226,7 @@ function _provision_find_profiles() {
include_once('includes/install.inc'); include_once('includes/install.inc');
if (!$dir = opendir("./profiles")) { if (!$dir = opendir("./profiles")) {
provision_log('error', t("Cannot find profiles directory")); provision_log('error', dt("Cannot find profiles directory"));
return FALSE; return FALSE;
} }
while (FALSE !== ($name = readdir($dir))) { while (FALSE !== ($name = readdir($dir))) {
...@@ -239,7 +247,7 @@ function _provision_find_profiles() { ...@@ -239,7 +247,7 @@ function _provision_find_profiles() {
$languages['en'] = 1; $languages['en'] = 1;
// Find languages available // 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)) { if (is_array($files)) {
foreach ($files as $file) { foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) { if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
...@@ -249,7 +257,7 @@ function _provision_find_profiles() { ...@@ -249,7 +257,7 @@ function _provision_find_profiles() {
} }
$profile->info['languages'] = array_keys($languages); $profile->info['languages'] = array_keys($languages);
$return[$name] = $profile; $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; return $return;
...@@ -266,7 +274,7 @@ function provision_drupal_find_sites() { ...@@ -266,7 +274,7 @@ function provision_drupal_find_sites() {
} }
closedir($dir); closedir($dir);
} else { } else {
provision_log("error", t("Cannot find sites directory")); provision_log("error", dt("Cannot find sites directory"));
$sites = FALSE; $sites = FALSE;
} }
return $sites; return $sites;
...@@ -292,10 +300,6 @@ function _provision_drupal_get_cvs_versions($files) { ...@@ -292,10 +300,6 @@ function _provision_drupal_get_cvs_versions($files) {
function _provision_drupal_import_site(&$data, $url = NULL) { 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)); $cmd = sprintf("php %s/drupal_import.php %s", dirname(__FILE__), escapeshellarg($url));
if (provision_exec($cmd, $data)) { if (provision_exec($cmd, $data)) {
$data['installed'] = TRUE; $data['installed'] = TRUE;
...@@ -303,9 +307,6 @@ function _provision_drupal_import_site(&$data, $url = NULL) { ...@@ -303,9 +307,6 @@ function _provision_drupal_import_site(&$data, $url = NULL) {
else { else {
$data['installed'] = FALSE; $data['installed'] = FALSE;
} }
provision_save_site_data($url, $data);
return $data;
} }
/** /**
...@@ -339,8 +340,8 @@ function _provision_drupal_maintain_aliases($data, $url) { ...@@ -339,8 +340,8 @@ function _provision_drupal_maintain_aliases($data, $url) {
unset($old_aliases[$alias]); unset($old_aliases[$alias]);
} }
provision_path("symlink", $url, PROVISION_DOCROOT_PATH . "/sites/" . $alias, provision_path("symlink", $url, PROVISION_DOCROOT_PATH . "/sites/" . $alias,
t("Created symlink for alias @alias", array("@alias" => $alias)), dt("Created symlink for alias @alias", array("@alias" => $alias)),
t("Could not create 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 // Delete existing aliases that are no longer present
_provision_drupal_delete_aliases(array_keys($old_aliases)); _provision_drupal_delete_aliases(array_keys($old_aliases));
...@@ -354,7 +355,9 @@ function _provision_drupal_maintain_aliases($data, $url) { ...@@ -354,7 +355,9 @@ function _provision_drupal_maintain_aliases($data, $url) {
function _provision_drupal_delete_aliases($aliases) { function _provision_drupal_delete_aliases($aliases) {
foreach ($aliases as $alias) { foreach ($aliases as $alias) {
provision_path("unlink", PROVISION_DOCROOT_PATH . "/sites/" . $alias, TRUE, provision_path("unlink", PROVISION_DOCROOT_PATH . "/sites/" . $alias, TRUE,
t("Removed symlink for alias @alias", array("@alias" => $alias)), dt("Removed symlink for alias @alias", array("@alias" => $alias)),
t("Could not remove symlink for alias @alias", array("@alias" => $alias))); dt("Could not remove symlink for alias @alias", array("@alias" => $alias)));
} }
} }
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
$conf['cache'] = 1; $conf['cache'] = 1;
$conf['clean_url'] = 1; $conf['clean_url'] = 1;
<?php print $extra_config; ?>
/** /**
* This was added from Drupal 5.2 onwards. * This was added from Drupal 5.2 onwards.
*/ */
...@@ -46,7 +48,6 @@ ...@@ -46,7 +48,6 @@
} }
} }
# Additional host wide configuration settings. Useful for safely specifying configuration settings. # Additional host wide configuration settings. Useful for safely specifying configuration settings.
if (file_exists('<?php print PROVISION_CONFIG_PATH . '/' ?>includes/global.inc')) { if (file_exists('<?php print PROVISION_CONFIG_PATH . '/' ?>includes/global.inc')) {
include_once('<?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 ...@@ -28,8 +28,8 @@ function provision_drupal_provision_restore_validate(&$data, $url = null, $resto
_provision_drupal_valid_installed_site(); _provision_drupal_valid_installed_site();
$exists = provision_path("exists", $restore_file, TRUE, $exists = provision_path("exists", $restore_file, TRUE,
pt("Restoring site from @path"), dt("Restoring site from @path"),
pt("Could not find backup file @path"), dt("Could not find backup file @path"),
PROVISION_FRAMEWORK_ERROR); PROVISION_FRAMEWORK_ERROR);
if ($exists) { if ($exists) {
$data['restore_file'] = $restore_file; $data['restore_file'] = $restore_file;
...@@ -43,8 +43,8 @@ function provision_drupal_provision_pre_restore(&$data, $url, $restore_file) { ...@@ -43,8 +43,8 @@ function provision_drupal_provision_pre_restore(&$data, $url, $restore_file) {
provision_invoke('backup', &$data, $url); provision_invoke('backup', &$data, $url);
provision_path("extract", $data['restore_file'], PROVISION_SITES_PATH ."/$url.restore", provision_path("extract", $data['restore_file'], PROVISION_SITES_PATH ."/$url.restore",
pt('Successfully extracted the contents of @path'), dt('Successfully extracted the contents of @path'),
pt('Failed to extract the contents of @path'), dt('Failed to extract the contents of @path'),
PROVISION_PERM_ERROR, PROVISION_FRAMEWORK_ERROR); PROVISION_PERM_ERROR, PROVISION_FRAMEWORK_ERROR);
} }
...@@ -62,8 +62,8 @@ function provision_drupal_provision_restore(&$data, $url) { ...@@ -62,8 +62,8 @@ function provision_drupal_provision_restore(&$data, $url) {
$old = PROVISION_SITES_PATH ."/$url.restore"; $old = PROVISION_SITES_PATH ."/$url.restore";
$new = PROVISION_SITES_PATH ."/$url"; $new = PROVISION_SITES_PATH ."/$url";
provision_path("switch_paths", $old, $new , provision_path("switch_paths", $old, $new ,
pt('Swapping out the @path and @confirm directories was successful.'), dt('Swapping out the @path and @confirm directories was successful.'),
pt('Swapping the @path and @confirm directories has failed.'), dt('Swapping the @path and @confirm directories has failed.'),
PROVISION_PERM_ERROR); PROVISION_PERM_ERROR);
// make sure it has the latest site data available // make sure it has the latest site data available
_provision_drupal_create_settings_file($data, $url); _provision_drupal_create_settings_file($data, $url);
......
...@@ -16,14 +16,14 @@ function provision_drupal_provision_verify_validate() { ...@@ -16,14 +16,14 @@ function provision_drupal_provision_verify_validate() {
*/ */
function provision_drupal_provision_verify(&$data, $url = null) { function provision_drupal_provision_verify(&$data, $url = null) {
if (PROVISION_CONTEXT_PLATFORM) { if (PROVISION_CONTEXT_PLATFORM) {
_provision_create_dir(PROVISION_CONFIG_PATH, t('Provision configuration'), 0700); _provision_create_dir(PROVISION_CONFIG_PATH, dt('Provision configuration'), 0700);
_provision_create_dir(PROVISION_BACKUP_PATH, t('Web server configuration'), 0700); _provision_create_dir(PROVISION_BACKUP_PATH, dt('Web server configuration'), 0700);
provision_path("writable", "sites", TRUE, t("Drupal sites directory is writable by the provisioning script"), provision_path("writable", "sites", TRUE, dt("Drupal sites directory is writable by the provisioning script"),
t("Drupal sites directory is not writable by the provisioning script"), PROVISION_PERM_ERROR); 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['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); $data['platform'] = array('short_name' => 'drupal', 'version' => drush_drupal_version());
provision_log('notice', t("This platform is running @short_name @version", provision_log('notice', dt("This platform is running @short_name @version",
array('@short_name' => 'drupal', '@version' => VERSION))); array('@short_name' => 'drupal', '@version' => VERSION)));
$data['profiles'] = _provision_find_profiles(); $data['profiles'] = _provision_find_profiles();
$cmd = sprintf("php %s/drupal_verify.php", dirname(__FILE__)); $cmd = sprintf("php %s/drupal_verify.php", dirname(__FILE__));
...@@ -34,12 +34,12 @@ function provision_drupal_provision_verify(&$data, $url = null) { ...@@ -34,12 +34,12 @@ function provision_drupal_provision_verify(&$data, $url = null) {
_provision_drupal_maintain_aliases($data, $url); _provision_drupal_maintain_aliases($data, $url);
// Requires at least the database settings to complete. // Requires at least the database settings to complete.
_provision_drupal_create_settings_file($data, $url); _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'])) { if (is_array($data['modules'])) {
// get the correct version names for everything.