Update StatusCheckTrait::runStatusCheck() to reorder/avoid dispatching CollectIgnoredPathsEvent earlier than StatusCheckEvent

Created on 29 December 2022, over 1 year ago
Updated 16 January 2023, over 1 year ago

Problem/Motivation

A problem was discovered while working on 🐛 GitExcluder should not ignore .git directories that belong to packages installed by Composer Fixed , consider a case when the composer.json in active directory is deleted somehow and we call StatusCheckTrait::runStatusCheck so the first event to be dispatched will be CollectIgnoredPathsEvent which will error out as it tries to get the active composer and then we dispatch StatusCheckEvent .

The problem with swapping the order of dispatch is that we are sending the excluded paths with the StatusCheckEvent which is required by the \Drupal\package_manager\Validator\SymlinkValidator.

The code snippet which needs to be changed

    $ignored_paths = new CollectIgnoredPathsEvent($stage);
    $event_dispatcher->dispatch($ignored_paths);

    $event = new StatusCheckEvent($stage, $ignored_paths->getAll());
    $event_dispatcher->dispatch($event);
    $results = $event->getResults();

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India omkar.podey

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.

Production build 0.69.0 2024