Skip to content

Conversation

@gitlost
Copy link
Contributor

@gitlost gitlost commented Jan 5, 2018

Closes #27.

Deals with PHP memory allocation failure on install/uninstall corrupting the WP-CLI packages composer.json by registering a shutdown function to revert to backup.

Adds 2 new helper functions get_composer_json_path_backup_decoded(), which reads and validates composer.json, and register_revert_shutdown_function().

Modifies the get_composer_json_path() and create_default_composer_json() functions to return the absolute path of the composer.json file to simplify use, and adds some error checking and uses Utils.

Also unrelatedly puts try/catch processing into get_composer() to simplify use, and removes redundant call in uninstall(), and calls once outside loop in show_packages().

Adds phpunit tests for the new get_composer_json_path_backup_decoded() function and the modified get_composer_json_path() and create_default_composer_json() functions.

Needs wp-cli/wp-cli#4597 and a scaffold package-tests refresh before merging to use {INVOKE_WP_CLI_WITH_PHP_ARGS-}.

@gitlost gitlost added bug command:package-install Related to 'package install' command command:package-uninstall Related to 'package uninstall' command labels Jan 5, 2018
@gitlost gitlost added this to the 1.0.11 milestone Jan 5, 2018
@gitlost gitlost requested a review from a team January 8, 2018 15:43
@schlessera schlessera merged commit 3fa1d65 into master Jan 12, 2018
@schlessera schlessera deleted the issue-27-invalid-composer.json branch January 12, 2018 17:56
schlessera added a commit that referenced this pull request Jan 5, 2022
Revert composer.json on memory limit error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:package-install Related to 'package install' command command:package-uninstall Related to 'package uninstall' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants