Commit 1280a6a2 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

I managed to never commit the provision.install file, which sets the module...

I managed to never commit the provision.install file, which sets the module weights, and makes sure that restore happens in the right order.
This fixes the problem I had where it would try to import the database dump before actually having extracted it.
Fixed the weird chgrp error message it was having (which was just an issue in logging, not in the actual chgrp call)
parent 5cca95b2
......@@ -168,6 +168,9 @@ function provision_mysql_provision_delete($url, &$data) {
// Rollback doesn't apply here yet. Unless we trigger a restore of the first dump
// made. Which could go on infinitely if something is really long.
function provision_mysql_provision_post_restore($url, &$data) {
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);
return _provision_mysql_destroy_site_db($data['old_site_db_name'], $data['old_site_db_user'], $data['old_site_db_passwd'], $data['old_site_db_host']);
}
......
......@@ -117,18 +117,25 @@ function _provision_drupal_default_template() {
* because the modules might provide additional information about the site.
*/
function _provision_drupal_create_settings_file($url, &$data) {
provision_log('notice', t("Generate settings.php file"));
if (provision_path("exists", "sites/$url/settings.php")) {
provision_path("chmod", "sites/$url/settings.php", 0750);
provision_path("chmod", "sites/$url/settings.php", 0750,
t('Changed permissions of settings.php to @confirm'),
t('Could not change permissions of settings.php to @confirm'));
}
$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));
fclose($fp);
# Change the permissions of the file
provision_path("chmod", "sites/$url/settings.php", 0550);
provision_path("chgrp", "sites/$url/settings.php", PROVISION_WEB_GROUP);
provision_path("chmod", "sites/$url/settings.php", 0550,
t('Changed permissions of settings.php to @confirm'),
t('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'));
}
/**
......
<?php
/**
* Configure the module weights for the core modules, to ensure that the
* hooks always fire in a predictable pattern.
*
* Provision module - does necessary setup for an task to occur.
* Mysql module - creates the necessary database settings
* Drupal module - manages installations and the like.
* Apache module - ensures that web server can see the site
*/
function provision_install() {
db_query("UPDATE {system} SET weight = 0 WHERE type='module' AND name='provision'");
db_query("UPDATE {system} SET weight = 1 WHERE type='module' AND name='provision_mysql'");
db_query("UPDATE {system} SET weight = 2 WHERE type='module' AND name='provision_drupal'");
db_query("UPDATE {system} SET weight = 3 WHERE type='module' AND name='provision_apache'");
}
......@@ -174,7 +174,7 @@ function provision_path_chown($path, &$owner, &$reason) {
function provision_path_chgrp($path, &$group, &$reason) {
if ($group = provision_posix_groupname($group)) {
if (provision_user_in_group(PROVISION_SCRIPT_USER, $group)) {
if (chgrp($path, $group)) {
if (!chgrp($path, $group)) {
$reason = t("chgrp failed");
}
}
......@@ -213,7 +213,6 @@ function provision_path_switch_paths($path1, &$path2, &$reason) {
return $path1;
}
function provision_path_extract($path, &$target, &$reason) {
if (file_exists($path) && is_readable($path)) {
if (is_writeable(dirname($target)) && !file_exists($target) && !is_dir($target)) {
......
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