Problem/Motivation

A fresh Varbase install (full profile) fatals during module installation:

Error: Class "Drupal\access_unpublished\AccessUnpublished" not found in varbase_workflow__grant_access_unpublished_permissions() (line 49 of includes/helpers.inc)

varbase_workflow.info.yml lists access_unpublished under the soft install: key, not the hard dependencies: key:

dependencies:
  - drupal:workflows
  - drupal:content_moderation
install:
  - scheduler_content_moderation_integration
  - admin_audit_trail_workflows
  - access_unpublished
  - eca_workflow
  - smart_trim

includes/helpers.inc has use Drupal\access_unpublished\AccessUnpublished; at the top and calls AccessUnpublished::applicableEntityType() directly inside varbase_workflow__grant_access_unpublished_permissions(), with no \Drupal::moduleHandler()->moduleExists('access_unpublished') or class_exists() guard. When this runs during module install before access_unpublished's classes are registered/available, the site install aborts entirely.

Steps to reproduce

Fresh drush site:install varbase, then drush pm:enable varbase_workflow --yes (or the equivalent Varbase "full" install flow) — the module install fatals with the class-not-found error above.

Proposed resolution

Either:

  • Move access_unpublished from install: to dependencies: in varbase_workflow.info.yml so Drupal's dependency resolver guarantees it is fully enabled (with its classes autoloadable) before varbase_workflow's own install hooks run, or
  • Guard the call in varbase_workflow__grant_access_unpublished_permissions() with a \Drupal::moduleHandler()->moduleExists('access_unpublished') check before referencing the AccessUnpublished class.

Remaining tasks

  • ✅ File an issue about this project
  • ❌ Addition/Change/Update/Fix to this project
  • ❌ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Fixed a fatal error installing Varbase Workflow when the Access Unpublished module's class was referenced before it was guaranteed to be available.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Version: 2.2.x-dev » 3.1.x-dev

  • rajab natshah committed 85ecf93c on 3.1.x
    fix: #3609084 Guard Access Unpublished class reference during install