Skip to content
Snippets Groups Projects
Commit bab2d219 authored by Andreas Hennings's avatar Andreas Hennings
Browse files

Merge '3183346-regression-overridden-features' by donquixote, nedjo, kruser, torotil into 7.x-2.x.

Reported by: kruser, torotil.
Reviewed by: nedjo.
parents 12aa9549 a58b8de5
No related branches found
Tags 5.x-2.7
No related merge requests found
......@@ -1033,9 +1033,6 @@ function features_set_signature($module, $component, $signature = NULL, $message
* that were using a -dev branch after 7.x-2.11.
* Since #3162854, it is stored in a dedicated non-cache table.
*
* @param bool $reset
* TRUE, to reset the static cache.
*
* @return string
* One of 'table', 'cache' or 'type'.
* On a fully updated database, this value will be 'table'.
......@@ -1044,11 +1041,8 @@ function features_set_signature($module, $component, $signature = NULL, $message
* @see \features_set_signature()
* @see \features_update_7202()
*/
function _features_get_signature_storage_type($reset = FALSE) {
static $type;
if ($reset) {
$type = NULL;
}
function _features_get_signature_storage_type() {
$type = &drupal_static(__FUNCTION__);
if ($type !== NULL) {
return $type;
}
......
......@@ -76,6 +76,8 @@ function features_uninstall() {
variable_del('features_ignored_orphans');
variable_del('features_feature_locked');
variable_del('features_lock_mode');
variable_del('features_update_7202_fixed_tmp');
variable_del('features_update_7202_possibly_broken');
db_delete('variable')
->condition('name', 'features_admin_show_component_%', 'LIKE')
......@@ -246,10 +248,10 @@ function features_update_7202() {
db_create_table('features_signature', $schema);
}
// Load existing signatures.
if (db_table_exists('cache_features')) {
// The original version of the previous update has already run.
if (db_table_exists('cache_featurestate')) {
// The old version of features_update_7201() has run in the past, and a
// cache table was created to replace the 'features_codecache' variable.
$cache = cache_get('features_codecache', 'cache_featurestate');
$signaturess = !empty($cache->data)
? $cache->data
......@@ -257,7 +259,8 @@ function features_update_7202() {
$message = __FUNCTION__ . '() - from cache storage';
}
else {
// The update is from an earlier version of features.
// The current (inactive) version of features_update_7201() has run, and the
// 'features_codecache' variable still exists.
$signaturess = variable_get('features_codecache', array());
$message = __FUNCTION__ . '() - from variable storage';
}
......@@ -297,12 +300,19 @@ function features_update_7202() {
// On failure, allow the exception to trickle up.
$insert->execute();
// Set a temporary marker variable for subsequent updates.
// This variable was not set in an older version of this update.
variable_set('features_update_7202_fixed_tmp', TRUE);
// Delete the old table and variable if the data migration was successful.
variable_del('features_codecache');
if (db_table_exists('cache_featurestate')) {
db_drop_table('cache_featurestate');
}
// Reset the static cache that determines the storage type.
drupal_static_reset('_features_get_signature_storage_type');
}
/**
......@@ -325,3 +335,22 @@ function features_update_7203() {
'not null' => TRUE,
));
}
/**
* Set a marker variable, if the site could be affected by undesired reverts.
*/
function features_update_7204() {
if (variable_get('features_update_7202_fixed_tmp')) {
// The fixed version of features_update_7202() did run.
// Delete the temporary marker variable.
variable_del('features_update_7202_fixed_tmp');
}
else {
// Either the old broken version of features_update_7202() ran, or features
// was newly installed in a version where 7202 or 7203 was the latest
// update.
// Set a marker variable, indicating that some overridden features
// components might have been accidentally reverted. See #3183346.
variable_set('features_update_7202_possibly_broken', TRUE);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment