installDrupal47

Definition

installDrupal47()
install_drupal.inc, line 107

Code

<?php
function installDrupal47() {
  global $args, $bins;
  $instance_dir = $args->install_dir . '/' . $args->instance;
  
  $exec_cmd = $bins['sed'] . ' -i "s/' .
  "mysql:\/\/username:password@localhost\/databasename/" .
  "mysql:\/\/$args->db_user:$args->db_pass@localhost\/$args->instance/\" " . $instance_dir . "/sites/default/settings.php";
  
  if (execute($exec_cmd, "Unable to set this instance db settings.", STA_ERROR) === FALSE) return FALSE;

  //checking if settings were really modified
  $settings_file_content = file_get_contents($instance_dir .  '/sites/default/settings.php');
  if (!strstr($settings_file_content, $args->instance)) {
    terminateTesting(STA_ERROR, "Settings file was not modified correctly.");
    return FALSE;
  }

  $exec_cmd = $bins['mysql'] . " -u $args->db_user -p$args->db_pass $args->instance < database/database.4.1.mysql";
  if (execute($exec_cmd, "Unable to insert tables into database.", STA_ERROR) === FALSE) return FALSE;
  //change back permissions for settings.php
  //chmod($instance_dir . '/sites/default/settings.php', 0755);
  return TRUE;
}
?>