Commit 7f19c2a3 authored by young hahn's avatar young hahn
Browse files

Update script for setting strongarm 1.x variables.

parent d26f91a9
......@@ -19,7 +19,7 @@ function strongarm_update_6100() {
}
/**
* Update 6100: Install CTools
* Update 6200: Install CTools
*/
function strongarm_update_6200() {
drupal_install_modules(array('ctools'));
......@@ -29,3 +29,22 @@ function strongarm_update_6200() {
}
return array(array('success' => TRUE, 'query' => 'Enabled CTools successfully.'));
}
/**
* Update 6201: Set all strongarm 1.x variables that are not already set.
*/
function strongarm_update_6201() {
$ret = array();
$modules = module_implements('strongarm');
foreach ($modules as $module) {
$variables = module_invoke($module, 'strongarm');
foreach ($variables as $variable => $value) {
$exists = db_result(db_query("SELECT name FROM {variable} WHERE name = '%s'", $variable));
if (!$exists && !(is_object($value) && isset($value->api_version))) {
variable_set($variable, $value);
$ret[] = array('success' => TRUE, 'query' => "Set 1.x strongarmed variable {$variable} in the database.");
}
}
}
return $ret;
}
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