nextcloud/lib/private
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>
2022-09-09 21:46:12 +01:00
..
Accounts Move CappedMemoryCache to OCP 2022-07-14 15:54:31 +02:00
Activity Update php licenses 2021-06-04 22:02:41 +02:00
App Move findBinaryFinder and isFunctionEnabled away from OC_Helper 2022-08-23 19:44:04 +02:00
AppFramework Move registration to IBootstrap 2022-08-31 16:20:06 +02:00
Archive Expose ZIP stat information 2022-04-11 17:49:08 +02:00
Authentication Add back TokenCleanupJob to invalidate old temporary tokens 2022-08-25 11:31:21 +02:00
Avatar Update avatars on update 2022-09-09 14:23:41 +02:00
BackgroundJob Fix many tests and warnings 2022-08-08 17:03:51 +02:00
Broadcast/Events Update php licenses 2021-06-04 22:02:41 +02:00
Cache Move CappedMemoryCache to OCP 2022-07-14 15:54:31 +02:00
Calendar Fix various errors in iMIP logic 2022-09-08 02:26:10 +02:00
Collaboration Inject all dependnencies and increase cache timeout 2022-08-31 18:02:57 +02:00
Command Fix many tests and warnings 2022-08-08 17:03:51 +02:00
Comments Delete comments that expired now 2022-07-25 11:30:20 -03:00
Console Remove OCP\App and OCP\BackgroundJob 2022-08-01 09:46:40 +02:00
Contacts/ContactsMenu Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
Dashboard avoid early DI of IAppManager 2022-06-22 21:58:13 +02:00
DB Declare strict types in all new Event classes 2022-08-25 16:15:49 +02:00
Diagnostics Move CappedMemoryCache to OCP 2022-07-14 15:54:31 +02:00
DirectEditing fix translation source in directEditing templates 2021-12-16 16:30:50 +01:00
Encryption add marker interface to mark system mount points for encryption 2022-08-25 13:55:53 +02:00
EventDispatcher Fix codestyle 2022-03-24 16:21:27 +01:00
Federation cache cloud id data in CloudIdManager 2022-08-31 13:33:33 +02:00
Files Merge pull request #33788 from nextcloud/improve-recent 2022-09-08 16:19:41 +02:00
FullTextSearch Fix ArrayAccess and JsonSerializable return types 2021-11-23 09:28:56 +01:00
GlobalScale Update php licenses 2021-06-04 22:02:41 +02:00
Group Do not ignore return value of deleteGroup from backend 2022-04-04 16:40:07 +02:00
Hooks Update php licenses 2021-06-04 22:02:41 +02:00
Http Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
IntegrityCheck Simlify tests for integrity check on modified mimetype lists 2022-06-07 21:54:27 +02:00
KnownUser Update php licenses 2021-06-04 22:02:41 +02:00
L10N Use {$var} instead of ${var} for PHP 8.2 compatibility 2022-06-14 15:12:28 +02:00
LDAP Update php licenses 2021-06-04 22:02:41 +02:00
legacy Migrate Repair events to OCP\EventDispatcher\Event 2022-08-25 16:15:48 +02:00
Lock Cleanup lock related code 2022-05-12 15:09:58 +02:00
Lockdown use searchoperation for storage filter instead of db expression 2021-06-14 16:11:25 +02:00
Log Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated 2022-08-23 16:55:42 +02:00
Mail Move findBinaryFinder and isFunctionEnabled away from OC_Helper 2022-08-23 19:44:04 +02:00
Memcache memcached should not throw arbitrary exceptions 2022-06-17 18:32:14 +02:00
Metadata fix exif metadata provider 2022-08-12 13:54:12 +02:00
Migration Migrate Repair events to OCP\EventDispatcher\Event 2022-08-25 16:15:48 +02:00
Notification Fix wording of undeliverable push notifications 2022-08-31 12:42:31 +02:00
OCS Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
Preview Save getting the parent node when generating the preview 2022-08-24 22:20:32 +02:00
Profile Cache ConfigProfile 2022-08-18 12:02:16 +02:00
Profiler Add a built-in profiler inside Nextcloud 2022-04-04 10:28:26 +02:00
Remote Update php licenses 2021-06-04 22:02:41 +02:00
Repair Update avatars on update 2022-09-09 14:23:41 +02:00
RichObjectStrings Update php licenses 2021-06-04 22:02:41 +02:00
Route Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
Search Migrate from ILogger to LoggerInterface in lib/private 2022-03-24 16:21:25 +01:00
Security Port existing server code to new interface 2022-08-08 17:03:19 +02:00
Session Add config option to disable strict session timeout to be able to use read_and_close 2022-08-17 12:10:27 +02:00
Settings Merge branch 'master' into fix/setting/accessibility-title 2022-09-02 12:05:51 +02:00
Setup Create more secure passwords by default 2022-08-12 10:03:19 +02:00
Share Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
Share20 Use bigger slice in share provider 2022-08-16 11:17:27 +02:00
Support Migrate more classes of lib/private to LoggerInterface 2022-04-26 16:52:52 +02:00
SystemTag Update php licenses 2021-06-04 22:02:41 +02:00
Tagging Update php licenses 2021-06-04 22:02:41 +02:00
Talk Add a Talk API for OCP 2022-02-04 08:53:18 +01:00
Template Make it possible to load theme/<themename>/dist 2022-08-26 13:46:29 +02:00
Updater Migrate from ILogger to LoggerInterface in lib/private 2022-03-24 16:21:25 +01:00
User I dug into it again, and the issue is much simpler than I previously though. 2022-09-06 13:18:07 +00:00
UserStatus Allow to revert the user status of multiple users in 3 queries instead of 3*n 2022-02-15 16:06:33 +01:00
AllConfig.php fix mistake in db query to delete a user config value 2022-07-27 16:45:10 +02:00
AppConfig.php Remove SCSSCacher 2022-05-13 16:10:45 +02:00
AppScriptDependency.php Sort app scripts topologically by its dependencies 2021-12-29 16:40:05 +01:00
AppScriptSort.php Sort app scripts topologically by its dependencies 2021-12-29 16:40:05 +01:00
BinaryFinder.php Move findBinaryFinder and isFunctionEnabled away from OC_Helper 2022-08-23 19:44:04 +02:00
CapabilitiesManager.php Don't inject Bruteforce capability info in the webui 2022-04-07 17:33:29 +02:00
Color.php Update php licenses 2021-06-04 22:02:41 +02:00
Config.php Make config file saving safe against write failures 2022-09-09 21:46:12 +01:00
ContactsManager.php Fix a doctype in OCP for IAddressBook 2022-05-17 15:09:49 +02:00
DatabaseException.php Update php licenses 2021-06-04 22:02:41 +02:00
DatabaseSetupException.php Migrate HintException to OCP 2021-06-30 15:28:02 -04:00
DateTimeFormatter.php Update php licenses 2021-06-04 22:02:41 +02:00
DateTimeZone.php Move away from deprecated ILogger 2022-04-26 16:50:47 +02:00
EmojiHelper.php Include more emoji chars to test and fixes after include it 2022-04-29 14:00:57 -03:00
ForbiddenException.php Update php licenses 2021-06-04 22:02:41 +02:00
HintException.php Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
InitialStateService.php Update php licenses 2021-06-04 22:02:41 +02:00
Installer.php Migrate more classes of lib/private to LoggerInterface 2022-04-26 16:52:52 +02:00
LargeFileHelper.php Move findBinaryFinder and isFunctionEnabled away from OC_Helper 2022-08-23 19:44:04 +02:00
Log.php allow apps to specify methods carrying sensitive parameters 2022-07-28 23:30:17 +02:00
MemoryInfo.php Fix typos in lib/private subdirectory 2022-07-27 08:52:17 -04:00
NaturalSort.php Migrate more classes of lib/private to LoggerInterface 2022-04-26 16:52:52 +02:00
NaturalSort_DefaultCollator.php Update php licenses 2021-06-04 22:02:41 +02:00
NavigationManager.php l10n: Spelling unification 2022-09-02 12:42:07 +02:00
NeedsUpdateException.php Update php licenses 2021-06-04 22:02:41 +02:00
NotSquareException.php Update php licenses 2021-06-04 22:02:41 +02:00
PreviewManager.php Move findBinaryFinder and isFunctionEnabled away from OC_Helper 2022-08-23 19:44:04 +02:00
PreviewNotAvailableException.php Update php licenses 2021-06-04 22:02:41 +02:00
RedisFactory.php Add event logging for db and redis connection 2022-02-28 11:24:41 +01:00
Repair.php Parameter of RepairAdvanceEvent is actually an increment, not a step id 2022-08-25 16:26:31 +02:00
RepairException.php Update php licenses 2021-06-04 22:02:41 +02:00
Search.php Update php licenses 2021-06-04 22:02:41 +02:00
Server.php Merge pull request #33764 from nextcloud/cloudid-cache 2022-09-01 13:27:12 +02:00
ServerContainer.php Update php licenses 2021-06-04 22:02:41 +02:00
ServerNotAvailableException.php Update php licenses 2021-06-04 22:02:41 +02:00
ServiceUnavailableException.php Update php licenses 2021-06-04 22:02:41 +02:00
Setup.php Add back TokenCleanupJob to invalidate old temporary tokens 2022-08-25 11:31:21 +02:00
Streamer.php Fix docblock for addFileFromStream 2022-05-24 22:05:59 +02:00
StreamImage.php Send images to imaginary docker to generate previews 2022-03-17 08:24:07 +01:00
SubAdmin.php Update php licenses 2021-06-04 22:02:41 +02:00
SystemConfig.php Censor more configs 2022-03-01 21:08:16 +01:00
TagManager.php Update php licenses 2021-06-04 22:02:41 +02:00
Tags.php Update php licenses 2021-06-04 22:02:41 +02:00
TemplateLayout.php Move app menu to vue 2022-08-31 10:24:03 +02:00
TempManager.php Update php licenses 2021-06-04 22:02:41 +02:00
Updater.php Parameter of RepairAdvanceEvent is actually an increment, not a step id 2022-08-25 16:26:31 +02:00
URLGenerator.php app_path cannot be empty 2022-08-24 19:09:05 +02:00