Working with tim.plunkett to understand wonky behaviors of menu links with the standard install profile.

It turns out that moduleHandler::uninstall() calls drupal_flush_all_caches(), but for module installs it's only triggered by the form submit.

Comments

botanic_spark’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

Hi,
drupal_flush_all_caches() moved from ModulesListForm::submitForm() to ModuleHandler::install()

Status: Needs review » Needs work

The last submitted patch, 1: base_system-2181151-1.patch, failed testing.

internetdevels’s picture

Status: Needs work » Needs review
StatusFileSize
new1.35 KB
new1.13 KB
botanic_spark’s picture

Tested patch #3 and Drupal installation is finished without errors.

I missed the

include_once DRUPAL_ROOT . '/core/includes/menu.inc';

part.

Status: Needs review » Needs work

The last submitted patch, 3: base_system-2181151-3.patch, failed testing.

internetdevels’s picture

3: base_system-2181151-3.patch queued for re-testing.

The last submitted patch, 3: base_system-2181151-3.patch, failed testing.

tim.plunkett’s picture

Title: flush all caches from ModuleHandler::install(), instead of ModulesListForm::submitForm() » Flush all caches from ModuleHandler::install(), instead of ModulesListForm::submitForm()
Status: Needs work » Needs review
StatusFileSize
new1.95 KB

I think this is the correct approach. It loads stuff like path.inc the same way as in _drupal_bootstrap_code().

Status: Needs review » Needs work

The last submitted patch, 8: flush-2181151-8.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new3.09 KB
new1.14 KB

Borrowing from _menu_navigation_links_rebuild, which checks for menu_link first.

Status: Needs review » Needs work

The last submitted patch, 10: flush-2181151-10.patch, failed testing.

travolo’s picture

3: base_system-2181151-3.patch queued for re-testing.

The last submitted patch, 3: base_system-2181151-3.patch, failed testing.

botanic_spark’s picture

Is this issue still relevant?

It seams that the core is changed a lot since this issue was active.

ModuleHandler::install() method does not longer exist, and ModulesListForm::submitForm() doesn't contain drupal_flush_all_caches() anymore.

alexpott’s picture

Title: Flush all caches from ModuleHandler::install(), instead of ModulesListForm::submitForm() » Remove router rebuild from menu_ui.install
Status: Needs work » Active

Yep we're working to actively avoid flushing caches during module install. Re-titling the issue to focus on what we should be looking to do.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new839 bytes

Let's simply give it a different try.

alexpott queued 16: 2181151-16.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 16: 2181151-16.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.49 KB
new684 bytes

Let's see.

pwolanin’s picture

Seems a little funny that we have to force it during the profile install?

Patch seems ok, though comment needs to be reformatted and reworded a bit.

dawehner’s picture

Ehem absolutely right!

berdir’s picture

Status: Needs review » Needs work

Needs work for that...

dawehner’s picture

Component: base system » menu system
dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB

Maybe something like this?

Status: Needs review » Needs work

The last submitted patch, 24: 2181151-24.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB
new775 bytes

There we go.

berdir’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Needs review » Reviewed & tested by the community

Wondering if the added line in standard_install() could be considered an API change for install profiles, what happens exactly if you don't have that?

Also could be argued that we're possibly breaking contrib tests too although highly unlikely, and afaik we want to avoid that for 8.0.x as much as possible.

So, setting to RTBC for 8.1.x to get feedback on whether we are allowed to do this.

dawehner’s picture

Also could be argued that we're possibly breaking contrib tests too although highly unlikely, and afaik we want to avoid that for 8.0.x as much as possible.

Is that statement actually true? I always thought that we don't support our tests as any form of API.

catch’s picture

Status: Reviewed & tested by the community » Needs review

We don't support tests as any kind of API, but also we'd try to avoid breaking tests in patch releases so that people don't have to update their tests every month. I just committed #1494670: References to CSS, JS, and similar files should be root-relative URLs: avoids mixed content warnings & fewer bytes to send which breaks contrib tests, but in that case the tests were specifically checking for the buggy behaviour we were fixing.

Patch looks fine for 8.1.x though.

Do you know why we're flushing all caches in uninstall but not in install? I'm wondering if we need a follow-up to add that in.

dawehner’s picture

Do you know why we're flushing all caches in uninstall but not in install? I'm wondering if we need a follow-up to add that in.

I don't see the difference. Both install and uninstall calls out to \Drupal::service('router.builder')->setRebuildNeeded();
Just the menu_ui module (which was some behaviour inherited from some of the renames over time) directly rebuilt it.

  • catch committed 3a27d38 on 8.1.x
    Issue #2181151 by dawehner, tim.plunkett, InternetDevels, botanic_spark...
catch’s picture

Status: Needs review » Fixed

OK got it. Committed/pushed to 8.1.x.

Since there's theoretical breakage, not moving back to 8.0.x, but if this is actually affecting a site somehow please re-open.

dawehner’s picture

Since there's theoretical breakage, not moving back to 8.0.x, but if this is actually affecting a site somehow please re-open.

For sites, the router is rebuild at the end of the request / installer (in theory), so if there is breakage than in tests. But yeah I don't care about 8.0.x here.

Status: Fixed » Closed (fixed)

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