Commit 163d62b3 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Add provisional Drupal 7 support in for platform and site verification, site...

Add provisional Drupal 7 support in for platform and site verification, site import and site deploy (meaning clone etc.). This is needed to test the migration for the updatedb command in drush HEAD, so migration of D7 sites wont work until we have a new drush out
parent 53027636
......@@ -13,8 +13,7 @@
*/
function _provision_cvs_deploy(&$file) {
$file->filename = realpath($file->filename);
$project = $file->info['project'];
$project = ($project) ? $project : _provision_cvs_deploy_get_project_name($file);
$project = (isset($file->info['project'])) ? $file->info['project'] : _provision_cvs_deploy_get_project_name($file);
$file->project = $project;
_provision_cvs_deploy_version_alter($file->info['version'], $file);
$file->version = $file->info['version'];
......
<?php
// $Id$
/**
* @file
* Rebuild all the caches
*/
cache_clear_all();
drush_log(t('Cleared all caches'));
node_types_rebuild();
drush_log(t('Rebuild node type cache'));
system_rebuild_module_data();
drush_log(t('Rebuild module cache'));
system_rebuild_theme_data();
drush_log(t('Rebuild theme cache'));
node_access_rebuild();
drush_log(t('Rebuild node access cache'));
menu_rebuild();
drush_log(t('Rebuild menu cache'));
......@@ -4,7 +4,6 @@
$new_url = drush_get_option('site_url');
$old_url = drush_get_option('site_url', 'site');
/**
* @file
* Handle site migration tasks for redeployed sites.
......
<?php
// $Id
$new_url = drush_get_option('site_url');
$old_url = drush_get_option('site_url', 'site');
$sql_args = array(':oldpath' => "sites/$old_url", ':newpath' => "sites/$new_url");
/**
* @file
* Handle site migration tasks for redeployed sites.
* This is primarily to handle the rename of the sites
* directories.
*/
drush_log(
dt('Changed paths from sites/@old_url to sites/@new_url',
array('@old_url' => $old_url, '@new_url' => $new_url)));
db_query("UPDATE {files} SET filepath=replace(filepath, :oldpath, :newpath)", $sql_args);
db_query("UPDATE {users} SET picture = replace(picture, :oldpath, :newpath)", $sql_args);
variable_set('files_directory_path', "sites/$new_url/files");
variable_set('files_directory_temp', "sites/$new_url/files/tmp");
......@@ -2,7 +2,7 @@
// $Id$
/**
* @file Package management code for Drupal 6 and Drupal 7
* @file Package management code for Drupal 6
*/
/**
......@@ -108,3 +108,11 @@ function _provision_drupal_parse_info_file($filename) {
return $info;
}
function _provision_system_query($type) {
$entries = array();
$result = db_query("SELECT * FROM {system} WHERE type='%s'", $type);
while ($entry = db_fetch_object($result)) {
$entries[] = $entry;
}
return $entries;
}
......@@ -57,3 +57,13 @@ function _provision_drupal_find_themes($scope, $key = '') {
return $files;
}
function _provision_system_query($type) {
$entries = array();
$result = db_query("SELECT * FROM {system} WHERE type='%s'", $type);
while ($entry = db_fetch_object($result)) {
$entries[] = $entry;
}
return $entries;
}
<?php
// $Id$
/**
* @file Package management code for Drupal 7
*/
/**
* Find themes in a certain scope
*
* This function is based on _system_theme_data in Drupal 6 and Drupal 7.
* We do not support, nor need information on subthemes at this point.
*/
function _provision_drupal_find_themes($scope, $key = '') {
$paths = _provision_drupal_search_paths($scope, $key, 'themes');
$files = array();
$engines = array();
foreach ($paths as $path) {
$files = array_merge($files, drush_scan_directory($path, ".info$", array('.', '..', 'CVS', '.svn'), 0, true, 'name'));
$engines = array_merge($engines, drush_scan_directory($path . "/engines", ".engine$", array('.', '..', 'CVS', '.svn'), 0, true, 'name'));
}
foreach ($files as $name => $file) {
$files[$name]->info = _provision_drupal_parse_info_file($file->filename);
if (!empty($files[$name]->info['name'])) {
$files[$name]->name = $files[$name]->info['name'];
}
if (empty($files[$name]->info['engine'])) {
$filename = dirname($files[$name]->filename) .'/'. $files[$name]->name .'.theme';
if (file_exists($filename)) {
$files[$name]->owner = $filename;
$files[$name]->prefix = $name;
}
}
else {
$engine = $files[$name]->info['engine'];
if (isset($engines[$engine])) {
$files[$name]->owner = $engines[$engine]->filename;
$files[$name]->prefix = $engines[$engine]->name;
$files[$name]->template = TRUE;
}
}
_provision_cvs_deploy($files[$name]);
}
return $files;
}
/**
* This code is based on the Drupal 6 and Drupal 7 drupal_parse_info_file
*/
function _provision_drupal_parse_info_file($filename) {
$info = array();
if (!file_exists($filename)) {
return $info;
}
$data = file_get_contents($filename);
if (preg_match_all('
@^\s* # Start at the beginning of a line, ignoring leading whitespace
((?:
[^=;\[\]]| # Key names cannot contain equal signs, semi-colons or square brackets,
\[[^\[\]]*\] # unless they are balanced and not nested
)+?)
\s*=\s* # Key/value pairs are separated by equal signs (ignoring white-space)
(?:
("(?:[^"]|(?<=\\\\)")*")| # Double-quoted string, which may contain slash-escaped quotes/slashes
(\'(?:[^\']|(?<=\\\\)\')*\')| # Single-quoted string, which may contain slash-escaped quotes/slashes
([^\r\n]*?) # Non-quoted string
)\s*$ # Stop at the next end of a line, ignoring trailing whitespace
@msx', $data, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// Fetch the key and value string
$i = 0;
foreach (array('key', 'value1', 'value2', 'value3') as $var) {
$$var = isset($match[++$i]) ? $match[$i] : '';
}
$value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3;
// Parse array syntax
$keys = preg_split('/\]?\[/', rtrim($key, ']'));
$last = array_pop($keys);
$parent = &$info;
// Create nested arrays
foreach ($keys as $key) {
if ($key == '') {
$key = count($parent);
}
if (!isset($parent[$key]) || !is_array($parent[$key])) {
$parent[$key] = array();
}
$parent = &$parent[$key];
}
// Handle PHP constants
if (defined($value)) {
$value = constant($value);
}
// Insert actual value
if ($last == '') {
$last = count($parent);
}
$parent[$last] = $value;
}
}
return $info;
}
function _provision_system_query($type) {
$entries = array();
$result = db_query("SELECT * FROM {system} WHERE type=:type", array(':type' => $type));
foreach ($result as $entry) {
$entries[] = $entry;
}
return $entries;
}
......@@ -468,9 +468,8 @@ function provision_drupal_system_map() {
$profile = drush_get_option('profile');
$packages['profiles'][$profile] = $profiles[$profile];
$packages['profiles'][$profile]->status = 1;
$result = db_query("SELECT * FROM {system} WHERE type='module'");
while ($module = db_fetch_object($result)) {
foreach (_provision_system_query("module") as $module) {
$info_file = sprintf("%s/%s.info", dirname($module->filename), $module->name);
$module->info = provision_parse_info_file($info_file);
......@@ -484,8 +483,7 @@ function provision_drupal_system_map() {
drush_log(dt("Found !count modules", array('!count' => sizeof($packages['modules']))));
$result = db_query("SELECT * FROM {system} WHERE type='theme'");
while ($theme = db_fetch_object($result)) {
foreach (_provision_system_query("theme") as $theme) {
$info_file = sprintf("%s/%s.info", dirname($theme->filename), $theme->name);
$theme->info = provision_parse_info_file($info_file);
_provision_cvs_deploy($theme);
......
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