282 Commits

Author SHA1 Message Date
Huong Nguyen
7befed22d0
Merge branch 'versionbump' of https://github.com/junpataleta/moodle 2024-12-19 10:03:51 +07:00
Jun Pataleta
1ff50ac088
NOBUG: Bump versions for main to the current date 2024-12-18 23:53:12 +08:00
Sara Arjona
65a4277f85
Merge branch 'MDL-83336-main' of https://github.com/andrewnicols/moodle 2024-12-17 10:54:29 +01:00
Andrew Nicols
c2414e5a45
MDL-81520 core: Fix test finality 2024-12-11 12:30:23 +08:00
Andrew Nicols
d9863dbc94
MDL-83336 core: Update for deprecation of xml_set_object
From PHP 8.4, `xml_set_object()`, and passing a string helper to
`xml_set_.*_handler()` has been deprecated.

This commit updates all uses of these in core code.

Please note the following libraries have not been modified and will be
handled via library upgrades separately:
- simplepie
- phpxmlrpc
- tcpdf
2024-10-09 15:02:37 +08:00
Jun Pataleta
f24e0ecf53
MDL-83309 versions: Bump all versions and requires near release 2024-10-02 17:04:53 +08:00
Eloy Lafuente (stronk7)
674497a12c
MDL-81523 phpunit: Add all missing setUp/tearDown parent calls
All setUp(), tearDown(), setUpBeforeClass() and tearDownAfterClass()
must, always, call to parent, to ensure that everything is properly
set and cleaned.

While in a lot of situations this is not needed (parents may not
have anything to run), with PHPUnit >= 10 this can become more
important because we are going to move the reset code from current
placement @ runBare() to setUp()/tearDown().

Note that all the changes performed in this commit have been detected
and fixed by moodle-cs (ParentSetUpTearDownSniffTest).
2024-06-14 16:04:57 +02:00
Eloy Lafuente (stronk7)
01148a0816
MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.

All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
2024-06-11 11:55:07 +02:00
Jun Pataleta
a180dba314
MDL-81549 versions: bump all versions and requires near release 2024-04-17 00:03:29 +08:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Jun Pataleta
94bc2cd38b
MDL-79551 versions: bump all versions and requires near release 2023-10-04 13:57:17 +08:00
Meirza
e95540d9ff MDL-77341 mnet: Added missing class properties
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-05-20 21:37:01 +07:00
Ilya Tregubov
38230b57e4
Merge branch 'MDL-77840-master' of https://github.com/davewoloszyn/moodle 2023-05-16 09:46:05 +08:00
David Woloszyn
b318ce307d MDL-77840 mnet: Avoid passing nulls to base64_encode 2023-05-02 13:46:41 +10:00
Ilya Tregubov
dd4a990fe0 Merge branch 'master_MDL-76929' of https://github.com/mattporritt/moodle 2023-04-26 09:27:58 +08: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
Matt Porritt
02826f4395 MDL-76929 Libraries: Upgrade phpxmlrpc to 4.10.1 2023-03-14 14:45:42 +11:00
Mathew May
e5ca7766e7 MDL-52805 core: Remove legacy log calls 2023-03-07 13:08:46 +08:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Eloy Lafuente (stronk7)
621d75dbce MDL-76053 admin: Remove various warnings related to MNet
This partially reverts MDL-73270, where some useful environmental
checks and notifications in the admin UI were added to inform
about different parts of Moodle relying on the "unsupported"
php-xmlrpc extension.

Since then, some changes have happened in core, only available
for Moodle 4.1 and up (see the MDL-70889 mini-epic). Namely:

  - MNet (SSO, roaming, auth, enrol and Mahara portfolio) are not
    using the php-xmlrpc extension anymore, but a pure php library.
  - The xmlrpc webservices protocol, has been move from core to
    the plugins directory, although it continues using the php-xmlrpc
    extension.

Because of that here we are removing all the checks and notifications
related with MNet (not using the extension anymore), but keeping the
webservice plugin ones (still using the extension). Surely if some day the
protocol stops using the extension, we'll be able to remove the
corresponding checks too. But that's future.

Note the associated lang strings have been also removed (not deprecated)
because they were highly specific and hardly reusable:
  - xmlrpcmaharaenabled
  - xmlrpcmnetauthenticationenabled
  - xmlrpcmnetenabled

And very same applies, because MNet doesn't contain anything deprecated
or not supported anymore, hence, straight deletion, to the function:
  - mnet_get_deprecation_notice()

Also, related tests using any of the removed stuff above have been deleted.

In the other side, the "check_xmlrpc_usage" continues existing and
being used both by environment checks and admin notifications but,
as commented above, now it only looks for the xmlrpc webservice
protocol now.
2022-11-08 16:49:18 +01:00
Eloy Lafuente (stronk7)
73bc677346 MDL-76055 mnet: Switch the keyswap to use the library
This service is different from the rest because it
doesn't run encrypted, but plain xmlrpc. Hence, we
cannot use the normal mnet_xmlrpc_client (that provides
on-the-fly encryption and signing).

So, instead, let's instantiate a custom client here
and use it for this pure xmlrpc request and response.

PS: It's curious that this exact sevice has support
for proxies but the mnet_xmlrpc_client one has not. I'm not
going to modify that here, but have left a comment
in the code about that.

PS: Some small style changes have been applied around
the modified code (spacing, &&, comments...)
2022-11-02 15:56:38 +01:00
Eloy Lafuente (stronk7)
29873206b9 MDL-76055 mnet: Switch the mnet server to use the library 2022-11-02 15:56:38 +01:00
Eloy Lafuente (stronk7)
8c64ab98ee MDL-76055 mnet: Switch the mnet client to use library
Completely remove all uses if the xmlrpc php extension in
the client and replace them by the phpxmlrpc library.

Very noticeably, remove all the uses of the curl extension
and use phpxmlrpc own curl support.

Working ok for moodle-moodle/mahara sso and mahara portfolio export.
2022-11-02 15:56:38 +01:00
Eloy Lafuente (stronk7)
856b593796 MDL-75645 mnet: Stop caching OpenSSLAsymmetricKey keys
The mnet_environment->keypair array contains the following
elements (and more, just focussing on these):
- keypair_PEM : textual representation of the private key.
- certificate : textual representation of the public key.
- privatekey  : OpenSSLAsymmetricKey representation of the private key,
                generated from keypair_PEM. See get_private_key().
- publickey   : OpenSSLAsymmetricKey representation if the public key,
                generated from certificate. See get_public_key().

The last 2 elements in the array are only used as "caching", to avoid
having to call to openssl_pkey_get_private() and
openssl_pkey_get_public() to convert from the textual representation
to the OpenSSLAsymmetricKey representation that is the one required
by a number of openssl functions.

Problems arrive when, as part of the MNet protocol, the mnet_environment
is serialised, because, since PHP 8.0 those OpenSSLAsymmetricKey objects
aren't serialisable any more.

So, as far as they are only used for internal caching it's perfectly ok
to remove the caching bits and use the openssl_pkey_get_xxx() methods
to calculate them under demand.

The alternative to this would be to implement into the mnet_environment
some custom serialisation, skipping those OpenSSLAsymmetricKey
instances, using __sleep(), the Serializabla interface or __serialize(),
but that seems unnecessary because, as explained above, the uses are
really limited and easily replaceable.

That's what this patch does.
2022-10-18 14:30:50 +02:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Marina Glancy
a0398fdde8 MDL-73423 core_privacy: Calling reset() on objects deprecated PHP8.1 2022-04-29 16:16:07 +02:00
Ilya Tregubov
427de94fa5 Merge branch 'MDL-74394' of https://github.com/aolley/moodle 2022-04-22 08:00:30 +06:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Adam Olley
c24922fb40 MDL-74394 mnet: Better check for openssl_get_publickey() failure
In PHP8, this func now returns an object of type OpenSSLAsymmetricKey, not a
resource.

Reference:
https://www.php.net/manual/en/function.openssl-pkey-get-public.php
2022-04-01 14:32:50 +10:30
Víctor Déniz
a5a3f87a76 Merge branch 'MDL-73514' of https://github.com/stronk7/moodle 2022-02-03 22:20:20 +00:00
Víctor Déniz
8890a730fc Merge branch 'MDL-73517' of https://github.com/stronk7/moodle 2022-02-03 22:02:39 +00:00
Eloy Lafuente (stronk7)
b524f21b44 MDL-73517 mnet: add some openssl missing parameters
Since php80 the 5th parameter (cypher) in the following functions:
  - openssl_seal
  - openssl_open
is mandatory, hence:
  - adding it.
  - with value 'RC4' to keep BC.
2022-01-28 20:10:52 +01:00
Eloy Lafuente (stronk7)
fcbe439c4d MDL-73514 mnet: fix promiscuous mode and php80 support 2022-01-28 20:10:39 +01:00
Huong Nguyen
683375af8b MDL-73270 admin: Warn about xmlrpc webservice protocol enabled
Co-authored-by: Andrew Lyons <andrew@nicols.co.uk>
2022-01-28 09:32:08 +07:00
Eloy Lafuente (stronk7)
d2ad5e8461 MDL-73523 libraries: openssl_free_xxx() methods are deprecated in php80
So we are putting them under a standard PHP_MAJOR_VERSION < 8 condition.

Also, added TODO comments to remember to delete that block of code when
php80 becomes the minimum required versions in the future (Moodle 4.3?).

When possible, an issue has been created upstream, else a comment in
readme_moodle files has been added.

Finally, when the keys being freed were class or object attributes, also
nullify them (but when the calls were part of destructor methods).
2022-01-20 14:48:22 +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)
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
Sara Arjona
3f2f2e85bb MDL-72115 course: Rename Miscellaneous category
The "Miscellaneous" course category has been renamed to Category 1.
Besides, the description field has been set from FORMAT_MOODLE to
FORMAT_HTML.
2021-09-13 08:36:17 +02: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
0eada7a5f9 MDL-70893 various: optional function arguments must be in the end 2021-02-15 16:53:37 +01: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
a8d07a8737 MDL-69050 lang: Fix few remaining places spotted during integration 2020-10-01 13:02:48 +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)
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
Eloy Lafuente (stronk7)
d5be859063 MDL-67199 versions: bump all versions and requires near release
version = 2019111800 release version
requires= 2019111200 current beta (week7roll1) version
2019-11-12 17:57:08 +01:00
Eloy Lafuente (stronk7)
c9a1a6341c MDL-65571 versions: bump all versions and requires near release
version = 2019052000 release version
requires= 2019051100 current beta (week6roll2) version
2019-05-12 23:46:34 +02:00
Shamim Rezaie
55fec3126d MDL-64782 mnetservice_enrol: Performance improvement 2019-04-23 17:01:48 +10:00
Eloy Lafuente (stronk7)
085353b315 MDL-64282 versions: bump all versions and requires near release
version = 2018120300 release version
requires= 2018112800 current rc2 (week7roll1) version
2018-11-29 18:24:08 +01:00
Mihail Geshoski
bdf1b47550 MDL-63682 mnetservice_enrol: Add support for removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-26 10:22:53 +08:00