1006 Commits

Author SHA1 Message Date
Paul Holden
3bfb7f759a
MDL-76838 backup: remove invalid utf8 code sequences writing XML.
The surrogate blocks FFFE and FFFF are non-characters, specifically
disallowed in the character range for XML documents.
2023-05-22 21:04:02 +01:00
Mark Johnson
b6b48be55d MDL-75696 backup: Fix backup version checks
Several version checks were incorrectly using
restore_controller::info::moodle_release instead of moodle_version as a
version number. This replaces all of those checks with a common pair of
methods to make the checks clearer and more maintainable.
2023-05-18 15:53:35 +01:00
Julien Boulen
5a6ea11dda MDL-77986 backup: trim extra white spaces on search forms 2023-05-17 16:29:38 +02:00
Andrew Nicols
6a417a3632
MDL-77168 backup: Switch from YUI to confirmation modal 2023-05-12 15:21:20 +08:00
Paul Holden
1dbeca84f6
MDL-77313 restore: re-add field to indicate course/category search.
When the two restore forms for searching courses and categories were
converted to core templates in eb9935c9 they lost the named submit
button, which broke searching.
2023-04-24 11:04:20 +01:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Paul Holden
1f6722e696
Merge branch 'MDL-77254-master' of https://github.com/sarjona/moodle 2023-04-04 17:36:51 +01:00
Sara Arjona
1996a7cfbf MDL-77254 backup: Backup/restore xAPI state 2023-04-04 17:23:43 +02:00
Meirza
8a5485a714 MDL-77338 backup: 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-04-03 22:39:39 +07:00
Andrew Nicols
9ec46c232d MDL-77186 core: Move all uses of cronlib to new class 2023-03-13 21:21:13 +08:00
Jun Pataleta
8441270181 Merge branch 'MDL-77559-master-2' of https://github.com/andrewnicols/moodle 2023-03-09 16:02:01 +08:00
Andrew Nicols
5ae44ff9d3 Merge branch 'MDL-77467' of https://github.com/timhunt/moodle 2023-03-09 10:46:36 +08:00
Andrew Nicols
511401f4f6 MDL-77559 js: Rebuild all JS with Node 16 2023-03-09 09:53:19 +08:00
Tim Hunt
497c527e98 MDL-77467 retore: add progress tracking to potentially slow steps 2023-03-02 15:36:28 +00:00
Jun Pataleta
916503658d Merge branch 'MDL-75012-master-5' of https://github.com/andrewnicols/moodle 2023-03-02 12:34:34 +08:00
Andrew Nicols
33b1e41f13 MDL-75012 js: Full build of all grunt things 2023-03-02 11:55:32 +08:00
Jun Pataleta
6802f6b7f4 Merge branch 'MDL-76938_restore_comments' of https://github.com/davosmith/moodle 2023-03-02 08:42:15 +08:00
Marina Glancy
c184b2d284 MDL-68347 course: trigger event if user was created during restore 2023-02-20 10:20:00 +00:00
Davo Smith
b395c3f63b MDL-76938 backup: fix restore of comments linked to a course format 2023-01-26 12:31:13 +00:00
Sara Arjona
ae53d04144 Merge branch 'MDL-75337-master' of https://github.com/laurentdavid/moodle 2023-01-24 16:07:35 +01:00
Laurent David
fc72a1d7b1 MDL-75337 core: Single button - core changes
* Change all core calls toward single_button to use single_button::BUTTON_PRIMARY
    when needed
2023-01-24 06:01:35 +01:00
Andrew Nicols
7000a99de3 MDL-76362 core: Coding style fixes 2023-01-23 09:15:55 +08: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
Andrew Nicols
425d4f2583 Merge branch 'MDL-75573' of https://github.com/paulholden/moodle 2022-12-06 13:54:26 +08:00
Paul Holden
be83010d4f MDL-75573 backup: translate async operation type in messages. 2022-12-01 19:48:29 +00:00
Paul Holden
e5c6575bbd MDL-75789 restore: multi-byte safe substring calculating course names.
Co-authored-by: Leon Stringer <leon.stringer@ntlworld.com>
2022-11-29 08:32:22 +00:00
Paul Holden
8aaede0e7d MDL-75862 backup: omit sesskey for continue buttons using get method.
It's automatically added by the rendered single_button instance when
using post method, so no need to add it unconditionally.
2022-11-10 10:17:04 +08:00
Sara Arjona
4cf81fd3c2 Merge branch 'MDL-73030' of https://github.com/paulholden/moodle 2022-10-24 15:47:21 +02:00
Marina Glancy
41b93bd7e5 MDL-73424 general: Internal methods must have same type as parent
Otherwise the error is thrown in PHP8.1
2022-10-10 16:46:13 +02:00
Paul Holden
65f9976478 MDL-73030 backup: case-insensitive detection of Moodle backups. 2022-10-03 09:32:17 +01:00
David Mudrák
aa49eb24fb MDL-75553 lang: Fix Behat regressions in scenario files 2022-09-06 21:47:18 +02:00
Philipp Memmel
9a8e108655 MDL-75092 backup: Fix selector for adding select all/none link 2022-08-19 17:17:29 +02:00
Andrew Nicols
b32b4865c0 Merge branch 'MDL-73788-master' of https://github.com/andelacruz/moodle 2022-07-26 11:37:51 +08:00
Angelia Dela Cruz
2b28996a2e MDL-73788 behat: URL behat generators use UI
Replace steps that manually add URL instances via the UI and use
Behat generators. This improves the speed of Behat test runs.
2022-07-18 17:40:22 +08:00
Iñigo Zendegi
919ea1dde1 MDL-74857 language: Start using the 'statusok' string for status 2022-07-18 10:55:47 +02:00
Cameron Ball
07e5f432a0 MDL-74548 backup: Deprecate core_backup\copy\copy 2022-06-29 09:14:02 +08:00
Cameron Ball
bc9c536335 MDL-74548 backup: Unit tests for course copy refactor 2022-06-29 09:13:29 +08:00
Cameron Ball
29df52af19 MDL-74548 backup: Refactor course copies
This patch modifies the way copy data is shared in order to mitigate potential race conditions
and ensure that the serialised controller stored in the DB is always in a valid state.

The restore controller is now considered the "source of truth" for all information about the
copy operation. Backup controllers can no longer contain information about course copies.

As copy creation is not atomic, it is still possible for copy controllers to become orphaned or
exist in an invalid state. To mitigate this the backup cleanup task has been modified to call
a new helper method copy_helper::cleanup_orphaned_copy_controllers.

Summary of changes in this patch:

    - Copy data must now be passed through the restore controller's constructor
    - base_controller::get_copy has been deprecated in favour of restore_controller::get_copy
    - base_controller::set_copy has been deprecated without replacement
    - core_backup\copy\copy has been deprecated, use copy_helper.class.php's copy_helper instead
    - backup_cleanup_task will now clean up orphaned controllers from copy operations that went awry

Thanks to Peter Burnett for assiting with testing this patch.
2022-06-29 09:13:29 +08:00
Nathan Mares
1da1152baa MDL-72723 logs: Add get_events_select_exists to the sql_reader interface
- Updates to log stores and backup helper to improve performance when
  checking if a course has been modified.
- This is a breaking change as it adds a new function on the sql_reader
  interface.

Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
2022-05-30 10:42:47 +10:00
Jake Dallimore
be4352bd3e Merge branch 'MDL-73801' of https://github.com/paulholden/moodle 2022-05-26 12:10:18 +08:00
Peter Burnett
3801662e97 MDL-71198 backup: Change times on restore file duplication 2022-05-25 22:18:36 +08:00
Paul Holden
cf57505ce7 MDL-73801 backup: set predictably ordered backup next start time.
Prior to this change, the testcase would assert ordering based on
identical fields which could lead to random failures. Set distinct
next start time of course backup, and also remove random ordering
by sorting on defined course order (all other fields being equal).
2022-05-19 08:18:06 +01:00
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
Andrew Nicols
4b388fc239 MDL-74235 core: Update core uses of activity icons to monologo 2022-04-07 12:56:14 +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
Mihail Geshoski
5a1e70573d MDL-73169 core_backup: Update course category breadcrumb nodes 2022-03-02 17:27:38 +08: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
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Eloy Lafuente (stronk7)
00b10bbb31 MDL-72762 backup: Accept empty and whitespace-only UI labels.
This was causing problems when sections or activity names where
set to be empty or whitespace-only, with the PARAM_CLEANHTML
leading to exception.

Now they are supported and handled like &nbsp; (0xc2a0) to
allow the process to continue.

Added a few extra tests to confirm the behaviour.
2022-02-11 23:50:34 +01:00