New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi_server_environment setting now disallows config edits from Web UI #16760
multi_server_environment setting now disallows config edits from Web UI #16760
Conversation
Makes sense @nina-py Might need to add a note in |
Thanks @tsteur, added a note to the global config file. |
Hi @tsteur , is there anything else that needs to be done in this PR? Or are you guys just way too busy at the moment following the 4.0.x release? |
@@ -10,7 +10,7 @@ | |||
{{ ajax.errorDiv() }} | |||
{{ ajax.loadingDiv() }} | |||
|
|||
{% if isGeneralSettingsAdminEnabled %} | |||
{% if isGeneralSettingsAdminEnabled and not isMultiServerEnvironment %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that is actually not needed to hide the archiving settings. They are stored in the database when configured through UI. See
matomo/core/ArchiveProcessor/Rules.php
Lines 265 to 272 in f5e9420
public static function setBrowserTriggerArchiving($enabled) | |
{ | |
if (!is_bool($enabled)) { | |
throw new Exception('Browser trigger archiving must be set to true or false.'); | |
} | |
Option::set(self::OPTION_BROWSER_TRIGGER_ARCHIVING, (int)$enabled, $autoLoad = true); | |
Cache::clearCacheGeneral(); | |
} |
Only if that values is not available the one in config should be used.
Hiding the email settings only makes more sense, as they are stored in config only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sgiehl, I'll tackle this over the weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgiehl, I updated the template to hide only the Email Server settings if in multi-server environment.
$isWritable = Piwik::hasUserSuperUserAccess() && CoreAdminController::isGeneralSettingsAdminEnabled(); | ||
$isWritable = Piwik::hasUserSuperUserAccess() | ||
&& CoreAdminController::isGeneralSettingsAdminEnabled() | ||
&& SettingsPiwik::isMultiServerEnvironment() === false; | ||
$this->releaseChannel = $this->createReleaseChannel(); | ||
$this->releaseChannel->setIsWritableByCurrentUser($isWritable); | ||
|
||
$isWritable = $isWritable && PluginUpdateCommunication::canBeEnabled(); | ||
$this->sendPluginUpdateEmail = $this->createSendPluginUpdateEmail(); | ||
$this->sendPluginUpdateEmail->setIsWritableByCurrentUser($isWritable); | ||
|
||
$isWritable = Piwik::hasUserSuperUserAccess() && CoreAdminController::isGeneralSettingsAdminEnabled(); | ||
$dbSettings = new Settings(); | ||
if ($isWritable && $dbSettings->getUsedCharset() !== 'utf8mb4' && DbHelper::getDefaultCharset() === 'utf8mb4') { | ||
$this->updateToUtf8mb4 = $this->createUpdateToUtf8mb4(); | ||
} | ||
|
||
$isWritable = $isWritable && PluginUpdateCommunication::canBeEnabled(); | ||
$this->sendPluginUpdateEmail = $this->createSendPluginUpdateEmail(); | ||
$this->sendPluginUpdateEmail->setIsWritableByCurrentUser($isWritable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually only the release channel is a configuration that is managed in config. The other values are "normal" settings, stored in database. So for those it wouldn't hurt to have them writable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for that, I have updated the code to reflect that (and did a very minor refactor to remove duplicate code).
Turning the multi_server_environment setting on now hides the following settings from the Administration -> Settings -> General settings page: - Archiving settings - Email server - Trusted Matomo hostname - Update settings ...so that users cannot set these separately on different instances of Matomo. Fixes #14390.
…the general settings page. - Only making the release channel not writable in CoreUpdater->SystemSettings, and leaving the other settings as before.
Hi @sgiehl, in addition to the changes you requested earlier, I have updated a UI screenshot (an extra comment for the setting about half-way through the screenshot): https://builds-artifacts.matomo.org/matomo-org/matomo/4.x-dev/44409/UIIntegrationTest_admin_diagnostics_configfile.png. CI build in progress. As far as I can see, the other failures in those two jobs are not related to the changes introduced in this PR. I've also rebased the branch. Please review. |
@sgiehl, just to follow up on the most recent CI build for this PR - the updated screenshot matches but there is one failure elsewhere with the following: There was 1 failure:
1) Piwik\Tests\Integration\ReleaseCheckListTest::test_screenshotsStoredInLfs
Some Screenshots are not stored in LFS: tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
Failed asserting that an array is empty.
/home/travis/build/matomo-org/matomo/tests/PHPUnit/Integration/ReleaseCheckListTest.php:180 Do I need to do anything about this one? |
@nina-py We are storing our screenshots in Git LFS to not waste space in this repo. You may need to install Git LFS to update the the srceenshots properly |
Updated UIIntegrationTest_admin_diagnostics_configfile.png - with Git LFS this time around.
Thank you @sgiehl, I think I got this right this time around - the commit diff shows
but the build is yet to run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now 👍 @nina-py
Thank you @sgiehl for all your help with this one! |
Description:
Turning the multi_server_environment setting on now hides the following
settings from the Administration -> Settings -> General settings page:
...so that users cannot set these separately on different instances of Matomo. Assuming I got these right, are there any other settings that should be disabled when
multi_server_environment
is turned on?Fixes #14390.
Review