Commit Graph

39 Commits (master)

Author SHA1 Message Date
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 week ago
Sam Bull b6ade7c8e4 fix: regression with updating read-only config
Signed-off-by: Sam Bull <git@sambull.org>
1 month ago
Varun Patil 158558763d fix(config): correctness issues in reading
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2 months ago
Simon L e87d968c24 add a check for disk_free_space in Config.php
Signed-off-by: Simon L <szaimen@e.mail.de>
1 year ago
Sergei Golovan 1cb50c5afa Fix integer overflow on 32-bit systems when testing free space for writing a config file. 1 year ago
Simon L 3757b345bc address review by Joas
Signed-off-by: Simon L <szaimen@e.mail.de>
1 year ago
Simon L 9b6e5c6674 add a disk_free_space check before writing config
Signed-off-by: Simon L <szaimen@e.mail.de>
1 year ago
Joas Schilling 3236619e99
Revert "Make config file saving safe against write failures" 2 years ago
Côme Chilliet 1013c3bf66
Merge pull request #34009 from andrey-utkin/safe-config-update
Make config file saving safe against write failures
2 years ago
Andriy Utkin 807c53b2ab Make config file saving safe against write failures
In case of disk space depletion, writing a new version of config fails,
leaving the config file empty.

This patch improves safety of updates to config.php by saving the new
version of the config into a randomly-named temporary file in the same
directory, and then renaming it to config.php, which renaming is atomic
in POSIX-compliant filesystems and shouldn't involve disk space
allocation. If writing the new config version is impossible, the current
config remains unchanged.

This patch drops the use of file locking as unnecessary. File locking
merely established order in which the concurrent independent processes
attempted file writing. In the end, the process which was last to update
the file "wins" - their changes persist and the changes of previous
writers are dropped as there's no conflict detection or change merging
mechanism anyway. With the current change, there is still some resulting
ordering, and the last writer still wins in the same way. Readers don't
need file locking as well, as opening config.php for reading always
provides a certain consistent version of the file.

Signed-off-by: Andriy Utkin <dev@autkin.net>
2 years ago
Côme Chilliet c2dafb0997
Do not empty config.php file if reading failed for any reason
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2 years ago
Vincent Petry 89cb450c84
Detect leading spaces in config files
Because those will cause PHP to output to stdout and will cause
unrelated error messages.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2 years ago
Jonas Meurer 241dfef7fb
Don't write to config file if `config_is_read_only` is set
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>
3 years ago
Gary Kim b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
3 years ago
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
3 years ago
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Roeland Jago Douma 17ffe46d0b
Read the env variables only once
We read config.php an awefull lot of times. So it only makes sense to
kill this as much as wel can.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 42625a46be
Remove spaces after method or function call
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Roeland Jago Douma 19ca921676
Merge pull request #20241 from nextcloud/fix/license-headers-19
Update the license headers for Nextcloud 19
4 years ago
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
John Molakvoæ 1b4952bfb2
Update Config.php 4 years ago
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Daniel Kesselberg 9104e028a3
Remove deleteFromOpcodeCache & clearOpcodeCache
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
5 years ago
Morris Jobke 2b73779568
Fix some typos
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 9309217ecb Fix escaped HTML on error pages
* fixes #4655

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 95a21e2f2a
Check for boolean false and add tests
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 0fcb37adcb
OC_ -> NC_
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Philipp Schaffrath 695a17804e
Override config.php values through ENV variables (#26570)
* added functionality to override config.php values with 'OC_' prefixed environment variables

* use getenv to read environment variables since apache does not set $_ENV variables, fixed test

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Joas Schilling 0215b004da
Update with robin 8 years ago
Joas Schilling ba87db3fcc
Fix others 8 years ago
Morris Jobke 191a6c65d9
Show error message if config file is not readable
* when the config file is not writable there is a error message shown
* same happens now if the config file is not readable
* fixes #180
8 years ago
Lukas Reschke aba539703c
Update license headers 8 years ago
Roeland Jago Douma d312051b3d
Moved some files in \OC to PSR-4
* \OC\ActivityManager
* \OC\AllConfig
* \OC\AppConfig
* \OC\AppHelper
* \OC\Avatar
* \OC\AvatarManager
* \OC\CapabilitiesManager
* \OC\Config
* \OC\ContactsManager
* \OC\DatabaseException
* \OC\DatabaseSetupException
8 years ago