3073 Commits

Author SHA1 Message Date
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
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Cameron Ball
2ac93db399 MDL-74548 backup: Deprecate get/set copy from base controller 2022-06-29 09:14:02 +08: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
Ilya Tregubov
df86854461 Merge branch 'mdl65478-fix-master' of https://github.com/matthewhilton/moodle 2022-05-03 15:43:53 +06:00
Jason den Dulk
ba53ec733a MDL-65478 backup, course format: Handle editor elements in course format
Modified course format options reading and writing to be able to handle Editor elements by enabling them to split array values into
multiple values before inserting into database, and combining multiple values into an array when reading from the database.
Modified backup and restore code to use backup_nested_elements, and to interact directly with the database.

Co-authored-by: Jason den Dulk <jasondendulk@catalyst-au.net>
Co-authored-by: Matthew Hilton <matthewhilton@catalyst-au.net>
2022-05-03 14:23:37 +10:00
Eloy Lafuente (stronk7)
3d709bb968 MDL-74509 backup: Bump release to 4.1 2022-04-22 18:45:05 +02:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Tim Hunt
839cccead4 MDL-74255 quiz: handle draft question status correctly
The main issue to fix is that questions vesions which should not have
been used (that is, hidden or draft versions) were getting offered
as an option and acutally being used.

As part of this I was able to substantially un-tangle
mod_quiz\question\bank\qbank_helper, which previously was
a mass of functions calling other functions in a complicated way.
Hopefully, it is now a bit easer to understand, and perhaps
less buggy.
2022-04-08 12:19:53 +01:00
Andrew Nicols
4b388fc239 MDL-74235 core: Update core uses of activity icons to monologo 2022-04-07 12:56:14 +08:00
Jun Pataleta
935a18f7b0 Merge branch 'MDL-73848-master' of https://github.com/junpataleta/moodle 2022-03-25 17:58:18 +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
Mathew May
4eb7094908 MDL-74049 navigation: Set active secondary node in course reuse areas 2022-03-22 09:53:01 +08:00
Eloy Lafuente (stronk7)
558f852ff8 Merge branch 'MDL-74007' of https://github.com/timhunt/moodle 2022-03-09 20:59:57 +01:00
Tim Hunt
61f11f848d MDL-74007 quiz: questions should start as 'Always latest' version
Thanks to Safat Shahin <safatshahin@catalyst-au.net> for help with
the Behat scenarios.
2022-03-04 10:59:13 +00: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
Eloy Lafuente (stronk7)
7a0d024e60 MDL-73659 phpunit: restore_date, api, rule, plugin, manager & helper
All restore_date_test, api_test, rule_test, plugin_test,
manager_test, helper_test 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:

- All restore_date_test cases have been put under xxx\backup
  level 2 (valid API) namespace.
2022-02-05 00:03:32 +01:00
Safat Shahin
3008edd366 MDL-71696 core_question: Implement question status change
This commit implements the status change pop up for a question
in the base view. This feature update will allow the change of
status of a question without creating a new version.
This commit also implements the status as a char rather than
an int value.
2022-02-03 22:22:50 +11:00
Safat Shahin
111951d861 MDL-71696 mod_quiz: quiz updates and behat coverage
The versioning changes will require some major changes
in the backup and restore of question bank and its
elements. This change introduces those changes to make
it compatible with the new world of versioning in question
bank. This commit also removes quiz_slots fields and
quiz_slot_tags table.
This commit will also introduce the versioning db
structure and some major changes to the quiz
and quiz attempts for the question, random
question and the view.
This commit implements the behat changes for versioning
in core question and associated locations.
2022-02-03 22:22:44 +11:00
Ilya Tregubov
57fe1a3099 Merge branch 'MDL-67853-master' of https://github.com/crazyserver/moodle 2022-01-27 16:41:19 +02:00
Pau Ferrer Ocaña
d195956f3a MDL-67853 message: Translate user message preference from restore and WS 2022-01-27 15:22:15 +01:00
Jake Dallimore
041b1beb46 Merge branch 'MDL-73347-master' of https://github.com/sarjona/moodle 2022-01-24 13:40:57 +08:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_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 tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Sara Arjona
53fe23d8b5 MDL-73347 behat: Add blocks hidden by default for boost
For the boost them, a few themes have been hidden by default.
The unaddable setting should be set to let admins add them again,
because some behat tests need them.
2022-01-14 13:08:48 +01:00
Ilya Tregubov
30148593b2 Merge branch 'MDL-71949-fix-backup-log-master' of https://github.com/matthewhilton/moodle 2022-01-12 11:40:56 +02:00
Matthew Hilton
90583e2f3b MDL-71949 backup: Fix userid and add backup ID to logging 2022-01-06 16:06:53 +10:00
Jun Pataleta
0dcfa504a0 Merge branch 'MDL-68773-clear-adhoc-tasks' of https://github.com/Peterburnett/moodle 2022-01-05 18:47:01 +08:00
Peter Burnett
28d6333f47 MDL-68773 backup: Allow completed async backup + restore tasks to clear 2022-01-04 10:57:58 +10:00
Jun Pataleta
80c17cd2a0 Merge branch 'MDL-72701-master' of https://github.com/andrewnicols/moodle 2021-12-23 12:10:46 +08:00
Andrew Nicols
bb9741d472 MDL-72701 unit tests: Fix broken @covers annotations 2021-12-21 09:24:00 +08:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00
Peter Dias
710c04d5ee MDL-72413 core: Disable the default activity header 2021-12-13 09:49:35 +08:00
abgreeve
fcd4de8639 MDL-72090 navigation: Update to behat feature files for navigation.
This updates feature files to use the new steps to navigate to certain
pages.
2021-12-09 11:13:35 +08:00
abgreeve
8a5e36fa06 MDL-72090 navigation: Update to existing behat steps.
This creates new general behat steps for navigating in theme
boost and classic.
2021-12-09 11:13:35 +08:00
Ilya Tregubov
638c8c452c Merge branch 'MDL-72875-master-v2' of https://github.com/peterRd/moodle 2021-12-03 14:29:59 +02:00