Open pixelchutes opened 7 years ago
Agreed, but it should not limited to clearing cache. We should be able a single against multiple/all instances.
But i'm not sure how to handle failures in those situations...
Certainly! Batching in general would be awesome to extend to the other commands, where appropriate.
Here's a simple proof of concept for batching "MODX Version" (unnecessary, I know -- just a simple/safe command I used for testing)
modx config:list | tail -n +4 | grep "|" | awk -F" " '{ system("modx version -s"$2"") }'
Thanks for putting that out here!
After leaving that idea grow, i guess i could come up with a "batch" command that would execute any sub command...
modx batch {command}
would run {command}
on all defined/configured instances
modx batch {command} --instance name1 --instance name2
would run command
on name1
& name2
instances, according they exist...
Does that sound like a good idea ?
Edit : i guess this also brings the need to enable commands to be "batcheable". It does not make sense to "batch install" for example.
I also forgot to handle command arguments/options so far...
@rtripault that is awesome! Exactly the line of thinking I had, since -- in some cases -- you'd definitely need the ability to only target a handful of instances.
Agreed, some things should not be "batchable." Let me know if there's anything I can do to assist. e.g. Testing, at the very least.
EDIT: I'm not sure what would be easiest in terms of flagging a command in support of batch (opt in vs. opt out approach.)
With some minor bash scripting, it shouldn't be too difficult to create a loop of each configured instance, mapping a subsequent call to
system:clearcache
to each.It would be even cooler + easier if there was a built in batch command to clear all caches from the tool itself.