545 Commits

Author SHA1 Message Date
Mark Johnson
b5519852fc
MDL-81987 redis: Set connection and read timeouts to 10 seconds
This allows the site to continue operating in case of degraded
performance, rather than throwing exceptions.
2024-08-08 13:17:03 +01:00
meirzamoodle
f8eecf37d9 MDL-75864 cache: Change key prefix in cache_cron_task
Currently, the cache_cron_task is set to look for 'sess_' as a key prefix,
which is not used in any code. As a result, sessions that have exceeded the timeout are never deleted.

The proposed patch involves changing the prefix to the LASTACCESS key prefix and
fixing the return value of get_many in the Redis cache so that it can return the required keys.

Co-authored-by: Renaud Lemaire <rlemaire@cblue.be>
2024-06-19 13:42:50 +07:00
Eloy Lafuente (stronk7)
091b458c52
MDL-81522 phpunit: Add missing void return type to all tests #2
This commit includes more changes, all them also adding the :void
return type to unit tests missing them.

The difference is that all these changes, while also detected
perfectly by the moodle.PHPUnit.TestReturnType sniff, were not
auto-fixed (like the previous commit ones), because all them
do include some "return" statement and, for safety, we don't
fix them.

All the cases have been visually inspected and confirmed that
the existing "return" statements always belong to anon
functions within the test body and not the test own return statement.
2024-06-11 12:18:05 +02:00
Eloy Lafuente (stronk7)
1093256560
MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.

All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
2024-06-11 12:18:04 +02:00
Andrew Nicols
f6be7e2a3e
Merge branch 'MDL-81794-404' of https://github.com/meirzamoodle/moodle into MOODLE_404_STABLE 2024-06-06 22:06:29 +08:00
meirzamoodle
7450f0e33f MDL-81794 cachestore_redis: Fix the TLS issue on the Redis 2024-05-24 14:28:10 +07:00
Paul Holden
5da8226f72
MDL-80208 cachestore_redis: ensure empty set many with TTL don't throw. 2024-05-21 22:36:46 +01:00
Jun Pataleta
a180dba314
MDL-81549 versions: bump all versions and requires near release 2024-04-17 00:03:29 +08:00
Jun Pataleta
3856addfdd
Merge branch 'MDL-67667-main' of https://github.com/andrewnicols/moodle 2024-04-12 12:41:39 +08:00
Andrew Nicols
6f1df841f7
MDL-67667 core: Deprecate and removal task blocking
There are inherent issues with task blocking which mean that it has
never worked properly. It is also very buggy and can lead to massive
performance issues with task processing.

It is almost impossible to deprecate this in a staged fashion because
various APIs use the methods and it is not possible to determine which
are API uses and which are other valid uses.

In reality there has been little-to-no uptake on the use of this feature
and it should just be removed.
2024-04-12 12:34:20 +08:00
Huong Nguyen
ca449af186
Merge branch 'MDL-81351-main-enfix' of https://github.com/mudrd8mz/moodle 2024-04-10 13:54:56 +07:00
meirzamoodle
ce5b7edd5c MDL-81366 redis: Remove the named parameters
Unfortunately, the read_timeout named parameter was not recognized on some machines.
To avoid such errors, this patch removed the named parameter on a single Redis connect() and the Redis cluster.
2024-03-28 10:19:35 +07:00
Helen Foster
dccc91f4bc MDL-81351 lang: Import fixed English strings (en_fix) 2024-03-26 23:13:15 +01:00
meirzamoodle
c700e4f8a9 MDL-63128 core_cache: Add new is_cluster_available helper
The ::is_cluster_available() will return true if the PHP support redis cluster.
2024-03-25 12:47:40 +07:00
meirzamoodle
6a28e0641e MDL-63128 cachestore_redis: Support Redis cluster as cache store
Co-authored-by: Daniel Thee Roperto <daniel@theeroperto.com>
Co-authored-by: Avi Levy <avi@sysbind.co.il>
2024-03-25 12:47:40 +07:00
Eloy Lafuente (stronk7)
361dfe8145
MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces:
- https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
- https://www.php.net/manual/en/reflectionproperty.setaccessible.php
- https://www.php.net/manual/en/reflectionmethod.setaccessible.php

As of PHP 8.1.0, calling this method has no effect; all methods are
invokable by default. So, let's remove all uses from core, they are
no-op.
2024-03-10 21:15:00 +01:00
Eloy Lafuente (stronk7)
29a541724f
MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +01:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Dmitrii Metelkin
68c725f8b1 MDL-79185 cache: don't throw exception if cache data is corrupted 2023-11-22 12:45:48 +11:00
Huong Nguyen
5e0b16fa29 MDL-66546 caching: Improve Redis help text 2023-11-08 11:17:45 +07:00
Juan Carrera
63a7ce5108 MDL-66546 caching: Add support to unix:// connections to redis. 2023-11-02 16:04:54 +01:00
Jun Pataleta
94bc2cd38b
MDL-79551 versions: bump all versions and requires near release 2023-10-04 13:57:17 +08:00
sam marshall
0f8577784d MDL-78467 core_cache: Improve cache locking API
* Makes it possible to safely call acquire_lock so that it throws an
  exception instead of returning false if it can't get a lock (which
  most existing uses assumed it already does).
* Fix some omissions from the requirelockingbeforewrite option (it
  now checks on delete).
* Modinfo uses a versioned cache, so it is not necessary to delete
  items, only increase the version. (Provided we keep track of
  cacherev carefully...)
2023-09-14 09:28:10 +01:00
Ilya Tregubov
4fa5a40f34
Merge branch 'MDL-76865-master' of https://github.com/daledavies/moodle 2023-09-06 14:48:15 +08:00
Ilya Tregubov
b327210cd2
Merge branch 'MDL-78615' of https://github.com/paulholden/moodle 2023-08-29 13:32:46 +08:00
Brendan Heywood
482758b1df MDL-79150 cache: Improve requirelockingwrite error 2023-08-24 10:39:12 +10:00
Paul Holden
8462e7880d
MDL-78615 cache: display failure notifications deleting lock/store. 2023-08-21 10:45:11 +01:00
Dale Davies
af91ae626a MDL-76865 core: Check lock state before attempting to acquire a lock 2023-08-14 12:34:14 +01:00
sam marshall
8df2ac4e98 MDL-78109 core_cache: Remove harmful requirelockingwrite/read options
These cache options are not used in core and would cause a performance
cost without any benefit if ever used. Also they don't work properly.
2023-07-12 15:33:15 +01:00
Andrew Nicols
d1effac984
Merge branch 'MDL-78552' of https://github.com/skodak/moodle 2023-06-29 11:34:53 +08:00
Srdjan
38076e5a0d MDL-72622 core: Support TLS for redis cache connections 2023-06-27 09:49:33 +10:00
Petr Skoda
3c25ccdcd1 MDL-78552 core: tidy up MDL_PERF constants
* all constans usable in ABORT_AFTER_CONFIG should be always defined
* MDL_PERFDB and $PERF->logwrites not used after legacy log removal
* MDL_PERF_TEST should be documented in codebase
* deprecated warnings in shutdowb manager
2023-06-25 08:39:09 +02:00
Andrew Nicols
c40cf46b22 Merge branch 'MDL-78004_master' of https://github.com/mwehr/moodle 2023-06-22 14:29:41 +02:00
Sara Arjona
8d050aa330 Merge branch 'MDL-69653' of https://github.com/paulholden/moodle 2023-06-14 17:49:49 +02:00
Paul Holden
c21a4aebeb
MDL-69653 cache: final removal of deprecated lock methods. 2023-06-14 16:19:57 +01:00
Andrew Nicols
5138f02dd3
MDL-78466 cache: Add new result_found helper
This helper is intended to prevent recurrences of this issue by moving
the guess-work to something well tested.
2023-06-14 11:58:12 +08:00
Andrew Nicols
5c6ebcd5f5
MDL-78466 cache: Perform strict test on static cache values
If a statically accelerated cache returns an empty array then the value
was still fetched from the non-static cache store.

The check of the `$result` should be strictly checked against `false`,
which is the value used if no value was found.
2023-06-14 09:28:53 +08:00
Jun Pataleta
0dce9fe077 Merge branch 'MDL-76745_master' of https://github.com/marxjohnson/moodle 2023-06-07 22:54:27 +08:00
Mark Johnson
09cf1b8818 MDL-76745 cache: Implement cache_loader_with_locking in cache_disabled
If a plugin attempts to do something that would lock coursemodinfo cache
during install (such as creating a course module), this currently fails
as check_lock_state is not implemented in cache_disabled. Adding the
cache_loader_with_locking interface ensures that all lock methods are
implemented.
2023-06-01 15:03:01 +01:00
Jun Pataleta
71216a0b1d Merge branch 'MDL-78092-master' of https://github.com/sammarshallou/moodle 2023-06-01 11:36:44 +08:00
Jonathan Champ
e32cf94b9b MDL-78383 cache: Remove unused class property configlockmappings 2023-05-30 19:46:03 -04:00
Wehr Mario
fbe936cef7 MDL-78004 cache: Fix deprecated null value in Redis connect 2023-05-26 13:25:19 +02:00
sam marshall
a2af6bd669 MDL-78092 Cache: Modinfo locking with Redis store does not work
The feature added in 4.1 to lock the modinfo cache does not work when
using Redis, because:

* The API to acquire a cache lock is confusing, and the code did not
  check that it successfully acquired a lock before going on to build
  the cache anyway.

* Unlike the other types of cache lock, the Redis store did not retry
  the lock for a timeout period before giving up and failing.

This change fixes both points.
2023-05-22 10:43:14 +01:00
Meirza
691d80fdae MDL-77350 cache: Added class properties that are not declared
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-05-16 00:33:20 +07:00
Eloy Lafuente (stronk7)
061c9d7ba0 MDL-77940 versions: bump all versions and requires near release
version = 2023042400 release version
requires= 2023041800 current rc1 version
2023-04-18 18:08:09 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Ilya Tregubov
25254ceea3 Merge branch 'MDL-77163-master' of https://github.com/andrewnicols/moodle 2023-03-08 17:28:13 +08:00
Andrew Nicols
8ae5ebb507 MDL-77163 cachestore_mongodb: Remve from core 2023-02-28 22:24:04 +08:00
sam marshall
a3b1e3b4ee MDL-76784 core_cache: versioned cache (modinfo) can fail in install
When cache is disabled but temporary in-memory caches are allowed,
these were direct instances of cachestore_static with no loader, which
meant that the get_versioned and set_versioned functions did not work.
2023-02-21 10:40:23 +00:00
Andrew Nicols
6d31626130 Merge branch 'MDL-76791-master' of https://github.com/sammarshallou/moodle 2023-02-16 10:53:25 +08:00