Logo Search packages:      
Sourcecode: aegir-provision version File versions  Download package

_provision_drupal_create_settings_file ( url = NULL  ) 

Generate a settings file for the site.

Parameters:
url The url of the site being invoked.
data A reference to the associated array containing the data for the site. This needs to be a reference, because the modules might provide additional information about the site.

Definition at line 181 of file provision_drupal.drush.inc.

References _provision_drupal_default_template(), and provision_render_config().

Referenced by drush_provision_drupal_provision_install().

                                                             {
  $options = drush_get_merged_options();

  $options['extra_config'] = "# Extra configuration from modules:\n";
  foreach (drush_command_implements('provision_drupal_config') as $module) {
    $options['extra_config'] .= "# -- $module settings --\n";
    $options['extra_config'] .= module_invoke($module, 'provision_drupal_config', $url) . "\n";
  }


  drush_log(dt("Generate settings.php file"));
  if (provision_path("exists", "sites/$url/settings.php")) {
    provision_path("chmod", "sites/$url/settings.php", 0640,
      dt('Changed permissions of settings.php to @confirm'),
      dt('Could not change permissions of settings.php to @confirm'));
  }

  $fp = fopen("sites/$url/settings.php", "w");
  $text =  _provision_drupal_default_template();
  fwrite($fp, "<?php\n". provision_render_config($text, $options));
  fclose($fp);

  # Change the permissions of the file
  provision_path("chmod", "sites/$url/settings.php", 0440,
    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", drush_get_option('web_group'),
    dt('Change group ownership of settings.php to @confirm'),
    dt('Could not change group ownership of settings.php to @confirm'));
}


Generated by  Doxygen 1.6.0   Back to index