Is it possible to disable The Update manager module without uninstalling it?
4 Answers
You cannot disable a module as you do with Drupal 7 or previous versions, and this is valid also for the Update manager module. You could eventually avoid the module checks for new module versions, but the module itself doesn't have a setting for that in admin/reports/updates/settings.
What you could do is, using a custom module, avoid that Drupal invokes update_cron()
which is the hook that periodically checks for updates. For this, it is sufficient to implement hook_implements_alter()
, for example using the following code. (It assumes the module machine name is mymodule; if the module machine name is different, change the function name.)
function mymodule_implements_alter(&$implementations, $hook) {
if ($hook == 'cron') {
unset($implementations['update']);
}
}
You could still manually check for updates from admin/reports/updates, but Drupal would not check for updates during cron tasks.
If then you also need to disable the route set by the Update manager module, you could also do it as shown in How do I alter the route defined by another module?
This is, I think, the closer you could get to disable the Update manager module.
No, modules can only be uninstalled in Drupal 8.
There's no such concept as disabling a module any more, just uninstalling.
-
-
5Er...not sure what you're expecting me to say? You can't disable any module, so you can't disable the Update Manager module. You can uninstall it by selecting it and submitting the uninstall form at admin/modules/uninstall, or through Drush/Drupal Console. That's the only option available in Drupal 8– Clive ♦Commented Jul 22, 2016 at 13:21
As already @Clive stated,
Drupal 8 has removed the ability to disable modules for many reasons.
However, there is a way, but it is not advisable. Disable modules module has been created for that specific purpose only.
But again as please read what stated on that module page as below,
This module brings back the ability to (temporarily) disable modules from the UI or with Drush. Note, that there's no guarantee for your content, config or even your site after you disable a module.
So, think before using.
-
let's say I uninstalled update manager,next time if I need it to update core,can it be installed using drupal console again? Commented Jul 22, 2016 at 13:29
-
-
1That doesn't really make sense though @Hiranya. If you already know core has an updated release, why would you then turn on Update Manager to give you exactly the same information? If you're thinking that Drupal can update its own core through the UI, it can't– Clive ♦Commented Jul 22, 2016 at 13:40
-
@Hiranya The Update manager module cannot update Drupal core, so reinstalling the Update manager module when you already know there is an update doesn't make much sense.– avpaderno ♦Commented Jul 22, 2016 at 13:49
Here's how GovCMS disables the cron updates check in Drupal 9 and 10.
/**
* Implements hook_update_projects_alter().
* Disables updates from all modules
*/
function govcms_security_update_projects_alter(&$projects) {
\Drupal::keyValueExpirable('update_available_releases')->deleteAll();
\Drupal::keyValueExpirable('update_available_releases')->setMultiple([]);
$projects = [];
}
/**
* Implements hook_cron().
*
* Make sure that when cron runs, available data is not fetched.
*/
function govcms_security_cron() {
\Drupal::keyValueExpirable('update_available_releases')->deleteAll();
\Drupal::keyValueExpirable('update_available_releases')->setMultiple([]);
}
The system module also has this:
if (!\Drupal::config('system.advisories')->get('enabled')) {
return;
}
So you can set this in your settings.php file to disable checking for security advisories.
$config['system.advisories']['enabled'] = FALSE;