I’ve got a plugin in cakephp that runs first whenever I execute the command migrations migrate from the CLI.
I want to add an argument, say cake migrations migrate -v=123 that will be used by this plugin and then remove it from the shell command before the command reaches the main migrations plugin.
Currently, I’m trying this via a plugin that has a bootstrap file which modifies the global variable args, grabbing the argument and then removing it from there, the issue is that, even if I modify this variable or the $_SERVER[‘args’] the original list of args still reaches the migrations plugin and then it throws an error because of the extra argument.
I’m thinking there would be 2 ways:
- Get the argument and then remove it from the argument list(Here I don’t know how to overwrite the argument list so the migrations plugins gets the updated args list)
- Stop the shell execution within this plugin, get the argument and then start another shell execution without the argument.(Here I dont know how to stop the shell execution within the plugin’s bootstrap since I dont have a shell instance to use abort)
Any ideas how I could accomplish either way of those methods? Consequently, if you have any other suggestions, would love to hear them