511 Commits

Author SHA1 Message Date
Andrew Nicols
61a36cf0f8
MDL-84124 cache: Purge Redis cache between tests 2025-01-09 08:00:58 +08:00
Andrew Nicols
5be481d1d0
MDL-81520 core: Fix test finality 2024-12-11 12:30:21 +08:00
Andrew Nicols
3d51aed3e2
MDL-81521 core: Update all possibly data providers to be static
Note: Some data providers could not be automatically be converted to
being static. These will be handled in a separate issue.
2024-11-19 09:30:51 +08:00
Dale Davies
9ccd794b36
MDL-80385 core: Check lock state before attempting to acquire a lock
This is a cherry-pick of the same change from MDL-76865, which was
accidentally reverted in MDL-79428.
2024-03-13 13:56:49 +00:00
Dmitrii Metelkin
402153c46e MDL-79185 cache: don't throw exception if cache data is corrupted 2023-11-22 12:47:57 +11:00
Ilya Tregubov
109879a2a1
Merge branch 'MDL-79428-401' of https://github.com/srobotta/moodle into MOODLE_401_STABLE 2023-10-03 09:41:21 +08:00
Stephan Robotta
f9432283a9 MDL-79428 license: upgrading cc core licenses to version 4.0
The short name of the cc licenses are trailed with a suffix containing
the version number (current 3.0 and 4.0). The old cc* licenses become
the new cc-*-3.0 licenses and are disables, because the new cc*-4.0
licenses are the current ones.

This is a backport of MDL-43195.
2023-09-29 09:39:18 +02:00
sam marshall
f6f0787fc8 MDL-79349 core_cache: Lock on multi-layer cache can behave incorrectly 2023-09-14 09:32:09 +01:00
Ilya Tregubov
633d64262d
Merge branch 'MDL-76865-401' of https://github.com/daledavies/moodle into MOODLE_401_STABLE 2023-09-06 14:49:02 +08:00
Paul Holden
b971d76406
MDL-78615 cache: display failure notifications deleting lock/store. 2023-08-21 10:45:23 +01:00
Dale Davies
ddd260ffa4 MDL-76865 core: Check lock state before attempting to acquire a lock 2023-08-14 12:36:45 +01:00
Andrew Nicols
4e7a476651 Merge branch 'MDL-78004_401' of https://github.com/mwehr/moodle into MOODLE_401_STABLE 2023-06-22 14:37:45 +02:00
Jun Pataleta
302d6f2a3e Merge branch 'MDL-78466-401' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE 2023-06-14 16:05:55 +08:00
Andrew Nicols
fdf7ea57f0
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 09:35:40 +08:00
Andrew Nicols
02652c7651
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:48 +08:00
Jun Pataleta
3b8e3ba59e Merge branch 'MDL-76745_401_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_401_STABLE 2023-06-07 22:53:45 +08:00
Mark Johnson
dfdf8ba7c9 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:33 +01:00
Wehr Mario
d7194d3de0 MDL-78004 cache: Fix deprecated null value in Redis connect 2023-05-26 13:22:35 +02:00
sam marshall
79d0e63b18 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:45:13 +01:00
Eloy Lafuente (stronk7)
7aeb3a8b6e MDL-77097 store_mongodb: keep compatibility with PHP 7.4
Replaced 4 occurrences of get_debug_type() by gettype() to keep PHP 7.4 compatibility. Note this
has not been applied to 4.2dev and up because, there, it's safe to use get_debug_type().
2023-02-24 12:38:47 +01:00
Andrew Nicols
de285364c5 Merge branch 'MDL-76791-m401' of https://github.com/sammarshallou/moodle into MOODLE_401_STABLE 2023-02-16 10:53:39 +08:00
David Woloszyn
a869fbf33e MDL-75454 cache: Reduced exposure of sesskey param 2023-02-14 11:28:51 +11:00
sam marshall
d2c0dd4f6b 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:47:25 +00:00
Marina Glancy
2dd7290ccb 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:16:06 +08:00
Jun Pataleta
1361e6ad92 Merge branch 'MDL-76506_m41' of https://github.com/jrchamp/moodle into MOODLE_401_STABLE 2023-01-09 19:33:59 +08:00
Eloy Lafuente (stronk7)
5db1ac4e98 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)

So, here, in 401_STABLE, we aren't raising the requirements. We have
done that in master, in order to get php82 support, but not here. For
more details about compatibilities, see:

https://www.mongodb.com/docs/drivers/php/#compatibility
2022-12-22 19:36:40 +01:00
Eloy Lafuente (stronk7)
c22b39a650 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:40 +01:00
David Woloszyn
0be376fdc0 MDL-76183 lib: Update Github URLs 2022-12-01 08:59:05 +03:00
sam marshall
be11ee3383 MDL-76218 cachestore_redis: delete_many can fail with no keys
In some cases, we get an error message such as:

Wrong parameter count for Redis::zRem()

Within the delete_many function. This function requires at least one
key to be supplied, but if delete_many is called with an empty array,
we will call it with no keys.
2022-12-01 08:59:05 +03:00
Jonathan Champ
181ecedb11 MDL-76506 cache_application: Fix MDL_PERF and perfdebug checks 2022-11-29 13:28:05 -05:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Jun Pataleta
5339a96f45 Merge branch 'MDL-75481-master' of https://github.com/kevpercy/moodle 2022-11-04 12:06:38 +03:00
Mark Johnson
67c7ed25e3 MDL-76076 cache: Add locking before write for parent caches 2022-10-31 13:55:54 +00:00
Mark Johnson
045ee091da MDL-67020 Cache: Make locking work for local file caches
* Add new requirelockingbeforewrite flag for cache definitions
* Implement native locking in cachestore_file (leveraging
file_lock_factory).
2022-10-20 11:31:33 +01:00
Mark Johnson
c06fc0648d MDL-67020 Cache: Release locks in cache_application::get_many() 2022-10-19 09:04:33 +01:00
Kevin Percy
25ad0a2cba MDL-75481 lib: Update MongoDB library references to 1.13.1 2022-10-17 11:58:05 +08:00
Kevin Percy
8ab37cea82 MDL-75481 lib: Updated MongoDB files to 1.13.1 2022-10-13 15:22:01 +08:00
Jun Pataleta
45a44ec0f0 Merge branch 'MDL-71531-master' of https://github.com/andrewnicols/moodle 2022-09-27 16:30:23 +08:00
Andrew Nicols
d51d901215 MDL-71531 cachestore_file: Stop locking cache files to read
The cache file is only ever written to in the `write_file` function,
where it does so by writing to a temp file and performing an atomic
rename of that file. When writing, the target file is never locked.

The cache file is only ever read in the `get` function, and there is no
need for an exclusive lock in that situation.

There is therefore no need to obtain any lock, shared or exclusive, to
read the cache file. Doing so only affects performance of the file sytem
as file locks must be needlessly obtained and written to disk for a read
operation which does not benefit from them.
2022-09-15 10:13:32 +08:00
sam marshall
4ab9f08ce0 MDL-75369 Redis: Remove unnecessary ping after connect
The Redis cache store and session handler both do a 'ping()' after
connecting to Redis. This is unnecessary because the connect() call
has just checked the network connection and it's hardly likely that
the server has gone down since then.

According to my profiling, both connect() and ping() take
measurable time when talking to a separate server, i.e. a few
milliseconds. So it's not the case that connect() doesn't really
talk to the server, as I initially wondered.

If using Redis on a separate (non-localhost) server for both session
and cache store, removing these ping calls can save a millisecond
or two per request.
2022-09-13 10:45:00 +01:00
Brendan Heywood
7f63314383 MDL-75375 cache: Fix file store path cleaning 2022-08-09 23:50:51 +08:00
Andrew Nicols
547cae0a02 MDL-74697 libraries: Update all third-party libraries with more metadata 2022-07-22 07:28:47 +02:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Eloy Lafuente (stronk7)
9f53b0e965 MDL-73971 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- Some fixtures, initially defined in the test files have been
  moved to new files in fixtures subdirectory, leaving the unit
  test files clearer:
  - moodle2_course_format_test.php
- Rename wrong named test:
  - baseoptiogroup_test = baseoptigroup_test
2022-05-06 18:29:11 +02:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Andrew Nicols
0098da8239 Merge branch 'MDL-74438-master' of https://github.com/cameron1729/moodle 2022-04-08 11:03:43 +08:00
Cameron Ball
8937de6f40 MDL-74438 cache: Check if cached value is boolean false 2022-04-06 17:14:52 +08:00
sam marshall
896d0c225a MDL-74285 cachestore_redis: Unable to delete a Redis cache instance
When deleting a cache instance, it tried to purge it, even though
purge only makes sense for an individual definition (not the whole
instance). As a result, it errored.
2022-04-01 17:40:41 +01:00
Sujith Haridasan
1bb972ae0a MDL-73848 administration: Add tests for breadcrumbs and nav highlights
This change includes addition of tests for verifying the secondary
and tertiary nav highlights.
It also includes the tests to verify the breadcrumbs for the pages.
2022-03-25 17:44:58 +08:00
Sujith Haridasan
aa1c2e2382 MDL-73848 administration: Fix the breadcrumbs and nav highlights
Create or update the breadcrumbs in the site administration
pages where it is required.
Highlight the corresponding site adminstration tab.
Highlight the primary nav to Site administration when user
is navigating to any of the site administration pages.

Also changed the boostnavbar so that the nodes in the secondary
navigation are not shown in the breadcrumbs when user is in site
administration page.
2022-03-25 17:44:47 +08:00