3073 Commits

Author SHA1 Message Date
Sara Arjona
39263ddb62 MDL-69331 core_h5p: Add missing @core_h5p tag 2021-04-15 09:16:36 +02:00
Sara Arjona
f3d43c76bc MDL-69331 core_h5p: Add missing library files to behat tests
Some of the pre-existing behat tests were creating content into the
content bank using the generator but the H5P content-type libraries
weren't uploaded.
Since MDL-69331, libraries need to be deployed previously (so fake
H5P content-type won't be displayed if these libraries don't exist).
2021-04-15 09:16:36 +02:00
Tomo Tsuyuki
108da43e9f MDL-63381 backup: Have an option to import permissions
Add options to use permission settings for import / restore
2021-04-13 13:24:15 +10:00
Amaia Anabitarte
9b7b70ca9b MDL-71107 core_contentbank: Fill content author when copying a course
'usercreated' and 'usermodified' fields can not be always mapped.
We are filling those fields with 'old' users when working on the same
site, or with current user when working on a different instance.
2021-04-07 10:03:38 +02:00
Tomo Tsuyuki
b6f6203e65 MDL-71136 backup: Fix moodle_exception path. 2021-03-30 10:54:08 +11:00
Mikhail Golenkov
0d2f65ffc9 MDL-71233 backup: Fix Moodle version for MDL-69418 2021-03-30 10:41:59 +11:00
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
Mihail Geshoski
5cc31c3691 MDL-67870 backup: Skip value change if setting is locked by hierarchy
The given condition in the if statement did not take into account cases
when the setting is locked by hierarchy. Settings which are locked by
hierarchy should should keep their current values which were inherited
from the parent.
2021-03-22 15:32:49 +08:00
Eloy Lafuente (stronk7)
e3a46964dc Merge branch 'MDL-70901-master' of git://github.com/marinaglancy/moodle 2021-03-18 00:40:46 +01:00
Jun Pataleta
ebf078458d Merge branch 'MDL-71036' of https://github.com/stronk7/moodle 2021-03-17 20:05:25 +08:00
Eloy Lafuente (stronk7)
44c302a607 Merge branch 'master-MDL-71044_v3' of https://github.com/golenkovm/moodle 2021-03-16 22:38:48 +01:00
Adrian Greeve
00cb88c352 Merge branch 'MDL-65974-master-iteration03' of git://github.com/ferranrecio/moodle 2021-03-15 15:16:44 +08:00
Eloy Lafuente (stronk7)
81407f18ec MDL-71036 phpunit: Mock->setMethods() silently deprecated
The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.

Basically the now deprecated method has been split into:

- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
  artifact.

In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.

Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.

Link: https://github.com/sebastianbergmann/phpunit/issues/3770
2021-03-11 23:04:31 +01:00
Eloy Lafuente (stronk7)
ba5b6089d5 MDL-71036 phpunit: Renamed various regexp-related assertions
In PHPUnit 9.1, the following regexp-related assertions
have been deprecated and there are new alternatives for
all them:
    - assertRegExp()     -> assertMatchesRegularExpression()
    - assertNotRegExp()  -> assertDoesNotMatchRegularExpression()

This is about to, simply, move all cases to the new alternatives.

Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md

Regexp to find all them:

    ag 'assertRegExp|assertNotRegExp' -li
2021-03-11 19:22:24 +01:00
Ferran Recio
1c839f9072 MDL-65974 course: move format_base to core_course\course_format 2021-03-11 17:36:34 +01:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00:00
Mikhail Golenkov
e9eb3ad6c5 MDL-71044 backup: backup_cleanup_task task to remove old files 2021-03-07 21:46:47 +11:00
Jun Pataleta
2b113fd93c Merge branch 'MDL-70876' of https://github.com/stronk7/moodle 2021-03-02 16:02:52 +08:00
Eloy Lafuente (stronk7)
bf2b1b18b5 Merge branch 'MDL-70898-master' of git://github.com/marinaglancy/moodle 2021-03-01 22:50:33 +01:00
Eloy Lafuente (stronk7)
08ae245926 MDL-70876 php80: 5th param removed from custom error handlers
It was deprecated in php72 and now it's gone.

Have used this regexp to find all the uses in core:

ag set_error_handler | uniq

And then checked all them manually, that parameter was not
being used in the 3 methods where we are removing it.
2021-02-26 13:08:27 +01:00
Eloy Lafuente (stronk7)
a3bd2b3357 Merge branch 'MDL-70920-master' of git://github.com/marinaglancy/moodle 2021-02-23 17:43:32 +01:00
Marina Glancy
b88f1a84bf MDL-70901 core: @ no longer masks errors in PHP 8.0 2021-02-22 16:18:46 +01:00
Marina Glancy
3e076d8cff MDL-70901 backup: check handle before calling fclose()
@fclose no longer catches error in PHP 8.0 when handle is null
2021-02-22 16:17:49 +01:00
Marina Glancy
7b003c04a8 MDL-70920 backup: call_user_func_array can accept named arguments
Because arguments names do not match in associative array, we change it to regular array or arguments
2021-02-21 22:19:52 +01:00
Daniel Kristian Steffensen
50b313fc56 MDL-43697 backup: Archived badges are restored during course restore 2021-02-19 15:47:39 +01:00
Víctor Déniz
8a4ce781b9 Merge branch 'master-MDL-70752' of https://github.com/golenkovm/moodle 2021-02-17 16:56:48 +00:00
Jun Pataleta
c8f5e8c7f3 MDL-48269 core_backup: Prevent unwanted group icons from being restored
* Old backups might have hidepicture defined and set to 1 in which case
we must make sure to exclude the group picture for these groups from
being restored.
2021-02-16 22:26:13 +08:00
Frederic Massart
3aed37ee4d MDL-48269 group: Remove the option to hide the picture of a group
Plus additional amendments to Fred's original commit:
1. Updating the version numbers
2. Merging the original two-step upgrade below into one for simplicity:
   1. Deleting the pictures for groups with hidepicture set to 1; and
   2. Dropping the hidepicture field itself.
3. Converted array() usages to the short syntax [].
2021-02-16 12:46:58 +08:00
Marina Glancy
0af0a96bb1 MDL-70898 various: private functions can not be declared final 2021-02-15 16:20:06 +01:00
Mikhail Golenkov
ad9598c758 MDL-70752 restore: Fix remote file recovery 2021-02-04 17:27:54 +11:00
Adrian Perez
9e15569d48 MDL-69202 Restore backup: add getter method for oldmoduleid 2021-01-16 10:25:05 +01:00
Paul Holden
509a0f4d00 MDL-70422 restore: fix for undefined question answer ordering in test. 2020-12-07 10:13:22 +00:00
Mihail Geshoski
c8ac07fb50 MDL-67837 backup: Verify caps before unenrolling users on course restore 2020-11-03 12:34:28 +01:00
Peter Dias
828caaac70 MDL-56310 restore: Confirm user has permission to change capabilities 2020-11-03 12:34:28 +01:00
Paul Holden
eec03671f8 MDL-69156 backup: correct behaviour of course copy idnumber field.
When a given user doesn't have the capability to change the idnumber
field during course copy, freeze the field value.
2020-10-29 14:14:13 +01:00
Adrian Perez
d5ec9d66a4 MDL-69156 course_copy: set defaults for idnumber when not permitted 2020-10-29 14:14:08 +01:00
Luca Bösch
16d5028567 MDL-69995 backup: padding before activity icons. 2020-10-25 02:08:38 +02:00
Eloy Lafuente (stronk7)
3a5641cb74 MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
d95c378771 MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:00 +02: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
Sara Arjona
66e3cceaa2 Merge branch 'MDL-69900-master' of git://github.com/mihailges/moodle into master 2020-10-19 13:41:51 +02:00
Jake Dallimore
e19669e432 Merge branch 'master_MDL-47178' of https://github.com/golenkovm/moodle 2020-10-16 11:52:09 +08:00
Stephen Bourget
0544ab902d MDL-69900 core_backup: Allow IMSCC v1.0 restore to finish 2020-10-09 09:04:22 +08:00
Mikhail Golenkov
f8d859a685 MDL-47178 question: Retain question authors when restoring backups. 2020-10-06 09:29:18 +11:00
Shamim Rezaie
2c93a1f53c MDL-69649 backup: Fix missing labels
- The backup details page uses a table to show a sumary of the backup
  content. Used role attribute to denote the tabular format of the
  summary.
- The backup details page displays activity name next to each activity
  icon. Therefore the icons are only decorative and do not need to have
  any title or even alt text.
- Form labels should be associated with form controls.  A div element is
  not a form control.
- The from attribute of the form labels should be equal to the id
  attribute of an element. Therefore, we first create a label and an
  input elements and associate them to each other, and then pass them to
  backup_detail_pair() when a label is needed.
2020-09-28 23:41:29 +10:00
Eloy Lafuente (stronk7)
c43dac4e36 Merge branch 'MDL-69454-master' of git://github.com/bmbrands/moodle into master 2020-09-23 17:10:35 +02:00
Bas Brands
eb9935c909 MDL-69454 core_search: consistent backup search 2020-09-21 13:41:05 +02:00
Claude Vervoort
5b8c646e68 MDL-66934 mod_lti: support context history param 2020-09-18 14:11:34 -04:00
Nathan Nguyen
65c847d8fd MDL-68702 core_backup: exclude legacy course files 2020-09-11 10:41:37 +10:00
Paul Holden
404eabc7b5 MDL-69448 backup: fix capability checks when unable to copy user data.
When a given user doesn't have the capability to "Include user data"
during course copying, freeze the form element rather than not adding
it at all.

This caused problems as the element was required before preceding with
the course copy.
2020-09-04 08:19:53 +01:00