Skip to content

FOUR-12638: Introduce customized optimize:clear#5713

Merged
ryancooley merged 1 commit intodevelopfrom
bugfix/FOUR-12638
Nov 29, 2023
Merged

FOUR-12638: Introduce customized optimize:clear#5713
ryancooley merged 1 commit intodevelopfrom
bugfix/FOUR-12638

Conversation

@runyan-co
Copy link
Copy Markdown
Contributor

@runyan-co runyan-co commented Nov 29, 2023

Issue

In production, we use the bootstrap/cache/packages.php file as a cached store of licensed packages which we would like to be loaded. In the case that the php artisan optimize:clear command is run, this flushes that file (which is generated with a separate command) and causes the framework to regenerate the file with all packages discovered, regardless of licensing.

Reproduction Steps

  1. Install all custom and enterprise packages using develop
  2. Run the php artisan license:update {pathToLicenseJsonFile} command to generate the package manifest.
  3. Interact with the platform and notice everything working as intended
  4. Now run php artisan optimize:clear
  5. Check the platform again (e.g. the /requests page). Notice the errors/multiple menu items added, etc. This is because there are multiple additional ServiceProviders from the custom packages which are not supposed to be loaded.

Solution

  • Introduce our own optimize:clear command to override the framework's and remove the subcommands which alter the cached package manifest.

How to Test

Run through the reproduction steps and it should now not flush the package manifest.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@processmaker-sonarqube
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@caleeli caleeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems something is wrong, steps to reproduce:

  • Install customer adoa
  • php artisan customer-adoa:install --help // check the package was installed
  • php artisan processmaker:license-update {license.json} without adoa
  • php artisan customer-adoa:install --help // it fails, command not found
  • php artisan optimize:clear
  • php artisan customer-adoa:install --help // adoa works again
  • open processmaker and executes the adoa package

image

Copy link
Copy Markdown
Contributor

@caleeli caleeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steps to test:
Install customer adoa
php artisan customer-adoa:install --help // check the package was installed
php artisan processmaker:license-update {license.json} without adoa
php artisan customer-adoa:install --help // it fails, does not exists
php artisan optimize:clear
php artisan customer-adoa:install --help // does not exists

Also, About page does not show customer-adoa:
image

When the license is removed:

php artisan processmaker:license-remove
php artisan optimize:clear

Package Adoa is back again
image

@ryancooley ryancooley merged commit 38dfb13 into develop Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants