Problem/Motivation

Since not all extensions provide configuration, it would be useful to filter the module, theme, and install profile links to reports to show only those that do.

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Hm. That would make the calculation of the "chose what to report on" list more expensive. I am not sure it is worth the trouble.

jhodgdon’s picture

Category: Task » Feature request
jhodgdon’s picture

Version: » 8.x-1.x-dev
jhodgdon’s picture

Component: Code » Reports module
mglaman’s picture

Based on #2678130: Make ::listProvidedItems public, simplify loading a module's config, here is a patch that cuts down the amount of items. Makes it a lot easier to use, in my opinion.

jhodgdon’s picture

How's the page load time?

mglaman’s picture

Locally I did not notice any difference

jhodgdon’s picture

Status: Active » Needs work

Hm. Well this would need to be applied to the themes and the profile too. Also this patch doesn't consider cases where there are config/optional items but not config/install items, as it is passing in TRUE for listProvidedItems() last argument.

So, it seems like it requires doing quite a few file system scans -- at least twice what this patch does. And I would think that it would slow down the page load quite a bit, at least on some systems, which is why I was concerned about doing it in the first place.

There should be a more efficient way to do this that doesn't require the entire overhead of listProvidedItems(), because really we just want to know "is there anything at all" not "find me the entire list".

mglaman’s picture

Hm. I wonder if we should populate a cache on hook_rebuild that knows of all the modules that provide config. Given the discussion in #2678130: Make ::listProvidedItems public, simplify loading a module's config and comment #8, I'll try to find a viable solution.

It seems like this would be a big user experience win, especially for site builders, if this module becomes a de-facto solution for the contrib upgrade realm.

jhodgdon’s picture

As I noted on the other issue, you should absolutely NOT rely on Config Update to make required updates to your modules' config. You should instead make a hook_update_N() that updates config, just like you'd need to do that if your module requires some database changes.

See
https://www.drupal.org/node/2535316

Config Update is not a substitute for hook_update_N().

mglaman’s picture

yes, hook_update_N() will be used. However if people need to review progressive enhancements delivered by a module, that might be overridden by their site's config this screen is useful.

jhodgdon’s picture

Yes definitely. I'm not saying config_update is not useful. Obviously, I think it's useful or I wouldn't have made it. :)

mglaman’s picture

Status: Needs work » Needs review
FileSize
5.86 KB

Ok, here is another shot. This reuses the extension services provided by the module to support config/install and config/optional. It gathers the combined extensions (modules and themes) and gets all available components they provide. This only happens once. When cycling through the currently enabled modules and themes, we check to see if InstallStorage::CONFIG_INSTALL_DIRECTORY or InstallStorage::CONFIG_OPTIONAL_DIRECTORY are in the array of extension storage components.

If an extension is not in the array, we continue. In my tests the biggest overhead is the front end rendering of the page (toolbar, dropbuttons.)

jhodgdon’s picture

Nitpick:

+++ b/config_update_ui/src/Controller/ConfigUpdateController.php
@@ -270,12 +294,32 @@ class ConfigUpdateController extends ControllerBase {
+      $this->extensionConfigStorage->getComponentNames($combined_extensions),

You've declared extensionConfigStorage and extensionOptionalStorage to be of type StorageInterface. But this interface doesn't have a getComponentNames method. You need to declare them to be of type ExtensionInstallStorage or something like that.

Other than that, this seems like it would work. But I don't see why this complicated and a bit convoluted array_flip() etc. code would be any more efficient than just using the ConfigLister service from this module, calling its listConfig() method at each step in the module/theme loops, and verifying that either the config/install or config/optional list has something in it. I think that the same directory scans will be done, and it's somewhat clearer code (at least I think so). ???

Also this would need a test before I would add it to the module. I think the test could use some Core modules/themes that currently have just config/install, just config/optional, or neither, and verify that the first two are shown and the third type isn't. Or to be more future-proof, I guess we could make some test modules and themes with these characteristics.

jhodgdon’s picture

Status: Needs review » Needs work
jhodgdon’s picture

Assigned: Unassigned » jhodgdon

I'm working on this along with #2824164: Add name of module/theme/profile to report, because they need basically the same underlying code.

  • jhodgdon committed c38fa2c on 8.x-1.x
    Issue #2405277 and 2824154 by jhodgdon: Only list extensions that...
jhodgdon’s picture

Status: Needs work » Fixed

I got this working, with a test, along with #2824164: Add name of module/theme/profile to report.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.