Just to not bring noise into the main issue.

Started fresh as the patch in http://drupal.org/node/1199946#comment-5786690 was really old.

Patch coming up in a few minutes.

Things todo

  • Rename module_enable() to module_install() and refactor the code
  • Remove hook_modules_enabled() and merge with hook_modules_installed()
  • Remove hook_disable() and merge with hook_uninstall()
  • Remove the concept of active/inactive in Field API - also remove the property from Field
CommentFileSizeAuthor
#107 1199946-helper-107.patch199.67 KBalexpott
#107 interdiff.txt6.54 KBalexpott
#106 interdiff.txt2.65 KBalexpott
#106 1199946-398-2.patch199.85 KBalexpott
#103 1199946-398.patch197 KBalexpott
#101 1199946-372.patch192.64 KBalexpott
#99 1199946-module-enable.patch195.09 KBAnonymous (not verified)
#98 2003966-98.patch197.77 KBalexpott
#96 2003966-96.patch196.99 KBalexpott
#95 2003966-95.patch199.08 KBalexpott
#94 2003966-94.patch201.12 KBalexpott
#93 1199946-317.patch198.19 KBalexpott
#91 2003966-91.patch198.07 KBalexpott
#90 2003966-90.patch187.89 KBalexpott
#87 2003966-87.patch176.41 KBParisLiakos
#85 2003966-85.patch174.18 KBParisLiakos
#85 interdiff.txt1.05 KBParisLiakos
#83 2003966-83.patch175.34 KBswentel
#81 2003966-81.patch174.11 KBswentel
#78 2003966-78.patch176.63 KBfubhy
#76 2003966-76.patch176.51 KBfubhy
#74 2003966-74.patch176.57 KBfubhy
#71 2003966-71.patch175.52 KBfubhy
#69 2003966-69.patch174.33 KBfubhy
#67 2003966-67.patch174.82 KBfubhy
#64 2003966-64.patch170.99 KBAnonymous (not verified)
#62 2003966-62.patch170.99 KBfubhy
#60 2003966-60.patch170.28 KBfubhy
#59 2003966-59.patch170.28 KBfubhy
#57 2003966-56.patch166.95 KBfubhy
#53 2003966-53.patch166.74 KBfubhy
#51 2003966-51.patch166.46 KBfubhy
#49 2003966-49.patch166.01 KBfubhy
#47 2003966-47.patch164.62 KBfubhy
#45 2003966-45.patch164.65 KBfubhy
#42 2003966-42.patch145.92 KBfubhy
#40 lock_installed_modules.png43.18 KBPancho
#37 2003966-37.patch143.74 KBfubhy
#30 2003966-30.patch144.69 KBfubhy
#29 2003966-29.patch145.53 KBfubhy
#21 2003966-15.patch47.05 KBswentel
#15 2003966-15.patch48.82 KBswentel
#12 2003966-11.patch46.24 KBaspilicious
#10 2003966-10.patch19.84 KBswentel
#8 2003966-8.patch20.48 KBswentel
#6 2003966-6.patch19.43 KBswentel
#1 2003966-1.patch13.45 KBswentel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel’s picture

Status: Active » Needs review
FileSize
13.45 KB

This will fail on so many places - also because I already removed module_disable() - but let's see :)

amateescu’s picture

The first problem I see here is that if we remove the 'disabled' state we must also remove 'enabled', thus keeping only installed/uninstalled states.

swentel’s picture

Assigned: Unassigned » swentel

I'll be working on this tomorrow all day.

@amateescu Talked this through with alex pott, for now we keep this the yml file - but that might all go away once we get to a point where we getting green .. :)

Status: Needs review » Needs work

The last submitted patch, 2003966-1.patch, failed testing.

amateescu’s picture

Well.. my problem was not with the yml files, but more like with their wording/meaning. I guess what I'm trying to say is that we need to rename module_enable() to module_install() and refer to everything as just 'installed' and 'uninstalled'.

swentel’s picture

Status: Needs work » Needs review
FileSize
19.43 KB

New patch - you can not disable a module anymore on admin/modules - it shows up now on the uninstall page. Has less failures now on the module enable disable test

Status: Needs review » Needs work

The last submitted patch, 2003966-6.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
20.48 KB

This makes disable/enable test pass and also fixes a cleanup in config_get_module_config_entities() which now actually is going to work.

update_manager_access() throws 4 notices though when you try and disable it, so added a temp workaround for that, needs some clearing somewhere in module_uninstall() (which contains code from module_disable() - but needs refactoring of course ..)

Status: Needs review » Needs work

The last submitted patch, 2003966-8.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
19.84 KB

Removed the workaround in _menu_check_access().

Status: Needs review » Needs work

The last submitted patch, 2003966-10.patch, failed testing.

aspilicious’s picture

Status: Needs work » Needs review
FileSize
46.24 KB

This should have less fails. It's possible I removed to much code :). Needs to be reviewed very carefully but this is a starting point for the remaining failures.

Status: Needs review » Needs work

The last submitted patch, 2003966-11.patch, failed testing.

swentel’s picture

Working on the remaining ones.

swentel’s picture

Issue summary: View changes

Updated issue summary.

swentel’s picture

Assigned: swentel » Unassigned
Status: Needs work » Needs review
FileSize
48.82 KB

Last one for now. I'm officially sprinted out from DrupalCon. Away for a week also, so anyone else is invited to move this forward.

Updated the issue summary of this issue to add some thoughts/todo's

aspilicious’s picture

Assigned: Unassigned » swentel
Status: Needs review » Needs work

I'm not 100% sure but I think this patch removes modules that depend on the uninstalled one automaticly? Correct?

If that's the case this shouldn't happen, or should it?

swentel’s picture

Assigned: swentel » Unassigned
Status: Needs work » Needs review

That is how HEAD now work yes ..

aspilicious’s picture

well HEAD doesn't work that way, cause there was a test that checked that which I had to remove to get green light from the bot :p

aspilicious’s picture

+++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.phpundefined
@@ -192,28 +192,6 @@ function testDependencyResolution() {
-    // Try to uninstall the PHP module by itself. This should be rejected,
-    // since the modules which it depends on need to be uninstalled first, and
-    // that is too destructive to perform automatically.
-    $result = module_uninstall(array('php'));
-    $this->assertFalse($result, 'Calling module_uninstall() on a module whose dependents are not uninstalled fails.');
-    foreach (array('forum', 'ban', 'php') as $module) {
-      $this->assertNotEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, format_string('The @module module was not uninstalled.', array('@module' => $module)));

Here it is

Status: Needs review » Needs work

The last submitted patch, 2003966-15.patch, failed testing.

swentel’s picture

FileSize
47.05 KB

Re-rolled after the module_enable and module_disable code got moved to ModuleHandler.

I'm not able to run this on my own completely, I'm busy doing Field API stuff atm as well, so someone should take over/help along - but let's make sure we communicate this well so we don't do double work.

swentel’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2003966-15.patch, failed testing.

fubhy’s picture

I'm willing to help/take over. Talk to you tomorrow on IRC?

fubhy’s picture

Assigned: Unassigned » fubhy

Started working on this today.

gdd’s picture

Following on from #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed, I do think it is important to leave this implementable in contrib, so we should definitely figure that part out. I had previously said that removing a module from the list in hook_module_implements_alter() would do it, but fubhy pointed out to me in IRC that that is no guarantee that code runs. However I'm trying to think of a case where a module has code that would run with all its hooks disabled and I'm not coming up with anything. The one thing I did think of is Domain which has special code in settings.php, but then again disabling Domain won't stop that code from running either so its not a parallel.

Regardless, a more graceful way of allowing contrib to add this functionality would be welcomed.

catch’s picture

hook_module_implements_alter() won't disable classes from running - the module would have to be unregistered from the class loader as well. Then any plugins referenced in config are just going to completely disappear but that's what people want apparently.

fubhy’s picture

Exactly, classes, the module's bundle, etc. are are all still there. So the only reliable way would be to prevent them from being introduced to the container and class loader. @see DrupalKernel::initializeContainer()

fubhy’s picture

Status: Needs work » Needs review
FileSize
145.53 KB
fubhy’s picture

FileSize
144.69 KB
gdd’s picture

+++ b/core/includes/config.incundefined
@@ -54,6 +54,12 @@ function config_uninstall_default_config($type, $name) {
+
+  // If this module defines any ConfigEntity types, then delete the manifest
+  // file for each of them.
+  foreach (config_get_module_config_entities($name) as $entity_info) {
+    config('manifest.' . $entity_info['config_prefix'])->delete();

All the manifest stuff was removed as part of ... whatever issue it was where we made you require full config trees again, so you need to update from head :)

I realize it is early in this patch's life to be worrying about UI considerations but something I was thinking is that we may want to remove the checkboxes from the main modules page entirely, and leave the Uninstall tab in place. I think this could help alleviate the concerns about users unintentionally deleting data when they think they are disabling a module. We should also have some text on that page saying something like 'If you think you may want this module's data again, please backup your config directory located at
' Thoughts on this?

fubhy’s picture

Yep. That is exactly what this Patch does.

gdd’s picture

Oh perfect! fubhy++

Status: Needs review » Needs work

The last submitted patch, 2003966-30.patch, failed testing.

catch’s picture

One thing with the uninstall tab is it only appears for modules with hook_schema() or hook_uninstall() - unless that changed and I missed it. That's already wrong with config but even more wrong if this is the only way we provide to switch a module off!

fubhy’s picture

Yeah it's definitely not finished yet. Also, the code for the module overview needs to be cleaned up and get the disable functionality fully removed. But this is just a start.. so

fubhy’s picture

Status: Needs work » Needs review
FileSize
143.74 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-37.patch, failed testing.

fubhy’s picture

Okay, that's just one actual fail left and 4 or 5 minor things that I missed. Will fix the rest tomorrow. Should be green some time in the afternoon.

Pancho’s picture

FileSize
43.18 KB

I realize it is early in this patch's life to be worrying about UI considerations but something I was thinking is that we may want to remove the checkboxes from the main modules page entirely, and leave the Uninstall tab in place.

Yes, the checkboxes are confusing:
Checkboxes are expected to allow switching on and off like a light switch.
While we got used to the fact that a dependency might disable a checkbox, everybody certainly expects this to be possible if there is no indication the module is required by something else, especially right after installing a module.
However, we shouldn't remove them completely without substitution because we still need them as status indicators.

We might want to show a checkbox only for uninstalled modules and otherwise replace them with a green tick mark. This would clearly indicate that once installed they can't simply be unchecked. I think this is a large improvement, see in the screenshot the pre-installed modules vs. the yet to enable Field UI module:

The issue is assigned to you, so I'm providing you just the diff, in case you want to roll it into your next patch:

diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index b6c83fb..1891993 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -986,7 +986,21 @@ function _system_modules_build_row($info, $extra) {
 
   // If this module is compatible, present a checkbox indicating
   // this module may be installed. Otherwise, show a big red X.
-  if ($compatible) {
+  if (!$compatible) {
+    $form['enable'] = array(
+      '#markup' =>  theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
+    );
+    $form['description']['#markup'] .= $status_long;
+  }
+  else if ($extra['enabled']) {
+    $status_short = t('This module is installed.');
+    $status_long = t('This module is installed. To uninstall it please visit the <a href="@link">uninstall page</a>.', array('@link' => url('admin/modules/uninstall')));
+    $form['enable'] = array(
+      '#markup' =>  theme('image', array('uri' => 'core/misc/watchdog-ok.png', 'alt' => $status_short, 'title' => $status_short)),
+    );
+    $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
+  }
+  else {
     $form['enable'] = array(
       '#type' => 'checkbox',
       '#title' => t('Enable'),
@@ -997,12 +1011,6 @@ function _system_modules_build_row($info, $extra) {
       $form['enable']['#disabled'] = TRUE;
     }
   }
-  else {
-    $form['enable'] = array(
-      '#markup' =>  theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
-    );
-    $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
-  }
 
   // Build operation links.
   foreach (array('help', 'permissions', 'configure') as $key) {
David_Rothstein’s picture

One thing with the uninstall tab is it only appears for modules with hook_schema() or hook_uninstall() - unless that changed and I missed it.

You missed it - twice now, in fact :)

https://drupal.org/node/1199946#comment-6956130 (see comment at the bottom)

Since D7, all modules appear on the uninstall page.

fubhy’s picture

Status: Needs work » Needs review
FileSize
145.92 KB

Upgrade path tests are still failing (at least locally)

Status: Needs review » Needs work

The last submitted patch, 2003966-42.patch, failed testing.

fubhy’s picture

UpdateModuleHandler is very hard to grok and I am having trouble to get it to work. Will focus on that tomorrow...

fubhy’s picture

Status: Needs work » Needs review
FileSize
164.65 KB

Some more fixes...

Status: Needs review » Needs work

The last submitted patch, 2003966-45.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
164.62 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-47.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
166.01 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-49.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
166.46 KB

Huh? Where do the new install/uninstall fails come from?

Status: Needs review » Needs work

The last submitted patch, 2003966-51.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
166.74 KB

Uh, found the reason.

Status: Needs review » Needs work

The last submitted patch, 2003966-53.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review

#53: 2003966-53.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 2003966-53.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
166.95 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-56.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
170.28 KB
fubhy’s picture

FileSize
170.28 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-60.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
170.99 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-62.patch, failed testing.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
170.99 KB

was just reading through this patch and noticed:

+function module_disable($module_list, $enable_dependencies = TRUE) {
+  return Drupal::moduleHandler()->install($module_list, $enable_dependencies);
+}

which looks like it should be ->uninstall(). attached patch makes that change, lets see if that brings some fails down.

Status: Needs review » Needs work

The last submitted patch, 2003966-64.patch, failed testing.

fubhy’s picture

I screwed up the InstallUninstallTest. ModuleHandler is actually working already. And module_disable() should not be invoked anywhere anymore. Thanks though :)

fubhy’s picture

Status: Needs work » Needs review
FileSize
174.82 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-67.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
174.33 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-69.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
175.52 KB
fubhy’s picture

That patch should bring us back to only UpgradePathTest failures.

Status: Needs review » Needs work

The last submitted patch, 2003966-71.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
176.57 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-74.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
176.51 KB

Status: Needs review » Needs work

The last submitted patch, 2003966-76.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
FileSize
176.63 KB

Okay, I need help with t his one... I have no clue why this fails. It's the last failure and it's technically just one... Which is: Forum module fails upon uninstallation. But it doesn't do that when I do it manually. Just in this freaking test. It throws an exception from FieldInstance saying that it could not create a field for a missing UUID. Really, no idea... Been stepping through the code with xdebug for 3 days now, looking at interdiffs to swentel's patch, etc. No clue.

Status: Needs review » Needs work

The last submitted patch, 2003966-78.patch, failed testing.

ParisLiakos’s picture

swentel’s picture

Status: Needs work » Needs review
FileSize
174.11 KB

reroll after content types went in - not sure whether I did everything right - time now to figure out the instance deletion.

Status: Needs review » Needs work

The last submitted patch, 2003966-81.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
175.34 KB

Oh bah - expect more failures again though

Status: Needs review » Needs work

The last submitted patch, 2003966-83.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
1.05 KB
174.18 KB

reroll

Status: Needs review » Needs work

The last submitted patch, 2003966-85.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
176.41 KB
jibran’s picture

#87: 2003966-87.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 2003966-87.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
187.89 KB

rerolled against head

alexpott’s picture

FileSize
198.07 KB

Removed module_install() as adding a deprecated function is plain weird. Based on #305

Status: Needs review » Needs work

The last submitted patch, 2003966-91.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
198.19 KB

For some reason this failed on the main issue re-running test here so as to not clog that issue....

alexpott’s picture

FileSize
201.12 KB

Rerolled on top of the massive changes from this morning

alexpott’s picture

FileSize
199.08 KB

Forgot to remove core/modules/field/lib/Drupal/field/Tests/ActiveTest.php

alexpott’s picture

FileSize
196.99 KB

Okay messed up the reroll a bit - but it lead to me finding #2078837: Ensure that we are using SQL storage for taxonomy_update_8007() so all is good

Status: Needs review » Needs work

The last submitted patch, 2003966-96.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
197.77 KB

Okay hopefully we're green again...

Anonymous’s picture

FileSize
195.09 KB

restoring behaviour of uninstall/reinstall test to use all modules.

expecting some fails with forum and taxonomy.

Status: Needs review » Needs work

The last submitted patch, 1199946-module-enable.patch, failed testing.

alexpott’s picture

FileSize
192.64 KB

Chasing head

alexpott’s picture

Status: Needs work » Needs review
alexpott’s picture

FileSize
197 KB

Rerolled

Status: Needs review » Needs work

The last submitted patch, 1199946-398.patch, failed testing.

fubhy’s picture

/me *shakes fist at testbot*

alexpott’s picture

Status: Needs work » Needs review
FileSize
199.85 KB
2.65 KB

So this has exposed a very interesting bug. During ModulesDisabledUpgradePathTest it tries to enable the editor module. This then discovers the default config for in the standard profile. It tries to install it and kaboom because this config is also dependent on ckeditor as that is the plugin it uses :)

Attached is one possible fix where we only include installation profile module configuration during an installation. Not entirely sure that the fix is legit.

alexpott’s picture

FileSize
6.54 KB
199.67 KB

So I've backed out the changes in #106 as this is a separate bug.

Whilst investigating the issue fixed in #106 I discovered that modules enabled in Drupal 7 are being enabled. I don't think we can do this. We should prevent major version upgrade if there are disabled modules.

We need to work on the text in UPGRADE.txt

7. Go to Administer > Site building > Modules. Disable all modules that are not
listed under "Core - required" or "Core - optional". It is possible that some
modules cannot be disabled because others depend on them. Repeat this step
until all non-core modules are disabled.

If you know that you will not re-enable some modules for Drupal 8.x and you
no longer need their data, then you can uninstall them under the Uninstall
tab after disabling them.

jibran’s picture

Status: Needs review » Closed (fixed)

And just like that.

jibran’s picture

Issue summary: View changes

Updated issue summary.