Adds a new console command marketplace:add-license-key which adds a marketplace license key (Fixes #18070)
This is the first draft. It does not implement any checks like it's done in the Marketplace API: https://github.com/matomo-org/matomo/blob/2ac2bc1aeaf8efce6bb9af92506311da99e1757f/plugins/Marketplace/API.php#L69-L95
I'd need some pointers for further implementing this, if checking the license key this is deemed necessary.
The failing checks do not seem to be related to my change.
If you don't want this PR to be closed automatically in 28 days then you need to assign the label 'Do not close'.
@ziegenberg I see this PR is in draft. Not sure if that was you? Is that ready for a review?
I left this in the draft state because it is most certainly not ready yet and I wanted to discuss my implementation before going to review. I suspect that I have misinterpreted the workflow here...
@ziegenberg this looked all good to me. I would maybe just rename the command to be
set license key instead of
add license key.
So you don't want to add any checks for validity while setting the license key?
I quickly made the suggested changes and rebased onto current 4.x-dev
@ziegenberg it depends what you are using the command for and how quick things need to go as the validation will take a bit of time. We have an API that you can use like
\Piwik\Plugins\Marketplace\Api::getInstance()->saveLicenseKey($licenseKey) and then it will validate the license key and also invalidate caches.
This API won't "remove/unset" the license key though. If an empty license key is provided, then you would need to call the API method
Overall this would be better indeed 👍
@tsteur I added the checks using the API. Does this look good to you?
Nice, that looks good and works nicely 👍 Thanks for that.