277 Commits

Author SHA1 Message Date
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
fad05d7929 Merge branch 'MDL-76583-master-withoutrename' of https://github.com/andrewnicols/moodle 2023-01-19 09:44:48 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Paul Holden
af8da7c737 MDL-70070 phpunit: correct data provider method names.
They should not be prefixed `test_` because that's how actual
test methods containing assertions are identified by PHPUnit.
2023-01-16 08:28:37 +00:00
Marina Glancy
594a8c5ab7 MDL-76356 various: avoid implicit conversion to arrays
PHP before version 8.1 automatically converted stdClass or 'false' to arrays if
function parameter expects array (for example, "reset").
PHP 8.1 shows notices in these situations
2023-01-10 12:16:52 +01:00
Amaia Anabitarte
2d1883c92e MDL-76004 core_h5p: Ensure the browser is serving updated file 2022-12-14 16:02:44 +01:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Sara Arjona
3b7d1a2f23 NOBUG: Fixed SVG browser compatibility 2022-11-11 15:05:55 +01:00
Jake Dallimore
c5c85cce43 Merge branch 'MDL-73853-master' of https://github.com/sarjona/moodle 2022-11-11 11:29:08 +08:00
Sara Arjona
f23fe5195a MDL-73853 core_h5p: Improve behat tests, to avoid random errors
An improvement has been added to the H5P tests to avoid random errors
due to the fact that H5P content needs a while to be displayed.

Co-author: Ferran Recio <ferran@moodle.com>
2022-11-09 14:04:41 +01:00
Sara Arjona
288963e526 MDL-73853 core_h5p: Add core lib changes after upgrading it 2022-11-08 17:09:00 +01:00
Sara Arjona
7ea2b6bfa1 MDL-73853 core_h5p: Upgrade core lib to moodle-1.22.4 2022-11-08 17:09:00 +01:00
Sara Arjona
d611cdff9d MDL-73853 core_h5p: Disable H5P hub
Although we're not currently supporting the H5P Hub, the hubIsEnabled
setting was set to true (probably by mistake).
It has been changed to false by default because the new version of
the H5P editor library is causing some errors otherwise.
2022-11-08 17:09:00 +01:00
Sara Arjona
7c4ede9280 MDL-73853 core_h5p: Add editor lib changes after upgrading it 2022-11-08 17:09:00 +01:00
Sara Arjona
b9ed63b470 MDL-73853 core_h5p: Upgrade editor lib to moodle-1.22.4 2022-11-08 17:09:00 +01:00
Eloy Lafuente (stronk7)
56e5b69930 MDL-72979 general: Remove any reference to the git:// protocol
Trivial change, only point is that, for the h5p library it was
agreed that it's better to just remove the "sample" directory
completely when importing the library.
2022-11-08 16:49:26 +01:00
Eloy Lafuente (stronk7)
0ed53be9b2 MDL-66902 tests: Fix all incorrect namespaces
This issue just goes over all the currently incorrect
namespaces in test cases and:

1. Change the namespace to the correct one.
2. Move/rename it to correct location if needed (level 2 and down).
3. Remove not needed MOODLE_INTERNAL check when possible.
4. Remove file phpdoc when the file only has one class.
5. Make small adjustments in case the change of namespace requires it.
2022-09-26 14:12:16 +02:00
Paul Holden
b40ab6987d MDL-75326 h5p: require sesskey to toggle library enabled state. 2022-08-12 04:14:18 +02:00
Jun Pataleta
29d804b302 Merge branch 'MDL-74895' of https://github.com/paulholden/moodle 2022-08-04 11:35:47 +08:00
Paul Holden
426f533c07 MDL-74895 h5p: more resilient error handling during content fetching.
On new installs, the task for downloading new H5P content types would
throw exceptions and exit when encountering unexpected and/or missing
data.
2022-07-25 20:03:12 +01: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
Jun Pataleta
d4ba0359cf MDL-72885 core: Use get_html_lang_attribute_value()
Use get_html_lang_attribute_value() for formatting language codes
for the HTML lang attribute.
2022-05-27 19:38:54 +08:00
Eloy Lafuente (stronk7)
caf55abf17 MDL-74413 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:

- Moved to the level2 "privacy" namespace:
  - \mod_assign\privacy\feedback_legacy_polyfill_test
  - \mod_assign\privacy\submission_legacy_polyfill_test

- Moved to the level2 "task" namespace:
  - \core_message\task\migrate_message_data_test
  - \ltiservice_gradebookservices\task\cleanup_test
  - \message_email\task\send_email_test
  - \mod_lti\task\clean_access_tokens_test
  - \mod_workshop\task\cron_task_test

- Moved to the level2 "event" namespace:
  - \core_h5p\event\deleted_test
  - \core_h5p\event\viewed_test

- Renamed to a better name:
  - backup_forum_activity_task_test.php (missing "task")
2022-05-07 20:32:30 +02:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Paul Holden
4102ae35a4 MDL-74283 dml: replace hardcoded concat SQL with appropriate API. 2022-03-22 17:33:03 +00:00
Sara Arjona
ae935e8349 Merge branch 'MDL-74123_h5p_duplicate_file' of https://github.com/davosmith/moodle 2022-03-10 08:40:55 +01:00
Davo Smith
4202104a2e MDL-74123 h5p: delete any existing files when downloading new files 2022-03-08 13:52:26 +00:00
cescobedo
4025695552 MDL-71722 h5plib_v124: Add required changes after lib upgrade 2022-03-08 10:04:20 +01:00
cescobedo
1b5af6aa4f MDL-71722 h5plib_v124: Upgrade ckeditor to 4.17.1 2022-03-08 10:04:20 +01:00
Jun Pataleta
96e5418134 NOBUG: Fixed SVG browser compatibility 2022-03-03 17:51:51 +08:00
cescobedo
20fd467f35 MDL-73830 h5plib_v124: Add required changes after lib upgrade 2022-02-28 07:29:47 +01:00
cescobedo
20916ff72a MDL-73830 h5plib_v124: Upgrade H5P core library to 1.24.3 2022-02-28 07:23:39 +01:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Eloy Lafuente (stronk7)
5aa93e3066 Merge branch 'MDL-72466-master' of https://github.com/bmbrands/moodle 2022-02-02 12:10:18 +01:00
Bas Brands
7c76e1c349 MDL-72466 core_output: dropdown menu alignment 2022-01-27 17:24:20 +01:00
Bas Brands
068bb8ae8b MDL-73562 core_contentbank: alignment fixes 2022-01-25 09:35:07 +01:00
Eloy Lafuente (stronk7)
0c53a3dec8 MDL-73476 phpunit: events, external and search tescase names
All events_test, external_test and search_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- 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 lib/external/tests/external_test.php:
- external is not a valid component
- hence, its only valid namespace is "core"
- also, it's testing lib/external/externallib.php
- hence, the file (and class) have been renamed to external_externallib_test.php
  (to avoid conflicts with other external_test that may exist in core)
2022-01-14 16:18:39 +01:00
Eloy Lafuente (stronk7)
0098ebccbf MDL-73502 libraries: Avoid uses of get_magic_quotes_xxx() functions
They were deprecated in PHP 7.4 (warning) and have been removed in
PHP 8.0 (error). Plus they were returning false since ages ago (PHP
5.x).

Hence, adding conditional check to see if they are available (h5p
editor) or removing the unreachable code-block when they evaluated
to true.

Also, modified the corresponding moodle_readme files to document
the change.
2022-01-07 00:40:46 +01:00
Andrew Nicols
3a70983d53 MDL-72701 unit tests: Generate default coverage 2021-12-21 09:24:00 +08:00
Sara Arjona
9731e30123 Merge branch 'MDL-69467-master' of https://github.com/sebastianberm/moodle 2021-12-13 17:34:39 +01:00
Sebastian Berm
e0753cb080 MDL-69467 core_h5p: User uniqueness by id instead of email 2021-12-10 14:36:45 +01:00
Eloy Lafuente (stronk7)
deb0e76eee MDL-73278 phpunit: Rename already namespaced classes to match file name
These are the only cases 100% safe to apply the renaming of the
testcase class names to match the file names.

All other cases are not safe, because they are missing namespace
and may enter into name conflicts. Adding namespaces is not as
simple as imagined because it implies to, also, add a good number
of modifications to core. See the issue for more details.
2021-12-07 23:54:29 +01:00
Sara Arjona
eb4e36400e MDL-71956 core_h5p: Add more scenarios to can_edit_content
The method can_edit_content() now supports more scenarios where the
H5P content can be edited:
- Instead of supporting only mod_h5pactivity, now it supports any
mod or block when the user has the addinstance capability.
- If the component implements the can_edit_content method in the
h5p\canedit class and it returns true. For instance, the mod_forum
implements it and return true when filearea is post, if the user
can edit the post where the H5P is.
2021-11-09 16:47:18 +01:00
Mikhail Golenkov
4c7bf9eb7e MDL-70323 core_h5p: Add H5P crossOrigin setting 2021-10-24 21:21:58 +11:00
Eloy Lafuente (stronk7)
87e7bcb12a Merge branch 'MDL-71970-master' of git://github.com/sarjona/moodle 2021-09-29 23:27:15 +02:00
sam marshall
e332d1849d MDL-72643 core: Improve display_size
Allows display_size to use a fixed unit for easy comparison of
multiple results, and fixed decimal places for the same reason.

Improves behaviour by using consistent decimal places and a
consistent space before the unit (the previous one only has a space
before 'bytes', not before 'KB').

Of existing uses, all the ones that displayed a 'maxbytes' type
configuration setting (which are likely to have an 'exact' size
and would be better shown as 512 KB rather than 512.0 KB) have been
changed to use 0 decimal places, to preserve previous behaviour.
All the uses which were showing an actual file or memory size have
been left as default (1 decimal place).
2021-09-27 16:52:33 +01:00
Sara Arjona
f47a327290 MDL-71970 h5plib_v124: Replace references to new Moodle\H5Pxxx namespace
The joubel/core and joubel/editor libraries have been moved to Moodle
namespace.
This commit adds the new namespace to the places where these classes
are used.
Besides, a couple of minor changes have been done to replace the _test.php
classname and remove some unnecessary defined('MOODLE_INTERNAL').
2021-09-27 11:41:48 +02:00
Sara Arjona
c1b4a4a97e MDL-71970 h5plib_v124: Add namespace to H5P editor library
The joubel/editor is a third-party library. A namespace has been added to
avoid collision with other plugins using it (such as mod_hvp).
That way, they will be able to have a different version without
side effects.
2021-09-27 11:41:48 +02:00