Posting to new activity to track when a customer requests report invalidation via the console. This is part of DEV-2669. There's a PR in the ActivityLog plugin to add the new activity so that it can be tracked.
@snake14 I'm not sure if adding this event is useful that way. It might help with the issue to see which invalidation were triggered when using this command. But imho for ActivityLog it might be enough to simply display that the command was run, together with the options that were set. There is already an event being triggered when a console command is executed:
This could be most likely used for that purpose I guess. Or maybe @tsteur has other thoughts on that.
👍 would say as well be probably best to trigger only one activity for the command as otherwise it may result in a lot of entries. If there's an event we can already reuse that be good.
@sgiehl @tsteur Thank you. I was unaware of the
Console.doRun event. I searched the list of events, in an effort to avoid changing core, but I didn't see anything I thought I could use in this case. The closest I could find was Console.filterCommands, but that didn't seem to match what I needed. Was it intentional to leave out
Console.doRun from that list or should it be added?
@justinvelluppillai Good call. I'll close it now. The only remaining question was whether the
Console.doRun event was intentionally left out of the documentation or if it should be added. I also noticed that no event data was passed for that event, so I had to use
$_SERVER['argv'] to see which command was used. Is there a better way to do that?
@justinvelluppillai Thank you. That's what I suspected when I saw that it had an ignore annotation on it, but I wanted to make sure. I've got my hook for
Console.doRun working using
$_SERVER['argv'], but I'm always open to better options.
@snake14 doesn't the event pass
$input? That could be used to get what you need if I'm not mistaken.
@justinvelluppillai Yeah. It looks like in
core/Console.php, it passes the following array:
[&$exitCode, $input, $output]. However, when I debugged the hook in the ActivityLog plugin, the
$eventData was null instead of the array that I was expecting.
@justinvelluppillai Altamash noticed that the issue was that I defined my hook method with too few arguments. I'll try adjusting that. I figured I was doing something wrong when I had to use the
$_SERVER global, I just didn't know what I was missing.
yep nice one, I saw that 👍🏽