56 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
1093256560
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 12:18:04 +02:00
Daniel Ziegenberg
08027e408c
MDL-81281 phpunit: assertObjectHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectHasProperty() instead."

So we replace all instances of assertObjectHasAttribute with
assertObjectHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:45 +01:00
Daniel Ziegenberg
87267da39d
MDL-81281 phpunit: assertObjectNotHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectNotHasProperty() instead."

So we replace all instances of assertObjectNotHasAttribute with
assertObjectNotHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:07 +01:00
Huong Nguyen
6a19d3289b MDL-80167 admin: Add environment check for Oracle database 2024-03-14 17:41:56 +07:00
Stephan Robotta
aafbdf7a6b MDL-43195 license: upgrading cc core licenses to version 4.0
The short name of the cc licenses are trailed with a suffix containing
the version number (current 3.0 and 4.0). The old cc* licenses become
the new cc-*-3.0 licenses and are disables, because the new cc*-4.0
licenses are the current ones.
2023-08-14 22:53:57 +02:00
Peter Burnett
027c770eab
MDL-65471 upgrade: framework to reduce maintenance mode 2023-04-06 11:38:26 +10:00
Jun Pataleta
ae3e9667c2 MDL-72350 core: Add @covers for test_check_mod_assignment_is_used
Plus, remove getStatus() assertion when running the test with
mod_assignment reinstalled since it check_mod_assignment returns a
null result.
2023-03-30 13:00:39 +08:00
Stevani Andolo
26d78531e7 MDL-72350 core: Added environment check for mod_assignment
Decided to add an environment check before uninstalling the
mod_assignment plugin to prevent data lost.
2023-03-30 09:00:06 +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
Jun Pataleta
c599533958 Merge branch 'MDL-74988' of https://github.com/paulholden/moodle 2022-07-13 13:22:15 +08:00
Eloy Lafuente (stronk7)
012ae934be MDL-71747 upgrade: remove functions not used anymore
This code was used only by deleted upgrade steps so it's safe
to proceed with straight deletion, considering it internal.
Deletion has been documented in corresponding upgrade.txt files:

  - upgrade_analytics_fix_contextids_defaults()
  - upgrade_convert_hub_config_site_param_names()
  - upgrade_rename_prediction_actions_useful_incorrectly_flagged()
2022-07-07 19:16:37 +02:00
Paul Holden
53c8802545 MDL-74988 core: reset times for entire filearea in upgrade test.
The previous code was resetting timestamps for only the file itself,
which could lead to it having an earlier time than the root entry of
it's filearea.

This caused sporadic test failures when the current time ticked over
by a second during execution.
2022-06-16 10:50:06 +01:00
Peter Burnett
3801662e97 MDL-71198 backup: Change times on restore file duplication 2022-05-25 22:18:36 +08:00
Víctor Déniz
e95d99ebf1 Merge branch 'MDL-74030' of https://github.com/roland04/moodle 2022-03-14 21:39:40 +00:00
Mikel Martín
d2acd08934 MDL-74030 navigation: Add reports link
Add report builder 'Reports' link to the user menu

AMOS BEGIN
 CPY [reports,moodle],[reports,core_reportbuilder]
AMOS END
2022-03-10 15:46:44 +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
Huong Nguyen
bca6b06a1c MDL-71953 calendar: Accessibility improvement for manage subscription
- Create new web services for manage subscription (Update calendar subscription)
 - Modified delete subscription feature to use Web service.
 - Midified update subscription feature to use in-place editbale
 - Delete subscription feature now have a confirmation box before processing.
 - Fixed some accessibility issues
 - Used 'Delete' instead of 'Remove' for deleting subscriptions
2021-10-21 11:02:34 +07:00
Andrew Nicols
c83e637ff9 MDL-72621 admin: Add environment check for admin deprecation 2021-09-29 22:39:32 +08:00
Simey Lameze
5b0282847e MDL-71156 core: machinery to recover orphaned calendar events
The machinery to fix orphaned calendar events that were broken by MDL-67494.

The solution consists of:

1) Upgrade step that checks if this site has executed the problematic upgrade steps and
   if positive, it will schedule a new run for calendar_fix_orphaned_events adhoc task.

2) Adhoc task that will self-spawn calling the recovery machinery, running until
   all the orphaned calendar events are fixed. It also sets the maximum runtime of
   60 seconds. It is also possible to override that number by specifing the desired
   number setting the ->calendareventsmaxseconds in your config.php

3) CLI script that will look for all the calendar events which userids
   where broken by a wrong upgrade step, affecting to Moodle 3.9.5
   and up.

   It performs checks to both:
     a) Detect if the site was affected (ran the wrong upgrade step).
     b) Look for orphaned calendar events, categorising them as:
       - standard: site / category / course / group / user events
       - subscription: events created via subscriptions.
       - action: normal action events, created to show common important dates.
       - override: user and group override events, particular, that some activities support.
       - custom: other events, not being any of the above, common or particular.

   By specifying it (--fix) try to recover as many broken events (missing userid) as
   possible. Standard, subscription, action, override events in core are fully supported but
   override or custom events should be fixed by each plugin as far as there isn't any standard
   API (plugin-wise) to launch a rebuild of the calendar events.

4) Unit tests and helper functions to generate calendar events. We have decided to
   keep the tests simple, testing only true and false and not using data generators because
   the code is purely to recover the calendar events and won't turn into an API or something
   and also due to the urgency of this issue.
   The helpers have been created in calendar/tests/helpers.php since there are no data generators
   for calendar.
2021-04-22 10:28:52 +08:00
Tomo Tsuyuki
745d4c2a4f MDL-70245 core_grade: Fix grade_get_setting unit test failures
To fix the phpunit issue, change from static variable to use cache
2020-12-10 16:46:09 +11:00
Tom Dickman
4399e4759a MDL-45184 tool_licenses: Add custom licenses
This feature adds an admin tool for creating custom licenses.
Now custom licenses can be added and amended in Moodle, and the site
default can be set to a custom license.

Core licenses remain hard-coded and are uneditable, so they will always
require update within Moodle core updates, and maintain their
internationalisation through core language strings.

This also includes fundamental changes to the license API including
the addition of license caching and deprecation of no longer required
admin settings for license management.
2020-05-26 12:08:05 +10:00
Sara Arjona
089e918033 MDL-65809 upgrade: remove upgrade_fix_config_auth_plugin_names
These functions were used only by deleted upgrade steps
so it's safe to proceed with straight deletion, considering
them internal. Deletion has been documented in corresponding
upgrade.txt files:

- upgrade_fix_config_auth_plugin_names()
- upgrade_fix_config_auth_plugin_defaults()
2019-12-20 12:20:43 +01:00
Sara Arjona
6f46aa2040 MDL-65809 upgrade: remove upgrade_block_positions
This function was used only by deleted upgrade steps
so it's safe to proceed with straight deletion, considering
it internal. Deletion has been documented in corresponding
upgrade.txt files.
2019-12-20 12:20:43 +01:00
Sara Arjona
f0d3d50273 MDL-65809 upgrade: remove upgrade_theme_is_from_family
These functions and setting were used only by deleted upgrade steps
so it's safe to proceed with straight deletion, considering
them internal. Deletion has been documented in corresponding
upgrade.txt files:

- upgrade_theme_is_from_family()
- upgrade_find_theme_location()
- linkcoursesectionsupgradescriptwasrun setting
2019-12-20 12:20:43 +01:00
Sara Arjona
c230306957 MDL-65809 upgrade: remove upgrade_fix_block_instance_configuration
The upgrade_fix_block_instance_configuration() function was used
only by deleted upgrade steps so it's safe to proceed with straight
deletion, considering it internal. Deletion has been documented in
corresponding upgrade.txt files.
2019-12-20 12:19:03 +01:00
David Monllaó
a461d36010 MDL-67187 analytics: Fix broken text comparison 2019-11-11 11:00:28 +08:00
David Mudrák
ecc9960ead MDL-66118 hub: Stop using the hub URL as the setting name suffix
Site indicators shared with the registration hub used to have the hub
URL in the relevant setting names - such as site_name_httpsmoodlenet.
This upgrade step converts all such settings and drops the URL suffix
because we do not support alternative hubs any more.

Additionally the upgrade step renames the official hub and updates its
URL so that existing registrations with https://moodle.net are still
valid.
2019-10-04 21:23:11 +02:00
David Monllaó
386d109172 MDL-62191 analytics: Support for bulk actions 2019-09-27 14:13:52 +08:00
Mathew May
e00f1c663c MDL-64506 phpunit: Update unit tests to use classic 2019-04-03 19:34:20 +08:00
Ilya Tregubov
f408e1f888 MDL-63710 repository: Delete orphaned file records. 2018-12-06 12:39:31 +11:00
Andrew Nicols
03d174d733 MDL-61268 core: Fix empty string DB cehck
(amended by stronk7 to use the helper better)
2018-03-02 16:31:11 +01:00
Adrian Greeve
8a844437bf MDL-61268 blocks: Unit tests for deprecated object update.
Unit tests for testing that the upgrade functions to change
the now deprecated object to stdClass works.
2018-03-02 09:22:05 +08:00
John Okely
e46fde42ab MDL-57412 upgrade: Set linkcoursesections to 1 if boost in use 2017-08-23 15:05:32 +08:00
Eloy Lafuente (stronk7)
f83d212bcf MDL-57432 upgrade: remove unused functions/settings from upgradelib
All these functions were used only by deleted upgrade steps
so it's safe to proceed with straight deletion, considering
them internal. Deletion has been documented in corresponding
upgrade.txt files:

- upgrade_mimetypes()
- upgrade_fix_missing_root_folders_draft()
- upgrade_minmaxgrade() and upgrade_minmaxgradestepignored setting
- upgrade_course_tags()
- atto_equation_update_librarygroup4_setting()
- mod_lti_upgrade_custom_separator()

These have been kept because continue being used by restore:

- upgrade_group_members_only()
- upgrade_extra_credit_weightoverride()
- upgrade_calculated_grade_items()
2017-07-10 09:18:56 +01:00
David Mudrák
31bd102316 MDL-58692 auth: Improve the migration of auth setting names
Some auth plugins used to have a mix of the legacy style of plugin names
in config_plugins table (such as 'auth/mnet') and the new correct
style (such as 'auth_mnet'). Attempting to rename the setting plugin via
low level SQL UPDATE could lead to duplicate key violation.

The patch introduces a new helper function to safely migrate the old
settings to the new ones, eventually informing the admin about the
values mismatch.
2017-05-03 12:02:43 +02:00
Marina Glancy
a572272768 MDL-50770 blocks: remove orphaned block positions 2017-02-13 15:18:51 +08:00
Ankit Agarwal
f2330472f0 MDL-55777 installation: Check libcurl version on install 2016-11-10 10:16:19 +05:30
Adrian Greeve
97a85bf6f0 MDL-55107 gradebook: Unit tests for the new setting check. 2016-07-12 13:30:10 +08:00
Adrian Greeve
41abbbbde5 MDL-45390 gradebook: sql tidy up and version alignment. 2016-05-18 10:41:30 +08:00
David Monllao
ece791dbd4 MDL-45390 grades: Courses letters using system bad boundaries
Added unit tests to highlight the existing failures and adding
unset_config between each set of tests.
2016-05-18 10:08:10 +08:00
Adrian Greeve
70dfd48f53 MDL-45390 gradebook: Unit tests for grade boundary issue. 2016-05-18 09:08:18 +08:00
Eloy Lafuente (stronk7)
1405f010b7 MDL-51580 upgradelib: Delete stuff used by removed upgrade steps
This commits removes stuff from different upgradelib files, used
exclusively by the already deleted upgrade steps. Given such
exclusivity it was not needed to proceed with a 2-phase deprecation
as far as the functions were 100% internal to upgrade.

This is the list of deleted functions, all them docummented in their
corresponding upgrade.txt files:

- repository_picasa_admin_upgrade_notification();
- repository_googledocs_admin_upgrade_notification();
- repository_boxnet_admin_upgrade_notification();
- repository_alfresco_admin_security_key_notice();
- qtype_essay_convert_to_html();
- portfolio_picasa_admin_upgrade_notification();
- portfolio_googledocs_admin_upgrade_notification();
- portfolio_boxnet_admin_upgrade_notification();
- mod_book_migrate_moddata_dir_to_legacy();
- mod_book_migrate_all_areas();
- mod_book_migrate_area();
- mod_assignment_pending_upgrades_notification();
- upgrade_mysql_fix_unsigned_and_lob_columns();
- upgrade_course_completion_remove_duplicates();
- upgrade_save_orphaned_questions();
- upgrade_rename_old_backup_files_using_shortname();
- upgrade_mssql_nvarcharmax();
- upgrade_mssql_varbinarymax();
- upgrade_fix_missing_root_folders();
- upgrade_course_modules_sequences();
- upgrade_grade_item_fix_sortorder();
- upgrade_availability_item();
2016-02-15 18:38:21 +01:00
Marina Glancy
0d1e545612 MDL-51132 tags: do not use user tags for tagging courses 2015-09-05 11:21:15 +08:00
Adrian Greeve
316c560cc5 MDL-50757 gradebook: Update fix for pre 2.8 upgrades.
Moodle installations that updated before the 2.8 grade push
were being flagged for a gradebook freeze. This was resulting in
calculated grades being shown as different to how they were
displayed before the upgrade. This fix retains the original
grade value.
2015-07-03 13:13:12 +08:00
Adrian Greeve
716c081049 MDL-48239 gradebook: Unit test for upgrade function. 2015-07-02 11:13:25 +08:00
Marina Glancy
156d048659 MDL-49257 grades: fix bugs with extra credit weights
When we adjust the weights in natural grading (setup screen), the extra credit items
should not depend on other overrides. If extra credit item's weight was overriden, it stays as it is.
Otherwise it is calculated as itemgrademax / totalgrademax (total excludes extra credit items)
2015-06-23 14:25:50 +08:00
Frederic Massart
056aeae8d4 MDL-48618 grades: Test for the minmax upgrade step 2015-06-10 12:33:42 +08:00
Marina Glancy
941de29601 MDL-45538 files: restore missing records in draft areas 2014-10-29 15:26:54 +08:00
sam marshall
061e6b2864 MDL-44725 Availability: Replace groupmembersonly - upgrade, core (1)
* Upgrades existing data so that the groupmembersonly option is
  replaced with equivalent data for the new availability API.
* Removes the database field and admin setting used for
  groupmembersonly.
* Changes core modinfo library to remove/deprecate groupmembersonly
  data and functions.
* Changes other core library files to remove groupmembersonly
  references.

Includes deprecation of several functions, listed in lib/upgrade.txt.
2014-09-02 13:03:07 +01:00
sam marshall
8e97006ad0 MDL-44070 Conditional availability enhancements (1): DB upgrade
Converts existing data to new structure in database as part of
upgrade, including a progress bar.

Deletes the database tables and fields that were used by the old
system and are no longer needed.
2014-04-07 18:27:43 +01:00