fix(config): Suppress config.php
fopen error at install time
#48426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Failed to open stream
+Error while running background job
immediately after installation #45671 (config.php error not the second one in that report)Summary
The changes in #44230 brought back a regression from the OC days which is generating a non-operational error immediately after install time:
owncloud/core#13736
owncloud/core#21923
It becomes the very first log entry you see after a new install. While harmless from a technical standpoint, it is needless to say, not a great way for someone to be introduced to Nextcloud right after installation. And it gives the impression something is wrong, when it really isn't.
Cause
At install time we use our
onError
error handler:server/lib/base.php
Line 651 in 341b31b
This handler lacks handling to exclude suppressors:
server/lib/private/Log/ErrorHandler.php
Lines 53 to 61 in 341b31b
The easiest solution is simply to add back the
file_exists()
check here before we callfopen()
.Additional thoughts
Despite this PR, I was tempted to add support in the
onError
handler for the suppressor. That way things behave in a standard way. If we want to suppress, it's been decided upon for a good reason. I took the approach here in this PR for now though because it seemed more conservative, by simply bringing back thefile_exists()
check and relying on that instead of the non-functioning suppressor. This PR should be sufficient though since there aren't currently any other known situations where the suppressor handling is an issue. If/when other spots with the suppressor pop up, we could reconsider.TODO
Checklist