Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save orakili/1266780 to your computer and use it in GitHub Desktop.
Save orakili/1266780 to your computer and use it in GitHub Desktop.
Drupal - Strongarm 7.x-2.x - #1286396: Undefined property: stdClass::$in_code_only
diff --git strongarm.admin.inc strongarm.admin.inc
index 9a82a24..87546e3 100644
--- strongarm.admin.inc
+++ strongarm.admin.inc
@@ -20,7 +20,7 @@ function strongarm_admin_form($form_state) {
$storage = t('Hardcoded');
$hardcoded = TRUE;
}
- elseif (isset($variable->in_code_only)) {
+ elseif (!empty($variable->in_code_only)) {
$storage = t('In code');
$restorable = TRUE;
}
diff --git strongarm.drush.inc strongarm.drush.inc
index 4154303..7afe9e2 100644
--- strongarm.drush.inc
+++ strongarm.drush.inc
@@ -33,7 +33,7 @@ function _drush_strongarm_revert($force) {
$vars = strongarm_vars_load(TRUE, TRUE);
foreach ($vars as $name => $var) {
- if ($force || isset($var->in_code_only)) {
+ if ($force || !empty($var->in_code_only)) {
if (!isset($conf[$name]) || $var->value != $conf[$name]) {
variable_set($name, $var->value);
}
diff --git strongarm.module strongarm.module
index 2ae5625..4059d33 100644
--- strongarm.module
+++ strongarm.module
@@ -115,7 +115,7 @@ if (!function_exists('variable_features_revert')) {
$vars = strongarm_vars_load(TRUE, TRUE);
foreach ($defaults as $name => $default) {
- if (isset($vars[$name]->in_code_only) || ($default->value !== $vars[$name]->value)) {
+ if (!empty($vars[$name]->in_code_only) || ($default->value !== $vars[$name]->value)) {
variable_set($name, $default->value);
}
}
@@ -134,7 +134,7 @@ function variable_features_rebuild($module) {
$vars = strongarm_vars_load(TRUE, TRUE);
foreach ($defaults as $name => $default) {
- if (isset($vars[$name]->in_code_only) || (drupal_installation_attempted() && $vars[$name]->export_type & EXPORT_IN_CODE)) {
+ if (!empty($vars[$name]->in_code_only) || (drupal_installation_attempted() && $vars[$name]->export_type & EXPORT_IN_CODE)) {
variable_set($name, $default->value);
}
}
@@ -155,7 +155,7 @@ function variable_features_export($data, &$export, $module_name) {
// Then remove any vars from the export that are only in code
$vars = strongarm_vars_load(TRUE, TRUE);
foreach ($data as $object_name) {
- if(!isset($vars[$object_name]) || $vars[$object_name]->in_code_only) {
+ if (!isset($vars[$object_name]) || !empty($vars[$object_name]->in_code_only)) {
unset($export['features']['variable'][$object_name]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment