Uninstalling Devel before devel generate results in a routing exception on the production check page

Created on 6 November 2017, over 6 years ago
Updated 4 May 2023, about 1 year ago

When uninstalling devel as part of the production check, the devel_generate module can still be enabled as it does not require devel.
If devel_generate is still enabled, this route
$this->routeName = 'devel.admin_settings';
in
Drupal\prod_check\Plugin\ProdCheck\Modules\DevelGenerate
is inaccessible once devel has been uninstalled and so when accessing the production check path
"/admin/reports/prod-check"
the following
"Symfony\Component\Routing\Exception\RouteNotFoundException devel.admin_settings does not exist" exception is thrown.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom Shamrockonov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    Happy to review patches, seems to be a bug indeed!

  • Assigned to Grevil
  • 🇩🇪Germany Anybody Porta Westfalica

    Or has this already been fixed in latest versions?

  • 🇩🇪Germany Grevil

    Yep, this is still an issue!

  • 🇩🇪Germany Grevil

    Ok, I tracked down the issue.

    Inside "/src/Plugin/ProdCheck/Modules", different dev modules are tracked, which should be disabled for production use. Inside each class, an "init" method will initiate the prod_check entry, for the specific module. Since "devel_generate" doesn't have its own static route, the devel route was instead provided, leading to this error, as devel was uninstalled.

    I am fairly unsure about these links in general, since they usually point to some random form of the referenced module. In my opinion, they should instead:

    1. Link to the uninstallation page of the module
    2. Link to help page of the module (if a help page is provided, otherwise there simply is no link)
    3. Or removed entirely

    @Anybody, any thoughts on this?

  • 🇩🇪Germany Grevil

    Have a look at the MR, this approach would fix the problem for now.

    Note, that I couldn't properly inject the service and my linter goes crazy with all the PHPCS issues inside this module, so it is hard to determine what the problem is.

    Please review!

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Build Successful
  • @grevil opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Build Successful
  • 🇩🇪Germany Anybody Porta Westfalica

    Re #6: Sounds like strange and error-prune URL guessing with unclear benefit?

    If yes,

    Or removed entirely

    is the only correct answer. Remove the link and just output the name.

  • 🇩🇪Germany Grevil

    @Anybody, well, it is not quite guessing. The route is simply hard coded inside the class, see this example:

    /**
     * Devel generate check
     *
     * @ProdCheck(
     *   id = "devel_generate",
     *   title = @Translation("Devel generate"),
     *   category = "modules",
     *   provider = "devel_generate"
     * )
     */
    class DevelGenerate extends ModulesBase {
    
      /**
       * {@inheritdoc}
       */
      public function init() {
        $this->module = 'devel_generate';
        $this->routeName = 'devel.admin_settings';
      }
    
    }
    
  • 🇩🇪Germany Anybody Porta Westfalica

    If the benefit from this is low, it causes trouble and time to fix, remove what's not worth the time...

  • 🇩🇪Germany Grevil

    @Anybody, it won't cause trouble any more, with the patch applied. Let's commit this! It might not be perfect, but putting more time in this and refactoring the link logic isn't worth it and removing the link feature is also not good, as several classes will have an unused route parameter.

  • 🇩🇪Germany Anybody Porta Westfalica

    @Grevil: Then please add @todo's in all dirty parts.

  • Status changed to Needs work about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica
  • Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Thank you @Grevil! This should be refactored in total. Not worth it now, thanks for the fix and the comments!

  • Status changed to Fixed about 1 year ago
  • 🇩🇪Germany Grevil

    Glad I could help.

    • Grevil committed 36c4ed09 on 8.x-1.x
      Issue #2921248: Uninstalling Devel before devel generate results in a...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024