Commit 31e0e183 authored by webchick's avatar webchick

Issue #1887904 by larowlan: Fixed update_retrieve_dependencies() only considers enabled modules.

parent d9666b27
......@@ -1188,8 +1188,14 @@ function update_retrieve_dependencies() {
$return = array();
// Get a list of installed modules, arranged so that we invoke their hooks in
// the same order that module_invoke_all() does.
foreach (config('system.module')->get('enabled') as $module => $weight) {
$function = $module . '_update_dependencies';
foreach (drupal_container()->get('keyvalue')->get('system.schema')->getAll() as $module => $schema) {
if ($schema == SCHEMA_UNINSTALLED) {
// Nothing to upgrade.
continue;
}
$function = $module . '_update_dependencies';
// Ensure install file is loaded.
module_load_install($module);
if (function_exists($function)) {
$result = $function();
// Each implementation of hook_update_dependencies() returns a
......
......@@ -505,8 +505,10 @@ function locale_update_8004() {
$negotiation = update_variable_get('language_negotiation_' . $type, NULL);
if (!empty($negotiation)) {
foreach ($negotiation as $method_id => &$method) {
$method['callbacks']['negotiation'] = $method['callbacks']['language'];
unset($method['callbacks']['language']);
if (isset($method['callbacks']['language'])) {
$method['callbacks']['negotiation'] = $method['callbacks']['language'];
unset($method['callbacks']['language']);
}
if (isset($method['callbacks']['switcher'])) {
$method['callbacks']['language_switch'] = $method['callbacks']['switcher'];
unset($method['callbacks']['switcher']);
......
......@@ -53,5 +53,6 @@ public function testDisabledUpgrade() {
require_once DRUPAL_ROOT . '/core/includes/install.inc';
$updates = update_get_update_list();
$this->assertEqual($updates, array(), 'No pending updates after enabling all modules.');
$this->assertTrue(state()->get('update_test_1_update_dependencies_run'), 'Module update dependencies resolved for disabled modules');
}
}
......@@ -11,6 +11,7 @@
* @see update_test_2_update_dependencies()
*/
function update_test_1_update_dependencies() {
state()->set('update_test_1_update_dependencies_run', TRUE);
// These dependencies are used in combination with those declared in
// update_test_2_update_dependencies() for the sole purpose of testing that
// the results of hook_update_dependencies() are collected correctly and have
......
......@@ -18,3 +18,11 @@
->condition('name', array('filter', 'field', 'field_sql_storage', 'entity',
'system', 'text', 'user'), 'NOT IN')
->execute();
db_update('system')
->fields(array(
'schema_version' => 0,
))
->condition('type', 'module')
->condition('name', 'update_test_1')
->execute();
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