Commit 397a885f authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Reverted broken serialization patch

parent 46fd4e6e
......@@ -13,8 +13,6 @@
* @see provisionvalues
*/
define('PROVISION_OUTPUT', 'PROVISION_OUTPUT>>>');
/**
* Invoke provision api calls.
*
......@@ -97,35 +95,6 @@ function _provision_log_messages() {
}
function provision_parse_output($lines) {
$start = FALSE;
$output = '';
foreach ($lines as $line) {
if (preg_match('/^' . PROVISION_OUTPUT . '/', $line)) {
// found the start out output.
$line = str_replace(PROVISION_OUTPUT, '', $line);
$start = TRUE;
}
if ($start) {
$output .= $line;
}
else {
if (!trim($line)) {
$messages[] = array('type' => 'warning', 'message' => $line, 'timestamp' => time());
}
}
}
if ($start) {
$data = unserialize($output);
if (is_array($data)) {
if (is_array($messages)) {
$data['log'] = array_merge($data['log'], $messages);
}
return $data;
}
}
return false;
}
/**
......@@ -153,7 +122,7 @@ function provision_output($url = NULL, $data = array(), $extra = NULL) {
$return['log'] = provision_get_log(); // Append logging information
$return['messages'] = drupal_get_messages();
if (PROVISION_DRUSH_BACKEND) {
print PROVISION_OUTPUT . serialize($return);
print serialize($return);
}
else {
if ($return) {
......@@ -649,8 +618,9 @@ function provision_posix_groupname($group) {
*/
function provision_exec($cmd, &$data) {
exec($cmd, $return, $code);
$return = join("", $return);
provision_log('command', t('Running: @cmd', array('@cmd' => $cmd)));
$values = provision_parse_output($return);
$values = unserialize($return);
if (is_array($values)) {
$data = array_merge($data, $values['site']);
foreach ($values['log'] as $log) {
......@@ -663,7 +633,7 @@ function provision_exec($cmd, &$data) {
}
else {
provision_set_error(PROVISION_FRAMEWORK_ERROR);
provision_log('error',t("The command could not be executed succesfully (returned: !return, code: %code)", array("!return" => implode('', $return), "%code" => $code)));
provision_log('error',t("The command could not be executed succesfully (returned: !return, code: %code)", array("!return" => $return, "%code" => $code)));
return FALSE;
}
};
......
......@@ -99,55 +99,53 @@ function provision_init() {
provision_load_from_args();
// Set up defines for platform
if (function_exists('drush_get_option')) {
$docroot = drush_get_option(array("r", "root"), $_SERVER['PWD']);
$backend = drush_get_option(array('b', 'backend'), 0);
define("PROVISION_DRUSH_BACKEND", $backend);
define('PROVISION_DOMAIN', $_SERVER['HTTP_HOST']);
// Paths
$path = ($docroot) ? $docroot : $_SERVER['DOCUMENT_ROOT'];
define('PROVISION_DOCROOT_PATH', rtrim($path, '/'));
define('PROVISION_SITES_PATH', rtrim($path, '/') .'/sites');
define('PROVISION_DRUSH_PATH', './drush.php');
$parts = explode("/", rtrim($path, '/'));
array_pop($parts);
define('PROVISION_PARENT_PATH', rtrim(implode("/" , $parts), '/'));
define('PROVISION_BACKUP_PATH',
drush_get_option('backup_path', PROVISION_PARENT_PATH . '/backups'));
define('PROVISION_CONFIG_PATH',
drush_get_option('config_path', PROVISION_PARENT_PATH .'/config'));
define('PROVISION_VHOST_PATH', PROVISION_CONFIG_PATH .'/vhost.d');
// Commands
define('PROVISION_RESTART_CMD',
drush_get_option('restart_cmd', _provision_default_restart_cmd()));
// System account
$info = posix_getgrgid(posix_getgid());
define('PROVISION_WEB_GROUP',
drush_get_option('web_group', $info['name'] ));
define('PROVISION_SCRIPT_USER',
drush_get_option('script_user', get_current_user() ));
// Redirection urls
define('PROVISION_MASTER_URL',
drush_get_option('master_url', variable_get('install_url', $GLOBALS['base_url'])));
define('PROVISION_WEB_DISABLE_URL', PROVISION_MASTER_URL .'/provision/disabled');
define('PROVISION_WEB_MAINTENENCE_URL', PROVISION_MASTER_URL .'/provision/maintenance');
// Database
define('PROVISION_MASTER_DB',
drush_get_option('master_db', $GLOBALS['db_url']));
$db = parse_url(PROVISION_MASTER_DB);
define('PROVISION_DB_USER', $db['user']);
define('PROVISION_DB_PASSWD', $db['pass']);
define('PROVISION_DB_HOST', $db['host']);
// Drupal does not support multiple types of connections in the same session
preg_match("$^([a-z]*)://$", $GLOBALS['db_url'], $matches);
define('PROVISION_DB_TYPE', $matches[1]);
}
$docroot = provision_get_option(array("r", "root"), $_SERVER['PWD']);
$backend = provision_get_option(array('b', 'backend'), 0);
define("PROVISION_DRUSH_BACKEND", $backend);
define('PROVISION_DOMAIN', $_SERVER['HTTP_HOST']);
// Paths
$path = ($docroot) ? $docroot : $_SERVER['DOCUMENT_ROOT'];
define('PROVISION_DOCROOT_PATH', rtrim($path, '/'));
define('PROVISION_SITES_PATH', rtrim($path, '/') .'/sites');
define('PROVISION_DRUSH_PATH', './drush.php');
$parts = explode("/", rtrim($path, '/'));
array_pop($parts);
define('PROVISION_PARENT_PATH', rtrim(implode("/" , $parts), '/'));
define('PROVISION_BACKUP_PATH',
provision_get_option('backup_path', PROVISION_PARENT_PATH . '/backups'));
define('PROVISION_CONFIG_PATH',
provision_get_option('config_path', PROVISION_PARENT_PATH .'/config'));
define('PROVISION_VHOST_PATH', PROVISION_CONFIG_PATH .'/vhost.d');
// Commands
define('PROVISION_RESTART_CMD',
provision_get_option('restart_cmd', _provision_default_restart_cmd()));
// System account
$info = posix_getgrgid(posix_getgid());
define('PROVISION_WEB_GROUP',
provision_get_option('web_group', $info['name'] ));
define('PROVISION_SCRIPT_USER',
provision_get_option('script_user', get_current_user() ));
// Redirection urls
define('PROVISION_MASTER_URL',
provision_get_option('master_url', variable_get('install_url', $GLOBALS['base_url'])));
define('PROVISION_WEB_DISABLE_URL', PROVISION_MASTER_URL .'/provision/disabled');
define('PROVISION_WEB_MAINTENENCE_URL', PROVISION_MASTER_URL .'/provision/maintenance');
// Database
define('PROVISION_MASTER_DB',
provision_get_option('master_db', $GLOBALS['db_url']));
$db = parse_url(PROVISION_MASTER_DB);
define('PROVISION_DB_USER', $db['user']);
define('PROVISION_DB_PASSWD', $db['pass']);
define('PROVISION_DB_HOST', $db['host']);
// Drupal does not support multiple types of connections in the same session
preg_match("$^([a-z]*)://$", $GLOBALS['db_url'], $matches);
define('PROVISION_DB_TYPE', $matches[1]);
}
function _provision_default_restart_cmd() {
......
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