It would be beneficial for sites with many features (e.g. built on Open Atrium) to have the list of features cached so that it doesn't have to be fetched for each reload of Manage Features page, as developers do not need to add/delete features as often as check their status or enable/disable them.

This patch provides simple caching for that list, with an option to turn this feature off on the features settings page and a button to rebuild the cache on the Manage Features page without flushing all caches on site.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m1n0’s picture

mpotter’s picture

Status: Needs review » Needs work

I'm interested in hearing other comments on this. My own comments are:

1) Need a different name for _features_get_features since it is too close to the public features_get_features function.

2) There should be a hook on module_enable/disable to clear this cache automatically.

3) Could also implement the hook called when Drupal cache is cleared. Not sure we need a separate settings option and button for clearing this if it integrates better with normal Drupal hooks and caching.

m1n0’s picture

Thanks for the feedback, some thoughts here:

1) Will re-roll the patch with changed function name, thanks for noticing that.

2) Why exactly would we need that? Enabling/disabling a module does not change what appears on the Manage Features list - please note that this cache only stores the array of features - not their state.

3) This cache is automatically cleared when all Drupal cache is cleared as it is stored in the default cache bin (creating special bin for this one entry seemed an overkill to me - but that would make the button obsolete). My original thought was to have this button as an option of rebuilding that list without clearing all caches - e.g. new feature is not appearing in the list on production site after codebase update - that is actually the only scenario I can think of that requires rebuilding that list as everything else should be covered automatically.

mpotter’s picture

2) Sorry, I've been in D8-land so much I had forgotten how the 7.x listing was working and the fact it needs to show disabled modules. I think you are correct and can ignore (2).

3) As long as it's cleared with a full cache clear then I'm fine without needing a separate button. I just want to reduce un-needed options and buttons as much as possible. When updating the codebase of a site you always need to do a full cache clear anyway, so even that scenario doesn't need a separate option.

m1n0’s picture

Ok thanks for your input again, 3) makes sense, I will re-roll the patch with updated function name and deleted button asap.

m1n0’s picture

Status: Needs work » Needs review
FileSize
3.91 KB

Here is a re-rolled patch with deleted rebuild button and setting to turn on/off the caching. The function to get the list of features has been renamed to _features_get_features_list().

m1n0’s picture

Is there something keeping this from being committed? I have been using this patch on a project built on Open Atrium for couple of months now with no issues, but I am happy to have another round of feedback/change/re-roll if necessary.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

This this is good now.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Committed to d38181d.

  • mpotter committed d38181d on 7.x-2.x authored by m1n0
    Issue #2466975 by m1n0: Cache features list on Manage Features page for...

Status: Fixed » Closed (fixed)

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