Welcome to Shell
Who needs Webservers when you have the CLI?
Using Symfony's Console component for providing shell access to the MidCOM framework has been on the todo list practically from the beginning of the 9.0 branch. However, for the longest time, the implementation has been blocked by the various assumptions built into the Ragnaroek startup routines.
Over the last three years, they were first improved to support both Midgard 1 and Midgard 2 backends, and later, the bootstrapping code was adapted to also provide an environment for running the growing suite of unit tests, and most recently partial support for running without a working backend was added (which is very useful in installation scripts).
It took no small amount of trickery to pull this off initially, but during each iteration, the code was simplified and untangled further, so that the final changes for CLI support over the last couple of weeks were surprisingly small.
The component contains the application setup code and the
exec command, which might serve as a template for custom commands. It is a wrapper for midcom-exec scripts that scans all available components' exec folders, each found file is registered as a command. Getting an overview of all scripts a given component provides is as simple as calling the default
list command with the component name:
You can see that the script also provides a number of switches, for example
servername should always be set when the called code generates full URLs (like links in email reminders). Looking at the list, you may also begin to suspect that not all exec scripts are useful or even useable from the shell. In truth, most of them have not been tested yet, but many obvious candidates like the cron runner are completely functional, so that cron runs can now be triggered like this:
./bin/midcom midcom:cron ./bin/midcom midcom:cron type=hour ./bin/midcom midcom:cron type=day
But the bigger picture of course is that it should now be possible to use most if not all parts of the framework from the command line, so writing maintenance or analysis scripts as well as heavy background tasks should now be a lot more enjoyable.
You can play with this by getting the latest code from github, if you have any suggestions or pull requests, just let us know!
In my experience, Li
In my experience, Linu hsoting blows away everything else. You can control every aspect of what's going on. Plus you do not have to pay licensing fees for serial keys, or worry about viruses.