235 Commits

Author SHA1 Message Date
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
Srdjan
38076e5a0d MDL-72622 core: Support TLS for redis cache connections 2023-06-27 09:49:33 +10:00
Andrew Nicols
c40cf46b22 Merge branch 'MDL-78004_master' of https://github.com/mwehr/moodle 2023-06-22 14:29:41 +02: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
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
Andrew Nicols
8ae5ebb507 MDL-77163 cachestore_mongodb: Remve from core 2023-02-28 22:24:04 +08:00
Andrew Nicols
7bf57d9850 MDL-77161 cachestore_memcached: Remove from core 2023-02-07 21:42:50 +08: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
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
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
sam marshall
5f5f922fd8 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-11-14 14:40:09 +00: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
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
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
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
Andrew Nicols
459c37755b Merge branch 'MDL-74072_master' of https://github.com/TomoTsuyuki/moodle 2022-03-21 22:30:32 +08:00
Eloy Lafuente (stronk7)
4003e31983 MDL-73785 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:

- When belonging to other components and being valid api:
  - analytics related tests have been moved to tests/analytics subdir.
  - backup & restore related tests have been moved to tests/backup subdir.
  - events related tests have been moved to tests/event subdir.
  - privacy related tests have been moved to tests/privacy.
  - task related tests have been moved to tests/task subdir.
- Some simple renames, not including the component part anymore (not
  needed now that they are namespaced):
  - some xxxlib_test.php have been renamed lib_test.php
    (when they where testing the corresponding lib.php).
  - cache stores tests have been all renamed store_test, originally
    each one had its own name (file_test, apcu_test, redis_test...)
  - assign feedback tests have been all renamed feedback_test, originally
    each one had its own name (file_test, editpdf_test...)
2022-03-03 12:19:30 +01:00
Tomo Tsuyuki
25a6a42477 MDL-74072 cachestore_redis: Add error check for envoy proxy 2022-03-03 17:16:52 +11:00
Helen Foster
7ff6b2daef MDL-73812 lang: Import fixed English strings (en_fix) 2022-02-18 15:50:26 +00:00
Jackson D'souza
18de3388f8 MDL-69088 cache: Make file cache store purge async 2022-02-03 10:30:09 +00:00
Eloy Lafuente (stronk7)
c11096576a Merge branch 'MDL-72619-master' of https://github.com/sammarshallou/moodle 2021-11-03 18:15:28 +01:00
sam marshall
9c29979b8b MDL-72596 core_cache: Track cache I/O size in perfdebug
For cache types which mean this information can be obtained without a
significant performance cost (i.e. just by calling strlen and not
having to serialize something that wasn't serialized already),
this change calculates the size of data read from or written to cache
in each request and includes it in the perfdebug table at bottom of
output (when that is turned on).

This supports the following cache types:

* File store
* Redis (only if caching is enabled)
2021-10-19 17:00:48 +01:00
sam marshall
1b94bb8c20 MDL-72619 core_cache: Provide admin page to view cache size estimates 2021-10-11 16:49:21 +01:00
sam marshall
8ddfa20121 MDL-72328 cachestore_redis: Add TTL support for Redis cache
A list of times for each cache key in a TTL cache is kept in a Redis
sorted list, which can be queried efficiently to delete expired
cache items later in a scheduled task.

This change makes set and delete 2x slower (only for caches which use
TTL) but there is no impact on get performance.
2021-09-21 13:43:11 +01:00
Eloy Lafuente (stronk7)
9d6aa39985 MDL-71583 versions: Add all the missing full-stops to version/requires
It seems that the new phpcs3 checker is now controlling those
line comments that previously were ignored.

This commit just looks for all the cases and bulk-add
them when needed. The bash script (mac) used to add all them is:

while read -r line; do
    arr=(${line//:/ })
    if [[ -n ${arr[0]} ]] && [[ -n ${arr[1]} ]]; then
        echo "  file ${arr[0]}, line ${arr[1]}"
        sed -i "${arr[1]}s/\$/\./" ${arr[0]}
    fi
done < <(find . -name version.php | xargs ag --nomultiline '>(version|requires) *=.*//.*[^;\.]$')
2021-05-11 20:11:07 +02:00
Marina Glancy
2d059d1657 MDL-70901 cache: @ no longer masks errors in unlink in php 8 2021-02-22 16:17:49 +01:00
Ferran Recio
e161edc97a MDL-70309 libraries: upgrade mongodb integration files 2021-01-22 14:41:12 +01:00
Ferran Recio
4b948f8a50 MDL-70309 libraries: upgrade mongodb to version 1.8.0 2021-01-22 14:41:12 +01:00
Michael Aherne
2385ae7ee2 MDL-65941 cache: Prevent cache config failure on redis problems. 2020-11-11 14:33:22 +08:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Eloy Lafuente (stronk7)
fbb0767536 MDL-69475 versions: bump all versions and requires in master
version = 2021052500 release version
requires= 2021052500 same than version

Why 20210525? (25th May 2021) ?

Because master is going to be Moodle 4.0, to be released
on November 2021. And, until then, we are going to have
a couple of "intermediate" releases:

- Moodle 3.10 to be released 9th November 2020. (2020110900)

  This version will be using versions from today to 2020110900
  (once it's released the YYYYMMDD part stops advancing).

- Moodle 3.11 to be released 10th May 2021. (2021051000)

  This version will be using versions from 3.10 release to 2021051000
  (once it's released the YYYYMMDD part stops advancing).

That means that all versions from today to 2021051000 are going
to be used by those 2 "intermediate" releases (3.10 and 3.11).

And we cannot use them in master, because it's forbidden to have
any overlapping of versions between branches (or different upgrade
paths will fail).

So, get that 2021051000, let's add it a couple of weeks to cover
the on-sync period (or a 2 weeks delay max!) and, the first version
that master can "own" in exclusive (without any overlap) is, exactly,
25th May 2021, hence our 20210525.
2020-08-18 00:47:15 +02:00
Eloy Lafuente (stronk7)
e69ab798dd MDL-68973 versions: Fix other small details
Thanks to Luca Bösch and Matteo Scaramuccia that detected
these 2 minor, but ugly details in core version files:

1) Adding comments pointed to versions (3.x, 20190801...) is not
   recommended, they easily come outdated.
2) Using plugin->release in core is no sense. Core plugins belong
   to the core release.

This commit just gets rid of them. That's all.
2020-06-09 20:27:30 +02:00
Eloy Lafuente (stronk7)
115cc0214f MDL-68973 versions: bump all versions and requires near release
version = 2020061500 release version
requires= 2020060900 current rc1 (week7roll1) version
2020-06-09 16:23:09 +02:00
Helen Foster
a753f4f9a1 MDL-67979 lang: Import fixed English strings (en_fix)
Significant string changes:

* configcustommenuitems,core_admin - corrected example
* custommenuitems_desc,tool_mobile - fallback behaviour of custom menu
  items in the app
2020-02-25 12:21:09 +01:00