Commit Graph

96 Commits (jtr/fix-public-exceptions-http-codes)

Author SHA1 Message Date
Ferdinand Thiessen b4d19748fa
fix(Memcache): ensure global prefix depends on enabled apps
- ensure the prefix is changed when an app is (dis)enabled
- ensure the app ids are included in the hash instead of only the
  version numbers
- ensure hash is deterministic by always use the same order.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-10-27 16:18:24 +07:00
Marcel Müller 34a085d3bf fix(cache): Ensure unique global prefix per instanceid
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
2025-09-28 17:59:12 +07:00
Ferdinand Thiessen 660f3f6fd1
refactor: use logical `&&` `||` instead of weak `and` `or` operators
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-09-27 23:02:18 +07:00
Ferdinand Thiessen 112178d3a0
fix: typos in cache and app config
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-08-18 18:35:54 +07:00
Ferdinand Thiessen 0ef58c96ab
refactor(Memcache\Factory): move prefix generation to the factory class
This removes a circular dependency between AppConfig and cache factory.
When a cache in the app config is used.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-08-18 13:24:18 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
John Molakvoæ 2d5060d1e3
Merge pull request #46151 from nextcloud/enh/do-not-enforce-cache-for-cli 2024-10-29 15:28:47 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Robin Appelman da59fd4389
fix: misc code fixes around db sharding
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-09-09 16:59:59 +07:00
Robin Appelman c58bdbf378
fix: delay calculating global cache prefix untill a cache is created
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-08-28 10:18:52 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Robin Appelman 20dbb6c7e8 feat: add negative compare-and-delete to imemcache
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-08-20 19:34:28 +07:00
Robin Appelman cae0a8218d
chore: remove Redis::DEFAULT_TTL constant now that it's defined in the interface
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-08-07 19:41:44 +07:00
Robin Appelman b19652a2ad
chore: cleanup acpu inc and dec
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-08-07 19:41:43 +07:00
Robin Appelman cd9cc01b77
fix: set default TTL for APCu cache as per docs
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-08-07 19:41:41 +07:00
MichaIng 89cd3b4f88 feat(cache): CLI should not fail if APCu is not available
but fallback to NullCache. This can be the case if APCu is used without apc.enable_cli=1. APCu however runs within the PHP instance and hence cannot be shared between CLI and web or used as distributed cache. The CLI call can hence only create or invalidate entries for itself. For short-living CLI calls, this is theoretically a downsides regarding performance and resource usage, and Nextcloud must not have any issues using the dummy NullCache instead of an isolated freshly created and destroyed APCu instance.

This partly reverts https://github.com/nextcloud/server/pull/25770. The fallback was removed, because CLI calls started to hang after https://github.com/nextcloud/server/pull/25440. The reason however was not that a cache is generally required for CLI calls, but because the previously logged warning invoked the user backend, which invoked again the caching backend, causing a loop.

This commit re-adds the fallback without logging a warning, and for APCu only. For mentioned reasons, it is okay to fallback to NullCache silently. If Redis or memcached are configured but not available, then the web UI would fail as well, and it makes sense to abort and inform CLI calls as well then.

The motivation is to make apc.enable_cli=1 optional, and that hence the documentation about it can be removed. We should not enforce admins to enable APCu for CLI calls, which is reasonably disabled by default. This also reduces requirements for hosting providers to support Nextcloud.

Signed-off-by: MichaIng <micha@dietpi.com>
2024-08-01 10:02:44 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Velwark 535d5de037 Update LoggerWrapperCache.php
Extra Dollar Sign caused errors in Nextcloud. Removing the Dollar Sign Solved the Problem.

Signed-off-by: Velwark <levinfrerich9@gmail.com>
2024-04-23 09:54:44 +07:00
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +07:00
Andrew Summers c0f12d7691 Refactor `OC\Server::getGetRedisFactory`
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
2024-03-15 13:11:40 +07:00
Robin Appelman cc3c7c24a1 set a default and max ttl for redis keys
having infinite TTL can lead to leaked keys as the prefix changes with version upgrades

Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-02-23 15:41:51 +07:00
Côme Chilliet f73f966c98 chore: Add missing ArrayAccess template parameters
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-02-06 10:24:41 +07:00
Robin Appelman ff62154a79 adjust redis compareSetTTL to use a lua script
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-12-21 15:14:27 +07:00
Robin Appelman 7394645eb7 restore shared lock ttl when releasing
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-12-21 15:14:27 +07:00
Joas Schilling aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +07:00
Christoph Wurst ff672b11e2
feat: Add factory method for in-memory caches
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-10-11 13:37:22 +07:00
Christoph Wurst fac05bce07
chore: Drop unused \OC\Memcache\Factory::createLowLatency
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-10-11 09:40:27 +07:00
Joas Schilling 93f0399a92
fix(memcache): Fix comparison of Memcache configs to classes
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-08-16 16:05:50 +07:00
Daniel Kesselberg 7cab58237d chore: remove version check for apc extension
APC is gone since PHP 7.0.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-08-10 15:02:19 +07:00
Robin Appelman 9f1d497a0b
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in  lib/private to improve code readability.
2023-06-01 23:10:00 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Varun Patil c6cee282b3 redis: move lua scripts to class and add type hints
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2023-05-10 17:37:02 +07:00
Varun Patil 39e805fffa redis: use atomic operations everywhere
This removes a lot of acrobatics in the code and does each operation
atomically using a lua script. This also reduces several round trips
to the server, and the scripts are compiled and cached server-side.

Notably, since all operations work only on a single key (except clear,
which is broken anyway and shouldn't be used), they will continue to
function and be atomic for Redis cluster.

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2023-04-16 14:38:56 +07:00
Git'Fellow c81ea3aa98
Fix RedisCluster
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-03-22 17:19:07 +07:00
Git'Fellow fab390f884
Move from DEL to UNLINK
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-03-22 17:10:05 +07:00
Robin Appelman 853ec60f3e also cache backend for user in memory instead of always going to redis
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-10 12:25:23 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Julius Härtl 023b80e617
Only setup redis connection if needed
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-11-22 09:26:24 +07:00
Côme Chilliet 826e234ecf
Correctly handle Redis::keys returning false
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-09-29 14:41:53 +07:00
Arthur Schiwon 90104bc1c4 memcached should not throw arbitrary exceptions
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-06-17 18:32:14 +07:00
Carl Schwan 3f97bcdc75 Enable binary protocol again
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-06-17 17:24:24 +07:00
Carl Schwan ba88187649 Add hit information to profiler
This might be helpful later on for the cache ui that is worked on in
https://github.com/nextcloud/profiler/pull/21

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-05 14:12:44 +07:00
Carl Schwan 7d272c54d0 Add a built-in profiler inside Nextcloud
The webui is provided by a seperate application named profiler

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-04-04 10:28:26 +07:00
Côme Chilliet 6be7aa112f
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +07:00
Carl Schwan e3a12b3482
Fix psalm issues in theming app
After this change, we are down to only one psalm warning for this app
and related to the Application.php. This also make composer
psam:update-baseline not silently ignore new errors.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-26 14:26:58 +07:00
Côme Chilliet 36d7c73e69
Always call flush() as getAllKeys() is broken
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-20 11:20:18 +07:00
Carl Schwan 6312c0df69
Check style update
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-13 00:19:07 +07:00
Carl Schwan aeecb72e96
Fix a few psalm issues and moved back to psalm/phar 4.18
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-12 20:03:06 +07:00
Carl Schwan 52760a95d9
Check if directoy is writable instead of possibly missing file
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-12-20 15:36:52 +07:00
Joas Schilling 168c673755
Allow to log DB, redis and LDAP requests into files
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-01 22:33:41 +07:00