28 Commits

Author SHA1 Message Date
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Andrew Nicols
94177ec2da
MDL-80749 core: Tidy up task tests 2024-03-05 21:18:54 +08:00
Huong Nguyen
c068b01a1a
MDL-80749 adhoc_task: Update failed ad-hoc tasks cleanup
Update the task to use firststartingtime instead of timestarted
2024-03-04 10:17:14 +07:00
Huong Nguyen
17c01d9d74
MDL-80749 adhoc_task: Log the first starting time of the task 2024-03-04 10:17:09 +07: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
Andrew Nicols
a165c72af2
MDL-80684 core: Correct location of task tests 2024-02-28 14:20:40 +08:00
Frederik Milling Pytlick
ab517483a0 MDL-80684 core: Fail running tasks on shutdown
When you kill a process which is executing a task, it now marks it as failed.
2024-02-19 12:07:56 +01:00
Huong Nguyen
379e48c1fd MDL-74775 adhoc_task: Do not clear the timecreated of failed tasks 2024-01-29 09:57:33 +07:00
Ilya Tregubov
12203eea69 Merge branch 'MDL-79130-master' of https://github.com/stevandoMoodle/moodle 2024-01-16 16:26:48 +08:00
Huong Nguyen
028c0384a2 MDL-69615 core_backup: Send backup report email once the tasks are done 2024-01-16 09:32:19 +07:00
Stevani Andolo
2425e07db3 MDL-79130 task_adhoc: Defined max retry constant 2024-01-10 10:17:42 +08:00
Huong Nguyen
f13392d230 MDL-79128 adhoc_task: Implement failed ad-hoc task cleanup
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
2023-12-20 13:55:13 +07:00
Huong Nguyen
6c047c40b7 MDL-79128 adhoc_task: Only rerun the allowed task
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
2023-12-20 13:55:13 +07:00
Huong Nguyen
a44f14c79e MDL-79128 adhoc_task: Implement no-retry task
Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>

Including in this commit:
 - Added a new counter called attemptsavailable for ad-hoc task
 - PHPUnit test for the new feature
2023-12-20 13:55:13 +07:00
sam marshall
1c4d433d5f MDL-79966 core_task: Scheduled task timing (crontab fields) is wrong 2023-11-20 17:13:21 +00:00
Paul Holden
75c36558b6
MDL-79186 task: fix evaluation of 'X/Y' cron field format.
The above syntax is defined as supported by the class, for example the
format '5/10' means:

"At every 10th <unit> from 5 through <max>."

It is analogous to '5-<max>/10'.
2023-09-11 09:22:17 +01:00
Charles Fulton
1af1cd3b49 MDL-79090 task: add enable and disable cli commands 2023-08-28 10:33:25 -04:00
Sara Arjona
ff46626da9
MDL-48762 core: Add scheduled tasks to set course visibility
Two new scheduled tasks, show_started_courses_task and
hide_ended_courses_task have been added, to automatically change
the course visibility when the start/end course date match the
current one.
They are disabled by default, to keep the current behaviour.
When admins enable any of them, they are executed once per
day by default (around midnight).

These scheduled tasks are based on the "CUL Course Visibility Update"
third-party plugin created by Tim Gagen and refactored and currently
maintained by Amanda Doughty:
https://moodle.org/plugins/local_culcourse_visibility

Thanks!! :-)
2023-07-04 07:27:03 +02:00
Paul Holden
d508cdf111
MDL-74824 user: fix custom change password URL in login notification. 2023-06-11 17:40:54 +01:00
Sara Arjona
9ce4fb65fd Merge branch 'MDL-77164-master' of https://github.com/marinaglancy/moodle 2023-04-13 14:00:18 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Srdjan
85323070e7 MDL-70975 task: adhoctasks.php - queued ad hoc tasks report
Similar to scheduled tasks report

core\task\manager::adhoc_task_from_record() now raises moodle_exception
2023-04-05 11:29:46 +10:00
Srdjan
3491ea1650 MDL-70975 task: Support for running adhoc tasks filtered by class
* CLI adhoc_task.php: new option --classname
* core\task\manager::get_next_adhoc_task(): new param $classname
  for filtering tasks
2023-04-05 11:00:46 +10:00
Srdjan
9405b5aa6d MDL-70975 task: Support for running adhoc tasks by id
* CLI adhoc_task.php: new option --id
* cron::run_adhoc_task($taskid) for running tasks by id
* core\task\manager::get_adhoc_task($taskid) for retreival/locking
2023-04-05 10:55:18 +10:00
Andrew Nicols
347fc32088 MDL-77186 core: Rename incorrectly named test 2023-03-13 21:21:13 +08:00
Paul Holden
af8da7c737 MDL-70070 phpunit: correct data provider method names.
They should not be prefixed `test_` because that's how actual
test methods containing assertions are identified by PHPUnit.
2023-01-16 08:28:37 +00:00
Eloy Lafuente (stronk7)
0ed53be9b2 MDL-66902 tests: Fix all incorrect namespaces
This issue just goes over all the currently incorrect
namespaces in test cases and:

1. Change the namespace to the correct one.
2. Move/rename it to correct location if needed (level 2 and down).
3. Remove not needed MOODLE_INTERNAL check when possible.
4. Remove file phpdoc when the file only has one class.
5. Make small adjustments in case the change of namespace requires it.
2022-09-26 14:12:16 +02:00
Eloy Lafuente (stronk7)
83b490a594 MDL-75111 phpunit: Move tests to use correct names and ns (take#4)
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:

- The following task tests have been moved within the level2 directory:
  - \core\adhoc_task_test => \core\task\adhoc_task_test
  - \core\scheduled_task_test => \core\task\scheduled_task_test
  - \core\calendar_cron_task_test => \core\task\calendar_cron_task_test
  - \core\h5p_get_content_types_task_test => \core\task\h5p_get_content_types_task_test
  - \core\task_database_logger_test => \core\task\database_logger_test
  - \core\task_logging_test => \core\task\logging_test

- The following event tests have been moved within level2 directory:
  - \core\event_context_locked_test => \core\event\context_locked_test
  - \core\event_deprecated_test => \core\event\deprecated_test
  - \core\event_grade_deleted_test => \core\event\grade_deleted_test
  - \core\event_profile_field_test => \core\event\profile_field_test
  - \core\event_unknown_logged_test => \core\event\unknown_logged_test
  - \core\event_user_graded_test => \core\event\user_graded_test
  - \core\event_user_password_updated_test => \core\event\user_password_updated_test

- The following output tests have been moved within level2 directory:
  - \core\mustache_template_finder_test => \core\output\mustache_template_finder_test
  - \core\mustache_template_source_loader_test => \core\output\mustache_template_source_loader_test
  - \core\output_mustache_helper_collection_test => \core\output\mustache_helper_collection_test

- The following tests have been moved to their correct tests directories:
  - lib/tests/time_splittings_test.php => analytics/tests/time_splittings_test.php

- All the classes and tests under lib/filebrowser and lib/filestorage
  belong to core, not to core_files. Some day we should move
  them to their correct subsystem.
- All the classes and tests under lib/grade belong to core, not
  to core_grades. Some day we should move them to their correct
  subsystem.
- The core_grades_external class and its \core\grades_external_test
  unit test should belong to the grades subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The core_grading_external class and its \core\grading_external_test
  unit test should belong to the grading subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The \core\message\message and \core\message\inbound (may be others)
  classes, and their associated tests should go to the core_message
  subsystem.
- The core_user class, and its associated tests should go to the
  core_user subsystem.
- The \core\update namespace is plain wrong (update is not valid API)
  and needs action 1) create it or 2) move elsewhere.
2022-08-26 16:34:20 +02:00