Problem/Motivation

The ProjectInfo class still expects base themes to be not installed (this was changed in #1067408: Themes do not have an installation status)

Proposed resolution

Remove all the handling of base themes and sub themes since this is now irrelevant as themes have to be installed.

There is a slight logic change: if a project (module or theme) is hidden but installed and not in the testing package then it will be reported on. This is because bast themes are often hidden so they don't show on the appearance page. We could limit this to themes only BUT it makes sense for modules too. If a hidden, installed module has security updates we should report this.

Remaining tasks

Write patch
Review commit

User interface changes

No longer report on base themes and sub themes. They will be reported on as regular projects because they are installed.

API changes

None - i think all the changes are internal and removing redundant code.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Postponed » Active
bogdan.racz’s picture

I have been working on the issue 2470145. As I searched for other places where this might impact, I came across some code&comments in this class, which don't reflect the changes. Can I invest more time into this?

xjm’s picture

Issue tags: -8.x release target

Removing a tag that isn't used in core.

bogdan.racz’s picture

I spoked with alexpott, and for now, until the release I just posted a patch for documenting and setting a default value for the deprecated "status" variable.

bogdan.racz’s picture

Status: Active » Needs review
Issue tags: +drupaldevdays

Status: Needs review » Needs work

The last submitted patch, 4: update-project-info-class-variable-comments-2338167-4.patch, failed testing.

bogdan.racz’s picture

This patch cannot work, until the issue 2470145 is fixed. I tested with the patch from the issue above and it works.
Anyhow it should be retested after the usability issue above is considered fixed.

Status: Needs work » Needs review
alexpott’s picture

So now all themes needs an installation status we can just remove all the complexity about handling sub themes and base themes. All themes depend on their base themes and a base theme has to be installed for one of it's sub themes to be. Therefore themes are just like modules and can be treated as such! (Yay!).

Drupal\update\Tests\UpdateContribTest has extensive testing of the relationships between base themes and sub themes so this works out really nicely.

Status: Needs review » Needs work

The last submitted patch, 9: 2338167-2.9.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
874 bytes
8.07 KB

So the patch slightly modifies the behaviour when it comes to hidden projects. We need to exclude hidden test projects here.

This patch does make a slight but significant change - if a project is hidden but is not in the test package and is enabled it's security updates will show. This was the old behaviour for base themes but I think it should be extended for all. If a project is installed and has security updates you need to know this regardless of the hiddenness.

alexpott’s picture

Issue summary: View changes

I'm going to make this issue only focus on base themes - since it is a separate issue from the use of the word disabled.

alexpott’s picture

Issue summary: View changes
Wim Leers’s picture

Status: Needs review » Needs work

This patch does make a slight but significant change - if a project is hidden but is not in the test package and is enabled it's security updates will show. This was the old behaviour for base themes but I think it should be extended for all. If a project is installed and has security updates you need to know this regardless of the hiddenness.

Makes sense.

The patch itself looks great. So I had to review this by applying and looking at the touched files, to see if everything that should be updated is indeed updated. That's how I found the following:

  1. In ProjectInfo:
       * @todo https://www.drupal.org/node/2338167 update class since extensions can
       *   no longer be hidden, enabled or disabled. Additionally, base themes have
       *   to be installed for sub themes to work.
    

    This TODO should be removed :)

  2. Also in ProjectInfo:
       * This iterates over a list of the installed modules or themes and groups
       * them by project and status. A few parts of this function assume that
       * enabled modules and themes are always processed first, and if disabled
       * modules or themes are being processed (there is a setting to control if
       * disabled code should be included in the Available updates report or not),
       * those are only processed after $projects has been populated with
       * information about the enabled code. 'Hidden' modules are always ignored.
       * 'Hidden' themes are ignored only if they have no enabled sub-themes.
       * This function also records the latest change time on the .info.yml
       * files for each module or theme, which is important data which is used when
       * deciding if the available update data should be invalidated.
    

    This needs to be updated. It will be much simpler now :)

  3. In update.report.inc:
      // Create an array of status values keyed by module or theme name, since
      // we'll need this while generating the report if we have to cross reference
      // anything (e.g. subthemes which have base themes missing an update).
      foreach ($data as $project) {
        foreach ($project['includes'] as $key => $name) {
          $status[$key] = $project['status'];
        }
      }
    

    I think all of this can be deleted too?

alexpott’s picture

Status: Needs work » Needs review
FileSize
6.1 KB
13.73 KB

@Wim Leers thanks for the review.

  1. Yep updated to point to #2553909: Update ProjectInfo class to not use 'disabled' - the disabled stuff is a separate issue.
  2. Updated - it's not that much simpler - but it is no longer theme specific.
  3. Yes you are right - nice spot.

I've added tests around the new behaviour for hidden projects.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Great!

Just nits that can be fixed on commit:

  1. +++ b/core/modules/update/src/Tests/UpdateContribTest.php
    @@ -87,7 +88,30 @@ function testUpdateContribBasic() {
    +    // Testing means it should not appear.
    

    Nit: s/in the Testing/in the Testing package/

  2. +++ b/core/modules/update/src/Tests/UpdateContribTest.php
    @@ -87,7 +88,30 @@ function testUpdateContribBasic() {
    +    // A hidden and installed project not in the testing package should appear.
    

    Nit: s/testing/Testing/

  • catch committed 5df20ac on
    Issue #2338167 by alexpott, rbmboogie: Update ProjectInfo class to...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks! (fixed those two nits on commit).

joelpittet’s picture

Albeit not easy or obvious to get to:

+++ b/core/modules/update/templates/update-project-status.html.twig
@@ -105,18 +103,4 @@
-  {% if base_themes %}
-    {% set basethemes = base_themes|join(', ') %}
-    {% trans %}
-      Depends on: {{ basethemes }}
-    {% endtrans %}
-  {% endif %}
-
-  {% if sub_themes %}
-    {% set subthemes = sub_themes|join(', ') %}
-    {% trans %}
-      Required by: {{ subthemes|placeholder }}
-    {% endtrans %}
-  {% endif %}

Does this mean we no longer show the base theme to child theme relationship anywhere in core?

Just to give a use-case: if I were to use bootstrap theme and it has updates, it would be nice to know that upgrading that may affect my child theme.

joelpittet’s picture

Maybe this issue will half help: #2372183: Display same info for themes as for modules, @davidhernandez mentioned it to me.

alexpott’s picture

I don't think it is the job of the update status report to report the relationship between themes. It does not for modules. If this the update status report should display dependency information then it should do so for both module and themes. Since if the "nice to know" argument applies to themes it applies to modules. The reason base themes and sub themes where displayed in D7 was because (freakishly) there was no requirement for a theme to be enabled for it to be actually used.

joelpittet’s picture

I guess that is why that other issue exists #2372183: Display same info for themes as for modules because it should apply to both. I think the use-case I mentioned is valid in both theme and module dependency cases.

Status: Fixed » Closed (fixed)

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