nextcloud / nextcloud/server

Detect unintentional multiple `*.config.php` files to catch weird config problems

Open
#46,665 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: settings
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Sometimes an administrator makes a manual backup of their existing config before making an adjustment. If they name it {anything}.config.php this results in them unintentionally having overlapping config files. And it also means the backup takes precedence. This creates all sorts of unexpected behaviors that can be difficult to isolate (and may give the appearance of bugs)[^exhibitA].

Multiple config.php file support is valid so this problem is difficult to detect automatically without creating lots of false positives. I think we can take a pragmatic approach by focusing on two areas of improvement:

  • logging / indicating when multiple config files are in-use in a few spots (where it won't be overly noisy/intrusive in the environments where it's perfectly valid)
  • detect the most common yet least likely to be a false positive situation: multiple config files with overlapping version field values

Specifically:

  • during the upgrade we log that multiple config files were detected (not an error, just notes it so it'll be obvious when logs are reviewed or provided for troubleshooting)
  • create a setup check that detects obvious signs of a probable unintentional multi-config file situation.[^how]
  • possibly we give an indication that multiple config files are in-use somewhere in the UI
  • possibly we give an indication that multiple config files are in-use when running some occ commands[^Updater]

[^how]:I think we could check for two things occurring and warn only if they occur simultaneously: multiple config.php files detected and differing version field values across them. This avoids false positives (while likely catching probably the most common unintentional scenario).

[^exhibitA]: e.g. https://help.nextcloud.com/t/nextcloud-failed-after-update-to-29-0-4-from-28-0-2/198547/12

[^Updater]: Relevant to "Upgrader" (occ upgrade), but less so - at least directly - to the non-multi aware Updater[^yeah] (updater[phar])

[^yeah]: (yeah I know...)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how config.php files are discovered during the upgrade flow and setup checks, then review the relevant occ upgrade entry point. Compare the detected files' version fields and determine where diagnostic output belongs. Done means upgrade logging and a setup warning cover the specified overlapping-version case without flagging valid multiple configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.