533 Commits

Author SHA1 Message Date
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
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
David Woloszyn
02418cc093 MDL-75454 cache: Reduced exposure of sesskey param 2023-02-14 11:25:49 +11:00
Andrew Nicols
7bf57d9850 MDL-77161 cachestore_memcached: Remove from core 2023-02-07 21:42:50 +08:00
sam marshall
3353aecc8b MDL-76791 core_cache: Locking breaks for multiple-identifiers store
Cache locking fails if the cache store supports multiple identifiers
(in core, the only two which do are cachestore_static and
cachestore_mongodb, so this is unlikely to cause severe problems).
2023-02-06 15:46:17 +00:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Jun Pataleta
db2ee34986 Merge branch 'MDL-76506' of https://github.com/jrchamp/moodle 2023-01-09 19:34:07 +08:00
Sara Arjona
3dd93ffc5e Merge branch 'MDL-76617' of https://github.com/stronk7/moodle 2022-12-28 12:42:12 +01:00
Eloy Lafuente (stronk7)
47435471ee MDL-76617 store_mongodb: Adjust moodle to mongo-php-library to v1.15.0
The new library version should work without problems with older
php-mongodb extension versions:
- v1.15.0 (paired version, tested).
- v1.14.1 (tested)

But, in order to keep them paired, the requirements have been
raised to the extension v1.15.0. See:

https://www.mongodb.com/docs/drivers/php/#compatibility
2022-12-22 19:36:36 +01:00
Eloy Lafuente (stronk7)
c5efd54971 MDL-76617 store_mongodb: Update mongo-php-library to v1.15.0
This updates the library from v1.13.1. Fixes some php81 warnings
leading to failed/risky tests.

The new library version should work without problems with older
php-mongodb extension versions:
- v1.15.0 (paired version, tested).
- v1.14.1 (tested)
2022-12-22 19:36:36 +01:00
sam marshall
0b2c2a1f95 MDL-76129 upgrade: Allow caching in specific functions
During install/upgrade, caching is disabled. This change provides a
way to temporarily enable caching (using in-memory cache storage only)
within a specific function; caches are deleted afterwards.

Adding this to two locations improves install performance quite a lot.

Caching is not enabled during the parts of plugin installation that
can vary for individual plugins (install.php/upgrade.php) as these
might be relying on its absence, for example by making direct database
changes.
2022-12-22 11:05:45 +00:00
Andrew Nicols
0646f7ea5a Merge branch 'MDL-76183-master' of https://github.com/davewoloszyn/moodle 2022-12-01 08:55:34 +03:00
Andrew Nicols
b1e77fe1f3 Merge branch 'MDL-76218-master' of https://github.com/sammarshallou/moodle 2022-12-01 08:55:34 +03:00
David Woloszyn
126028cc76 MDL-76183 lib: Update Github URLs 2022-11-30 14:01:31 +11:00