Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295112

MenuRouterRebuildSubscriber has a hidden database dependency

$
0
0

Problem/Motivation

There is a db_transaction(); in MenuRouterRebuildSubscriber

The problem with that is that nothing ensures that the menu router is actually stored in the database.

Note that this does not break anything and the issue is just cleanup.

Proposed resolution

  1. Change the definition of plugin.manager.menu.link in core.services.yml to pass in @database and store it in a connection. property of MenuTreeStorage.
  2. Move the code block in MenuRouterRebuildSubscriber::menuLinksRebuild() starting with $transaction = db_transaction(); into MenuTreeStorage::rebuild. Keep the lock mechanism in MenuRouterRebuildSubscriber.
  3. Change the db_transaction you just moved into $this->connection->startTransaction.
  4. Optional and can be a followup: write a unit test for MenuLinkManager::rebuild. AFAIK there is no unit test currently that could be easily extended to include this method and so this part is not a novice task (but, feel free to try. You'd need to mock the plugin discovery, the module handler, the link override and the tree storage, I would borrow ideas/code from LocalTaskManagerTest ).

Remaining tasks

User interface changes

API changes


Viewing all articles
Browse latest Browse all 295112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>