Skip to content

Conversation

@mejo-
Copy link
Member

@mejo- mejo- commented Dec 7, 2021

Also don't write to cache in this case to prevent cache and config file
being out of sync.

Fixes: #29901

@mejo- mejo- added the 3. to review Waiting for reviews label Dec 7, 2021
@mejo- mejo- self-assigned this Dec 7, 2021
mejo- added a commit to nextcloud/documentation that referenced this pull request Dec 7, 2021
This depends on nextcloud/server#30130.

Signed-off-by: Jonas Meurer <jonas@freesources.org>
@mejo-
Copy link
Member Author

mejo- commented Dec 7, 2021

I opened a corresponding PR in nextcloud/documentation: nextcloud/documentation#7795

@nickvergessen
Copy link
Member

So this means all the paths which set a config need to check for the exception?

@mejo- mejo- force-pushed the fix/config_is_read_only branch from 33bd721 to 25b3ecf Compare December 7, 2021 11:31
@mejo-
Copy link
Member Author

mejo- commented Dec 7, 2021

So this means all the paths which set a config need to check for the exception?

Right now, a config file with read-only permissions throws the same kind of exception. So in my eyes, adding the check is not a regression to how it was before. What do you think?

I agree that proper notifications about the config file being set to read-only would be nice in the long term. But that can be tackled in another PR later, no?

@solracsf
Copy link
Member

solracsf commented Dec 7, 2021

Does it make sense to use OC::$CLI so writes would always be possible using the CLI?

if (OC::$CLI) {
  // write
} else {
  // exception
}

@nickvergessen
Copy link
Member

That also is true for cron jobs where I would not expects write to happen.

Also don't write to cache in this case to prevent cache and config file
being out of sync.

Fixes: #29901
Signed-off-by: Jonas Meurer <jonas@freesources.org>
@mejo- mejo- force-pushed the fix/config_is_read_only branch from 25b3ecf to 241dfef Compare December 13, 2021 12:14
@mejo-
Copy link
Member Author

mejo- commented Dec 13, 2021

So this means all the paths which set a config need to check for the exception?

Do you mean that throwing the exception should be exposed on the interface (IConfig) as well, similar to @ChristophWurst's comment? If so, then I added this now: https://github.com/nextcloud/server/pull/30130/files#diff-54875ef8945bf07212017eccde83d6400812202ce1e30227e9fda9e92fa9474d

@mejo- mejo- requested a review from ChristophWurst December 13, 2021 12:17
@juliusknorr
Copy link
Member

Leaving the merge to a re-review from @ChristophWurst or @nickvergessen

@nickvergessen nickvergessen removed their request for review December 15, 2021 08:42
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ChristophWurst ChristophWurst merged commit 4b36f9d into master Dec 17, 2021
@ChristophWurst ChristophWurst deleted the fix/config_is_read_only branch December 17, 2021 13:39
@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Dec 17, 2021
@ChristophWurst
Copy link
Member

@mejo- please add this to #29914 and update the developer docs about the change ✌️

@mejo-
Copy link
Member Author

mejo- commented Dec 17, 2021

Yay, thanks @ChristophWurst!

Added to #29914. Docs should be updated automatically with this PR. At least @nickvergessen said that admin_manual/configuration_server/config_sample_php_parameters.rst will be auto-generated from config/config.sample.php in nextcloud/documentation#7795. Or what do you mean with "developer docs"?

@ChristophWurst
Copy link
Member

The admin docs will be updated with the sample config, yes. But https://docs.nextcloud.com/server/latest/developer_manual/basics/storage/configuration.html should receive an update about the new exception

mejo- added a commit to nextcloud/documentation that referenced this pull request Dec 17, 2021
With nextcloud/server#30130, `setConfigValue` throws a HintException when config is read-only.
@mejo-
Copy link
Member Author

mejo- commented Dec 17, 2021

The admin docs will be updated with the sample config, yes. But https://docs.nextcloud.com/server/latest/developer_manual/basics/storage/configuration.html should receive an update about the new exception

Ah, thanks for the pointer! Did this now: nextcloud/documentation#7851

mejo- added a commit to nextcloud/documentation that referenced this pull request Jan 13, 2022
With nextcloud/server#30130, `setConfigValue` throws a HintException when config is read-only.

Signed-off-by: Jonas Meurer <jonas@freesources.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config setting config_is_read_only should prevent Nextcloud from writing to config.php

6 participants