Commit a7cfa91f authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

#308255 - cleaned up a bunch of coder warnings

parent 3649f452
<?php
// $Id$
/**
* @file mysql db api extension
*
......@@ -33,7 +34,7 @@ function _provision_mysql_new_site_db($db_name, $db_user, $db_passwd, $db_host)
provision_set_active_db();
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.
}
/**
......@@ -88,9 +89,9 @@ function _provision_mysql_can_create_database() {
_provision_mysql_create_database($test);
if (_provision_mysql_database_exists($test)) {
_provision_mysql_drop_database($test);
return true;
return TRUE;
}
return false;
return FALSE;
}
function _provision_mysql_grant($name, $username, $password, $host = '') {
......@@ -118,12 +119,12 @@ function _provision_master_db_url($data = array()) {
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.'),
t('No database dump was found at @path.'),
PROVISION_FRAMEWORK_ERROR);
if ($exists) {
$readable = provision_path("readable", $dump_file, true, '',
$readable = provision_path("readable", $dump_file, TRUE, '',
t('The database dump at @path could not be read.'),
PROVISION_PERM_ERROR);
if ($readable) {
......@@ -146,10 +147,10 @@ function _provision_mysql_import_dump($dump_file, $db_name, $db_user, $db_passwd
function _provision_mysql_suggest_db_name($url, $data) {
provision_set_active_db(_provision_master_db_url());
if ($data['site_id']) {
$id_suggest = 'site_' . $data['site_id'];
$id_suggest = 'site_'. $data['site_id'];
$suggest[] = $id_suggest;
for ($i = 0; $i < 100; $i++) {
$suggest[] = $id_suggest . '_' . $i;
$suggest[] = $id_suggest .'_'. $i;
}
}
else {
......@@ -158,7 +159,7 @@ function _provision_mysql_suggest_db_name($url, $data) {
$url_suggest = substr(0, 14, str_replace(array(".", "-"), '' , ereg_replace("^www\.", "", $url)));
$suggest[] = $url_suggest;
for ($i = 0; $i < 100; $i++) {
$suggest[] = $url_suggest . '_' . $i;
$suggest[] = $url_suggest .'_'. $i;
}
}
......
<?php
// $Id$
/**
* @file
* Mysql provisioning module.
......@@ -57,7 +58,7 @@ function provision_mysql_provision_service() {
/**
* Implementation of provision_configure
*/
function provision_mysql_provision_configure($node = null) {
function provision_mysql_provision_configure($node = NULL) {
if (!is_object($node) && ($nid = variable_get('hosting_own_db_server', 0))) {
$node = node_load($nid);
}
......@@ -136,7 +137,7 @@ function provision_mysql_provision_pre_restore($url, &$data) {
$success = _provision_mysql_new_site_db($data['site_db_name'], $data['site_db_user'], $data['site_db_passwd'], $data['site_db_host']);
if ($success) {
_provision_mysql_import_dump(PROVISION_SITES_PATH . '/' . $url . '.restore/database.sql', $data['site_db_name'], $data['site_db_user'], $data['site_db_passwd'], $data['site_db_host']);
_provision_mysql_import_dump(PROVISION_SITES_PATH .'/'. $url .'.restore/database.sql', $data['site_db_name'], $data['site_db_user'], $data['site_db_passwd'], $data['site_db_host']);
}
else {
provision_set_error(PROVISION_DB_ERROR);
......@@ -149,7 +150,7 @@ function provision_mysql_provision_pre_restore_rollback($url, &$data) {
//Restore the original database credentials of the site.
foreach ($keys as $key) {
$data[$key] = $data['old_' . $key];
$data[$key] = $data['old_'. $key];
}
}
......@@ -165,7 +166,7 @@ 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,
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']);
......@@ -193,9 +194,4 @@ function provision_mysql_provision_verify() {
provision_log("message", t('Mysql can create new databases.'));
}
provision_set_active_db();
}
}
\ No newline at end of file
<?php
// $Id$
/**
* @file
* Drupal specific functions for the provisioning framework.
......@@ -80,7 +81,7 @@ function _provision_drupal_site_installed($url) {
return isset($data['site_installed']) ? $data['site_installed'] : FALSE;
}
}
return false;
return FALSE;
}
/**
......@@ -104,7 +105,7 @@ function provision_drupal_provision_backup($url, $data) {
* The default template for the config file
*/
function _provision_drupal_default_template() {
return file_get_contents(drupal_get_path('module', 'provision_drupal') . '/provision_drupal_settings.tpl.php');
return file_get_contents(drupal_get_path('module', 'provision_drupal') .'/provision_drupal_settings.tpl.php');
}
/**
......@@ -126,7 +127,7 @@ function _provision_drupal_create_settings_file($url, &$data) {
$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));
fwrite($fp, "<?php\n". provision_render_config($text, $data));
fclose($fp);
# Change the permissions of the file
......@@ -143,7 +144,7 @@ function _provision_drupal_create_settings_file($url, &$data) {
*
* Also maintains permissions on existing directories.
*/
function _provision_drupal_create_directories($url, $profile = null) {
function _provision_drupal_create_directories($url, $profile = NULL) {
$paths = array(
"sites/$url" => 0750,
"sites/$url/files" => 02770,
......@@ -156,7 +157,7 @@ function _provision_drupal_create_directories($url, $profile = null) {
foreach ($paths as $path => $perm) {
if (!is_dir($path)) {
provision_path("mkdir", $path, true,
provision_path("mkdir", $path, TRUE,
t("Created <code>@path</code>"),
t("Could not create <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
......@@ -183,7 +184,7 @@ function _provision_drupal_create_directories($url, $profile = null) {
* so that it can cleanly install the database schema. It also handles switching back to the
* main provisioning site.
*/
function _provision_drupal_switch_active_site($url = null) {
function _provision_drupal_switch_active_site($url = NULL) {
static $backups;
if ($url) {
/* Pretend to be the site being installed */
......@@ -191,8 +192,9 @@ function _provision_drupal_switch_active_site($url = null) {
// Fake the necessary HTTP headers that Drupal needs:
$drupal_base_url = parse_url($url);
$_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
$_SERVER['PHP_SELF'] = $drupal_base_url['path'].'/index.php';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF'] = $drupal_base_url['path'] .'/index.php';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; // Coder generates a warning. But this is correct.
$_SERVER['REMOTE_ADDR'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;
......@@ -205,10 +207,10 @@ function _provision_drupal_switch_active_site($url = null) {
global $base_url, $base_path, $base_root;
global $cookie_domain, $conf, $profile, $profile, $db_prefix;
# This is just for backup, to be able to restore to the old DRUSH system.
// This is just for backup, to be able to restore to the old DRUSH system.
$backups = compact("active_db", "base_url", "base_path", "db_prefix", "cookie_domain", "conf", "profile");
include_once $_SERVER['DOCUMENT_ROOT'] .'sites/' . $url . '/settings.php';
include_once $_SERVER['DOCUMENT_ROOT'] .'sites/'. $url .'/settings.php';
// Create base URL
$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
......@@ -231,16 +233,17 @@ function _provision_drupal_switch_active_site($url = null) {
// Fake the necessary HTTP headers that Drupal needs:
$drupal_base_url = parse_url(DRUSH_URI);
$_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
$_SERVER['PHP_SELF'] = $drupal_base_url['path'].'/index.php';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF'] = $drupal_base_url['path'] .'/index.php';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; // Coder generates a warning, but this is correct.
$_SERVER['REMOTE_ADDR'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;
global $base_url, $base_path, $base_root;
// Export the following settings.php variables to the global namespace
// Export the following settings.php variables to the global namespace
global $db_prefix, $cookie_domain, $conf, $profile;
# This is just for backup, to be able to restore to the old DRUSH system.
// This is just for backup, to be able to restore to the old DRUSH system.
extract($backups, EXTR_OVERWRITE);
provision_set_active_db();
}
......@@ -251,8 +254,8 @@ function provision_drupal_provision_post_restore($url, $data) {
}
function provision_drupal_provision_restore($url, $data) {
$old = PROVISION_SITES_PATH . "/$url.restore";
$new = PROVISION_SITES_PATH . "/$url";
$old = PROVISION_SITES_PATH ."/$url.restore";
$new = PROVISION_SITES_PATH ."/$url";
provision_path("switch_paths", $old, $new ,
t('Swapping out the @path and @confirm directories was successful.'),
t('Swapping the @path and @confirm directories has failed.'),
......@@ -270,7 +273,7 @@ function provision_drupal_provision_restore_rollback($url, $data) {
/**
* Force drupal to load the modules it expects to find on an uninstalled site
*/
function _provision_drupal_force_load_modules($url = null) {
function _provision_drupal_force_load_modules($url = NULL) {
static $backup_list;
if ($url) {
$backup_list = module_list();
......@@ -314,7 +317,7 @@ function _provision_drupal_install_schema($profile, $language = 'en') {
}
}
return false;
return FALSE;
}
// Verify existence of all required modules.
......@@ -322,7 +325,7 @@ function _provision_drupal_install_schema($profile, $language = 'en') {
if (!$modules) {
provision_set_error(PROVISION_FRAMEWORK_ERROR);
return false;
return FALSE;
}
// Perform actual installation defined in the profile.
......@@ -342,7 +345,7 @@ function _provision_drupal_install_schema($profile, $language = 'en') {
* implementation of provision_verify
*/
function provision_drupal_provision_verify($url, &$data) {
provision_path("writable", "sites", true, t("Drupal sites directory is writable by the provisioning script"),
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);
$exists = _provision_create_dir(PROVISION_DRUSHRC_PATH, t('Drush configuration path'), 0700);
$data['modules'] = _provision_drupal_get_cvs_versions(module_rebuild_cache());
......@@ -429,7 +432,7 @@ function provision_drupal_provision_import($url, &$data) {
}
}
//Just make sure our ini settings and the like aren't wiped out.
include(conf_path() . "/settings.php");
include(conf_path() ."/settings.php");
}
......
<?php
// $Id$
/**
* @file ProvisionHelp contains the bulk of the provision help system
*/
......@@ -85,35 +86,35 @@ function provision_help($section) {
The Hostmaster profile is capable of driving several provision backends, in a distributed manner, and provides an interface for the functionality of provision.</p>');
$output .= t('<p>It is not required to run the hosting front end to use the Provision framework, but the system does not provide much in the way of a web accessible front end, by design.</p>');
$output .= '<a name=\'requirements\'><h3>' . t('Requirements') . '</h3></a>';
$output .= '<a name=\'requirements\'><h3>'. t('Requirements') .'</h3></a>';
$output .= t('<p>For a more detailed breakdown of steps that need to be taken to configure Provisioning to run with your system, please read the <a href="@url">in depth requirement documentation</a></p>',
array('@url' => url('admin/help/provision/requirements')));
$output .= '<a name=\'commands\'><h3>' . t('Commands') . '</h3></a>';
$output .= '<a name=\'commands\'><h3>'. t('Commands') .'</h3></a>';
$commands = module_invoke_all('drush_command');
$output .= "<dl>";
foreach ($commands as $command => $info) {
if (preg_match('/^provision/', $command)) {
if (sizeof($info['arguments'])) {
$command .= ' ' . implode(' ', (array) key($info['arguments']));
$command .= ' '. implode(' ', (array) key($info['arguments']));
}
if (sizeof($info['optional arguments'])) {
$command .= ' [' . implode('] [', (array) key($info['optional arguments'])) . ']';
$command .= ' ['. implode('] [', (array) key($info['optional arguments'])) .']';
}
$output .= '<dt>' . "<code>drush.php $command</code>" . '</dt>';
$output .= '<dd>' . $info["description"] . '</dd>';
$output .= '<dt>'."<code>drush.php $command</code>".'</dt>';
$output .= '<dd>'. $info["description"] .'</dd>';
}
}
$output .= "</dl>";
$output .= '<a name=\'options\'><h3>' . t('Options') . '</h3></a>';
$output .= '<a name=\'options\'><h3>'. t('Options') .'</h3></a>';
$options = module_invoke_all('value_list');
$output .= "<dl>";
foreach ($options as $option => $description) {
$output .= '<dt>' . "<code>--$option</code>" . '</dt>';
$output .= '<dd>' . $description . '</dd>';
$output .= '<dt>'."<code>--$option</code>".'</dt>';
$output .= '<dd>'. $description .'</dd>';
}
$output .= "</dl>";
......@@ -138,7 +139,7 @@ function provision_help_requirements() {
$name = current($service);
$help = module_invoke($module, 'help', 'admin/help/provision#requirements');
if ($name && $help) {
$output .= "<a href='requirements-$module'></a><h3>" . t($name) . '</h3>';
$output .= "<a href='requirements-$module'></a><h3>". t($name) .'</h3>';
$output .= $help;
}
}
......@@ -155,10 +156,10 @@ function _provision_requirements($req, $section = 'all') {
/*
foreach (array('#heading', '#summary', '#suggestion', '#configuration') as $key) {
if (in_array($section, array('all', $key))) {
$item['#' . $key] = PROVISION_HELP_ENABLED;
$item['#'. $key] = PROVISION_HELP_ENABLED;
}
elseif ($section != 'all') {
$item['#' . $key] = ($section == $key) ? PROVISION_HELP_ENABLED : PROVISION_HELP_DISABLED;
$item['#'. $key] = ($section == $key) ? PROVISION_HELP_ENABLED : PROVISION_HELP_DISABLED;
}
}
*/
......@@ -167,7 +168,7 @@ function _provision_requirements($req, $section = 'all') {
}
function provision_get_requirement($req) {
$func = '_provision_' . $req . '_requirements';
$func = '_provision_'. $req .'_requirements';
if (function_exists($func)) {
$help = $func();
}
......@@ -248,7 +249,7 @@ EOF;
*/
function provision_elements() {
$type['requirement_help'] = array(
'#requirement' => null,
'#requirement' => NULL,
'#status' => PROVISION_STATUS_NONE,
'#heading' => PROVISION_HELP_ENABLED,
'#summary' => PROVISION_HELP_ENABLED,
......@@ -282,19 +283,19 @@ function provision_requirement_process(&$element) {
* Can control individual components of the help, for display in various places.
*/
function theme_requirement_help(&$element) {
drupal_add_js(drupal_get_path('module', 'provision') . '/provision.js');
drupal_add_css(drupal_get_path('module', 'provision') . '/provision.css');
drupal_add_js(drupal_get_path('module', 'provision') .'/provision.js');
drupal_add_css(drupal_get_path('module', 'provision') .'/provision.css');
$req = $element['#requirement'];
$help = $element['#help']; // this is just to make it easier to work with.
//place anchor so user can be directed to right page.
$output .= "<a name='provision-help-$req'></a>";
$output .= '<div class="provision-' . form_clean_id($element["#type"]) .
' ' . _provision_status_class($element['#status']) . '">';
$output .= '<div class="provision-'. form_clean_id($element["#type"]) .
' '. _provision_status_class($element['#status']) .'">';
if ($element['#status'] != PROVISION_STATUS_NONE) {
$output .= "<div class='message'>" . (($element['#message']) ? $element['#message'] : $element['#default_messages'][$element['#status']]) . "</div>";
$output .= "<div class='message'>". (($element['#message']) ? $element['#message'] : $element['#default_messages'][$element['#status']]) ."</div>";
}
$components = array('summary', 'suggestion', 'configuration');
......@@ -306,11 +307,11 @@ function theme_requirement_help(&$element) {
// it is simpler if there's only one way to print the component
$help[$key] = array($help[$key]);
}
if ($element["#$key" . '_prefix'] && ($element["#$key"] & _PROVISION_HELP_CAN_COLLAPSE)) {
$output .= '<a href="javascript:void(0)" class="provision-help-toggle">' . $element["#$key" . '_prefix'] . '</a>';
if ($element["#$key".'_prefix'] && ($element["#$key"] & _PROVISION_HELP_CAN_COLLAPSE)) {
$output .= '<a href="javascript:void(0)" class="provision-help-toggle">'. $element["#$key".'_prefix'] .'</a>';
}
$output .= "<div class='provision-help'><p>" . implode("</p><p>", $help[$key]) . "</p></div>";
$output .= "<div class='provision-help'><p>". implode("</p><p>", $help[$key]) ."</p></div>";
$output .= '</div>';
}
}
......
<?php
// $Id$
/**
* @file
* The provisioning framework API.
......@@ -35,15 +36,15 @@
* A boolean specifying whether or not any rollback has been performed.
*
*/
function provision_invoke($hook, $url, &$data, $rollback = false) {
function provision_invoke($hook, $url, &$data, $rollback = FALSE) {
if (!$rollback) {
foreach (module_implements("provision_$hook") as $name) {
_provision_log_messages();
$completed[] = $name;
$func = $name . "_provision_" . $hook;
$func = $name .'_provision_'. $hook;
$func($url, $data);
# this is run before and after so that messages appear in the correct order.
//this is run before and after so that messages appear in the correct order.
_provision_log_messages();
if (provision_get_error()) {
# As soon as an error occurs, roll back
......@@ -58,10 +59,10 @@ function provision_invoke($hook, $url, &$data, $rollback = false) {
if ($rollback) {
foreach (array_reverse($completed) as $name) {
$func = $name . "_" . $hook . '_rollback';
$func = $name .'_'. $hook .'_rollback';
if (function_exists($func)) {
$func($url, $data);
provision_set_log("Rollback", "Changes for $name module have been rolled back.");
provision_set_log('Rollback', "Changes for $name module have been rolled back.");
}
}
return TRUE;
......@@ -78,16 +79,16 @@ function provision_invoke($hook, $url, &$data, $rollback = false) {
function _provision_log_messages() {
$messages = drupal_get_messages();
# Drupal message errors.
//Drupal message errors.
foreach ((array) $messages['error'] as $error) {
if (preg_match("/^warning:/", $error)) {
provision_log("warning", ereg_replace("/^warning: /", '', $error));
if (preg_match('/^warning:/', $error)) {
provision_log('warning', ereg_replace('/^warning: /', '', $error));
}
elseif (preg_match("/^user warning:/", $error)) {
provision_log("error", ereg_replace("/^user warning: /", '', $error));
elseif (preg_match('/^user warning:/', $error)) {
provision_log("error", ereg_replace('/^user warning: /', '', $error));
}
else {
provision_log("error", $error);
provision_log('error', $error);
}
}
......@@ -108,7 +109,7 @@ function _provision_log_messages() {
* @param extra
* An associative array containing additional data to be returned from the command. @see provision_stats_stats()
*/
function provision_output($url = null, $data = array(), $extra = null) {
function provision_output($url = NULL, $data = array(), $extra = NULL) {
$return = $extra;
$return['site'] = $data;
......@@ -124,9 +125,10 @@ function provision_output($url = null, $data = array(), $extra = null) {
}
else {
if ($return) {
if ($output = theme("provision_" . $data['task_type'] . "_output", $url, $return)) {
if ($output = theme('provision_'. $data['task_type'] .'_output', $url, $return)) {
return $output;
} else {
}
else {
/** TODO : return a cleanly formatted display of all the necessary information */
print_r($return);
}
......@@ -210,11 +212,11 @@ function provision_cmp_error($error) {
* @param entry
* Associative array containing the log message.
* @return
* Entire log history, only if $entry is null
* Entire log history, only if $entry is NULL
*/
function _provision_set_log($entry = null) {
function _provision_set_log($entry = NULL) {
static $log = array();
if ($entry == null) {
if ($entry == NULL) {
return $log;
}
else {
......@@ -277,7 +279,7 @@ function provision_get_log() {
*/
function provision_get_site_data($url) {
global $args;
#TODO: Accept serialized string via unix pipe.
//TODO: Accept serialized string via unix pipe.
foreach ($args['options'] as $key => $value) {
if (preg_match("/^site_/", $key)) {
$site_data[$key] = $value;
......@@ -285,7 +287,7 @@ function provision_get_site_data($url) {
}
$site_data['site_url'] = $url;
$site_data['task_type'] = $args['commands'][1];
$site_data['task_id'] = drush_get_option('task_id', null);
$site_data['task_id'] = drush_get_option('task_id', NULL);
$site_data['publish_path'] = PROVISION_DOCROOT_PATH;
$site_data['site_profile'] = ($site_data['site_profile']) ? $site_data['site_profile'] : variable_get('provision_default_profile', 'default');
$site_data['site_ip'] = variable_get('provision_apache_server_ip', '127.0.0.1');
......@@ -295,7 +297,7 @@ function provision_get_site_data($url) {
$site_data['site_language'] = $site_data['site_language'] ? $site_data['site_language'] : 'en';
if ($old_data = provision_load_site_data($url)) {
# Merge previously saved data with the new data. This way, old parameters overwrite new ones.
//Merge previously saved data with the new data. This way, old parameters overwrite new ones.
$site_data = array_merge($old_data, $site_data);
}
......@@ -311,13 +313,13 @@ function provision_get_site_data($url) {
* If the file was found, an associative array of the data that was loaded. Otherwise returns FALSE.
*/
function provision_load_site_data($url) {
# Load the configuration data.
//Load the configuration data.
$conf_file = "sites/$url/site.php";
if (file_exists($conf_file) && is_readable($conf_file)) {
require($conf_file);
return (array) $data;
}
return false;
return FALSE;
}
/**
......@@ -336,30 +338,30 @@ function provision_save_site_data($url, $data) {
//initialize the file. this is lame, i know. but it will work.
if (!file_exists($conf_file)) {
$fp = fopen($conf_file, "a+"); # Append to the end of the config file.
$fp = fopen($conf_file, 'a+'); //Append to the end of the config file.
fwrite($fp, "<?php\n");
fclose($fp);
}
$fp = fopen($conf_file, "a+");
if (!$fp) {
provision_log("error", "Site config file could not be written");
provision_log('error', 'Site config file could not be written');
provision_set_error(PROVISION_PERM_ERROR);
}
else {
$timestamp = mktime();
$aid = $data['task_id'];
fwrite($fp, "\n\n#" . format_date($timestamp, "large"));
fwrite($fp, "\n\n#". format_date($timestamp, 'large'));
if ($aid) {
$task = array('task' => $data['task_type'], 'status' => provision_get_error());
$line = "\n\$tasks[$aid][$timestamp] = " . str_replace(array(" ", "\n"), "", var_export($task, TRUE)) . ";";
$line = "\n\$tasks[$aid][$timestamp] = ". str_replace(array(' ', "\n"), '', var_export($task, TRUE)) .';';
fwrite($fp, $line);
}
foreach ($data as $key => $value) {
if (preg_match("/^site_/", $key)) {
if (preg_match('/^site_/', $key)) {
if ($data[$key] != $old_data[$key]) {
$line = "\n\$data['$key'] = " . var_export($value, true) . ';';
$line = "\n\$data['$key'] = ". var_export($value, TRUE) .';';
fwrite($fp, $line);
}
}
......@@ -388,13 +390,13 @@ function provision_save_site_data($url, $data) {
*/
function provision_value_list() {
/** TODO: Complete the value list to allow the front end to more easily edit the settings. */
$values['site_url'] = t("The domain name used to access the site. This is defaulted to the value used on the command line.");
$values['site_db_type'] = t("The type of database server used");
$values['site_db_username'] = t("Username to access database for site");
$values['site_db_password'] = t("Password to access database for site");
$values['site_db_name'] = t("Database name for the site");
$values['site_profile'] = t("Install profile of site");
$values['site_task_type'] = t("What type of task has been used. Only used in conjuction with hosting front end");
$values['site_url'] = t('The domain name used to access the site. This is defaulted to the value used on the command line.');
$values['site_db_type'] = t('The type of database server used');
$values['site_db_username'] = t('Username to access database for site');
$values['site_db_password'] = t('Password to access database for site');
$values['site_db_name'] = t('Database name for the site');
$values['site_profile'] = t('Install profile of site');
$values['site_task_type'] = t('What type of task has been used. Only used in conjuction with hosting front end');
return $values;
}
......@@ -405,7 +407,7 @@ function provision_value_list() {
function provision_render_config($template, $variables) {
extract($variables, EXTR_SKIP); // Extract the variables to a local namespace
ob_start(); // Start output buffering
eval("?>" . $template); // Generate content
eval('?>'. $template); // Generate content
$contents = ob_get_contents(); // Get the contents of the buffer
ob_end_clean(); // End buffering and discard
return $contents; // Return the contents
......@@ -420,32 +422,33 @@ function provision_render_config($template, $variables) {
* Remove files or directories, recursively
*
* This was taken from imagecache.module, with slight modifications:
* - carry error codes along the way (returns true only if all operations return true)
* - carry error codes along the way (returns TRUE only if all operations return TRUE)
* - remove any type of files encountered (not just links, files and dirs)
* - safety checking since we don't necessarly trust the removed files
*/
function _provision_recursive_delete($path) {
if (is_dir($path)) {
$d = dir($path);
while (($entry = $d->read()) !== false) {
while (($entry = $d->read()) !== FALSE)