Compare commits

..

705 Commits

Author SHA1 Message Date
moodler 9b4f94bd92 Bumping to 1.6.2 for releasing 2006-09-12 16:05:51 +00:00
moodler a88c450679 Merged fix from HEAD 2006-09-12 14:28:04 +00:00
bobopinna 6a973240af added support to hyphen and tilde in CMIIdentifier 2006-09-12 08:46:23 +00:00
moodler 3e3c6eec08 Automatic installer.php lang files by installer_builder (20060912) 2006-09-12 02:48:41 +00:00
exe-cutor 8de4f2e23e Again added get_first_string ... 2006-09-11 09:05:35 +00:00
stronk7 9d3089562a 1.6 installer langs files added. 2006-09-11 08:28:49 +00:00
moodler 77ec0e627e Automatic installer.php lang files by installer_builder (20060911) 2006-09-11 08:12:16 +00:00
stronk7 abf39fb332 file installer.php was added on branch MOODLE_16_STABLE on 2006-09-11 08:28:54 +0000 2006-09-11 08:09:58 +00:00
skodak 2877856383 validate local redirection actions in jumpto.php SC#310; backported from HEAD 2006-09-11 07:13:03 +00:00
gbateson f03e81eb03 removed reportselector.html as it was unused and has been replaced by reportcontent.html and reportformat.html 2006-09-10 05:27:41 +00:00
gbateson 75e59b1a22 correct a small formatting error in "Show Legend" -> "No" explanation 2006-09-10 05:25:13 +00:00
mark-nielsen e2eb506371 MDL-5430 - branch table redirect problem 2006-09-09 17:25:21 +00:00
mark-nielsen 9f811896b8 Security fix for grading Essays. Mentioned in MDL-6477 2006-09-08 18:01:12 +00:00
skodak a12743a49b fixed typo - trailing backslash; backported from HEAD 2006-09-08 15:51:40 +00:00
thepurpleblob e8131aa214 Added Clifford Tham's changes - Thanks Clifford :-)
Also fixed some notices
2006-09-08 10:21:51 +00:00
skodak faafe84561 fixed serious breakage during upgrades caused by double redirects 2006-09-07 20:33:03 +00:00
skodak df8ac6d2e6 forced conversion to proper numeric type in _adodb_column_sql() SC#259; backported from HEAD 2006-09-07 10:21:43 +00:00
skodak c98d228b96 allow less verbose operation of forget_password.php SC#282, backported from HEAD 2006-09-07 05:50:05 +00:00
vyshane 9180b308f4 Added $CFG->pagepath so that editing questions will link to the relevant question types in moodle docs. Fix for bug MDL-5866. 2006-09-06 08:50:50 +00:00
skodak 586e08ac32 backported detection of potentially insecure dataroot location SC#295 2006-09-05 22:38:59 +00:00
skodak 13ad4e12e1 fix for bug MDL-5403 , you can now force redirect with 0 delay even when header already printed 2006-09-05 21:51:31 +00:00
moodler f83a24b87b Stripping tags from titles MDL-6431 2006-09-05 03:14:02 +00:00
moodler bf08108c94 Added $CFG->coursesperpage which changes default paging of category listing 2006-09-05 03:03:42 +00:00
gustav_delius f610ac5e18 Had to comment out the line that updates the timemodified field when a discussion is moved from one forum to another one because the timemodified field is used to sort the list of discussions and also to provide the "Last post" date. It should really be renamed to something like "timeoflastpost". 2006-09-04 22:00:26 +00:00
moodler bfd5c5d7f6 Change the format of the email signup link to make it work better on Hotmail 2006-09-04 02:25:35 +00:00
moodler 5decc6f064 DOn't process stats if it's blocked 2006-09-03 15:44:25 +00:00
moodler f598a45f2e Added a hidden $CFG->disablestatsprocessing variable to disable stats completely 2006-09-03 15:42:05 +00:00
gustav_delius eb9b7f1a3e Take out invalid </tr>. While this makes the html valid some work should still be done on the layout of this. 2006-09-03 12:22:02 +00:00
gustav_delius 4508fdd282 The file countries.php does not exist in lang/en, only in lang/en_utf8. Therefore the fallback default in the function get_list_of_countries() should always be en_utf8. 2006-09-03 11:39:54 +00:00
gustav_delius 6a2f9ca922 Remove undefined variable notice 2006-09-03 11:22:48 +00:00
moodler a565cb2f8e Automatic installer.php lang files by installer_builder (20060902) 2006-09-02 02:44:29 +00:00
gustav_delius bf9cdc2b90 Fix by Jesse Scott so that database sessions respect sessiontimeout setting. Closing bug 5912 2006-09-01 20:27:54 +00:00
ethem 19660487d0 + Don't show AVS message if not applicable.
+ Email message that translated instead of english if cc will be autoconfigured.
2006-09-01 14:39:52 +00:00
gbateson 5ab3937c6e correct the detection of HotPot 2.0 backups (from Moodle 1.5) 2006-09-01 03:58:09 +00:00
ethem 22fa4da34f New feature: Autoconfigure credit card types, if the merchant does not accept this type of credit card; Backported from HEAD. 2006-08-31 07:35:16 +00:00
ethem 0ee1574512 New feature: Autoconfigure credit card types, if the merchant does not accept this type of credit card; Backported from HEAD. 2006-08-31 07:29:44 +00:00
skodak b02b2f70d7 better input validation in files/index.php SC#307; backported from HEAD 2006-08-30 08:04:43 +00:00
gbateson 0679583490 convert relative URLs to absolute URLs in quiz questions and answers 2006-08-30 07:54:48 +00:00
moodler 5ba8b19939 Automatic installer.php lang files by installer_builder (20060830) 2006-08-30 02:46:44 +00:00
skodak 4d21686218 better handling of anchor name in docs index SC#306; backported from HEAD 2006-08-29 20:39:24 +00:00
ethem 79cd394c82 fixo 2006-08-29 08:11:04 +00:00
skodak 18e2de4313 show detailed log messages only when debug is not off SC#303; backported from HEAD 2006-08-28 21:34:39 +00:00
skodak 0eeec1a96f create safer .htaccess SC#302; backported from HEAD 2006-08-28 21:13:12 +00:00
mark-nielsen 4e2cbb28e5 MDL-6325 Bug Fix 2006-08-28 20:01:13 +00:00
gustav_delius 5a521aa30f Small correction in the documentation for the $CFG global 2006-08-28 08:59:57 +00:00
moodler 01b9db69e2 Automatic installer.php lang files by installer_builder (20060826) 2006-08-26 02:50:02 +00:00
mark-nielsen 91bfeb65ea MDL-6323 - Fixed - changed feedback to response 2006-08-25 22:51:24 +00:00
mark-nielsen 16ae471c30 Removed undefined index notices by using empty to make sure the index exists 2006-08-25 18:27:12 +00:00
danmarsden e22b34ec32 MDL-4493 issue with 405 pages for IIS users - must specify actual page, as the notice function does a post - you cannot use the POST Verb on a directory in IIS. 2006-08-24 02:10:01 +00:00
tjhunt 7025366210 MDL-6338 - Short answer questions with ' in the answer don't work. Yet another unpleasant quiz bug caused by the current broken way we do things with addslashes. 2006-08-23 18:53:40 +00:00
stronk7 e133c32ff3 Adding one PHP close tag that has been missing (but working) since years! 2006-08-23 15:18:20 +00:00
stronk7 84e6ee9c38 Bump to 1.6.2 (no DB changes) 2006-08-23 15:04:05 +00:00
thepurpleblob 4c831b7078 bug MDL-5458
XML format now supports Essay questions
Improved the comments
2006-08-23 14:54:05 +00:00
skodak cd79115069 debug off level is now 5 instead of 7 to prevent E_WARNING on production sites SC#294 2006-08-22 22:19:54 +00:00
skodak cd1e684b2c fixed trailing whitespace in last commit :-( 2006-08-22 22:09:33 +00:00
skodak d67514acb8 Rewritten help.php by Tim Hunt with minor fixes - SC#292 2006-08-22 22:03:08 +00:00
tjhunt 0d4537c796 SC 299 2006-08-22 21:33:27 +00:00
skodak fdb76e639f fixed some notices in scheduled backup 2006-08-21 20:38:44 +00:00
stronk7 e59fded4ef Solved hh (horrible-hidden) bug in backup_scheduled code.
Credits go to Thirot Jean-Luc. http://moodle.org/mod/forum/discuss.php?d=52156
2006-08-21 19:06:38 +00:00
tjhunt 8529d9b6d8 Bug #6305 - Quiz settings form field order could be better - proper fix this time.
Sorry, I screwed up with the previous revision. This is the proper fix. Diff this with revision 1.61 to see what the change really is, and ignore 1.61.2.1.
2006-08-21 10:07:48 +00:00
tjhunt c23339e968 Bug #6305 - Quiz settings form field order could be better. 2006-08-20 20:10:15 +00:00
tjhunt 5fc3c306f4 Bug #6303 - True / False applies penalty factor wrongly. 2006-08-20 15:37:06 +00:00
moodler 207793f82f Automatic installer.php lang files by installer_builder (20060819) 2006-08-19 02:47:51 +00:00
tjhunt 2b64c31597 Bug #6293 - Cannot regrade a question when a teacher has added a comment with a ' Stupid, wreched, datalib. Why can't datalib take care of addslashes, so the whole of the rest of the code can forget about it? That is how a database abstraction layer should work. I know, it is pointless to moan about it, but it has just cost me 3 hours, so I feel I have earned the right to moan. 2006-08-18 22:34:25 +00:00
tjhunt f7abe85cc0 Code cleanup. 2006-08-18 22:25:39 +00:00
tjhunt 5cd1517bc3 Fix some Eclipse code warnings. 2006-08-18 21:21:59 +00:00
ethem 7ecefcb090 Colorize refunds and show refunded total.
Red: Refunded/Pending Settlement
Green: Refunded/Settled
Black: Cancelled

Backported from HEAD(1.25-1.26)
2006-08-18 16:11:30 +00:00
ethem 7a23b4d63c Display capture/void/delete instead of 'Yes'. 2006-08-18 14:48:41 +00:00
tjhunt 00c5890a15 Bug #3481 - wildcard problem in cloze question. Thanks to Joseph Rezeau. 2006-08-18 10:28:15 +00:00
tjhunt 45cd0cfde8 Changed include to use dirroot not wwwroot. 2006-08-18 08:05:45 +00:00
skodak 0a861d4506 Bug #6276 - Multiple questions not showing up from scale page 2006-08-17 21:33:26 +00:00
tjhunt dcd2895639 Bug #6277 - Missed function renaming in question/format/multianswer. 2006-08-17 17:37:54 +00:00
ethem b88378acb9 Allow teachers to cancel refunded transactions if admin set up $CFG->an_teachermanagepay.
enrol_authorize.courseid must be passed to authorize_get_status_action function; Joined 2 tables to get courseid field.
2006-08-17 15:30:20 +00:00
moodler 06bbfff66e Automatic installer.php lang files by installer_builder (20060817) 2006-08-17 02:54:23 +00:00
tjhunt da4714358a Bug #6267 - questionlib.php delete_question infinite loop with rantom questions. Thanks to mbockol at carleton dot edu. 2006-08-16 16:16:42 +00:00
moodler 48e2bf159a Automatic installer.php lang files by installer_builder (20060816) 2006-08-16 02:52:23 +00:00
thepurpleblob 48b358ba56 Bug #6231. Question name truncated to 250 characters. 2006-08-15 14:38:38 +00:00
skodak 029d0a28bd $CFG->debug=0 from config.php is not overriden by setup.php anymore SC#293 2006-08-14 20:55:58 +00:00
skodak c26ac7924f adding proper checks that the requested help file exists SC#292 2006-08-14 20:07:35 +00:00
moodler 51034f13f8 In rare cases (some timezones?) this while loop went forever because
$timestart == $nextmidnight

which led to disks filling up   :-(
2006-08-14 15:19:36 +00:00
moodler a1ecd20a19 Merged fixes from HEAD 2006-08-14 09:01:31 +00:00
skodak a7ea2d7dcc prevent access to filters when disabled in filter settings SC#291 2006-08-14 06:22:15 +00:00
tjhunt 915db857b8 SC 289, small, but non-exploitable hole in backup permissions checking. 2006-08-13 20:25:46 +00:00
moodler 6c05439a08 Automatic installer.php lang files by installer_builder (20060813) 2006-08-13 02:51:13 +00:00
skodak b5c240e397 fixed format_text caching - now respects text format, current language and course id (lang fix is needed for my multilang filter rewrite ;-) 2006-08-12 12:41:55 +00:00
stronk7 e8e814e5c7 An example of how one unitialized variable can generate really
dificult-to-trace bugs. Thanks to Jens Gammelgaard and support  B-)
(http://moodle.org/bugs/bug.php?op=show&bugid=6233)
2006-08-12 09:12:15 +00:00
bobopinna 0fc2503718 Fixed a problem during scorm update.
Now tracks are deleted only if the scoes are really changed
2006-08-11 12:21:23 +00:00
thepurpleblob f5c2ff517f Correctly reflect 1.6 match grades change and make it more clear about blank line usage - bug #6231 2006-08-11 10:42:19 +00:00
stronk7 74948bb2e7 Changing //TRANSLIT to //IGNORE because some weird bug
in the OS iconv libraries was breaking some texts.
2006-08-11 09:34:47 +00:00
thepurpleblob ec7a860ff5 Removed credits section (along with very out of date 'last-updated' bit). Doesn't seem appropriate any more. 2006-08-11 08:10:15 +00:00
skodak 0f69811d98 new function get_coursemodule_from_id() is now used for obtaining of valid $cm from coursemodule id SC#283; backported from HEAD 2006-08-10 15:30:49 +00:00
moodler 0b038e2d43 Automatic installer.php lang files by installer_builder (20060810) 2006-08-10 03:02:49 +00:00
toyomoyo 02f0217c20 fix a bug when user's lang is not set, fall back to site lang 2006-08-10 02:41:19 +00:00
skodak 105a8f399f obfuscation of the email addresses 2006-08-09 20:39:24 +00:00
skodak c071606525 Bug #6199 - A typo in edit.php 2006-08-09 19:45:41 +00:00
skodak dfa8b0f06a Bug #4936 - Highlighting a question text fragment with different color 2006-08-09 19:29:34 +00:00
skodak 8953a3b44f Bug #6225 - Moodle bug #4658 Breaks assignment type: Upload Single 2006-08-09 18:35:42 +00:00
skodak 6223b2eb1e Bug #6106 - HTML editor inserting unwanted hard return between images 2006-08-09 09:36:01 +00:00
bobopinna f4f18fb00c Fixed a bug in AICC package importing 2006-08-08 07:25:19 +00:00
moodler 98830278dc Automatic installer.php lang files by installer_builder (20060808) 2006-08-08 02:50:28 +00:00
skodak 2928e3d2d6 Swf now disabled by default in Mediaplugin and added explanation SC#284 2006-08-07 14:48:51 +00:00
moodler ea07be815b Automatic installer.php lang files by installer_builder (20060806) 2006-08-06 02:52:42 +00:00
bobopinna 10d7f1525d fixed a problem with Explorer and popup windows 2006-08-04 13:49:00 +00:00
bobopinna d51d6583a7 Fixed a problem with explorer and popup windows 2006-08-04 13:41:54 +00:00
bobopinna 6703e4af2d removed object tags. I'm thinking to return to frameset... 2006-08-04 13:01:35 +00:00
martinlanghoff 530c61afe7 login: forgot password now works for guest again (bug #6214) 2006-08-04 06:11:34 +00:00
martinlanghoff 58c98fa207 mod/assignment if we are not using a numeric scale and a custom scale
return that as the max grade


Author: Jun Yamog <jun@catalyst.net.nz>
2006-08-04 05:47:37 +00:00
tjhunt beb6c6cdb7 Bug #6206 - Quiz can't be created on some mysql configurations 2006-08-03 16:30:21 +00:00
tjhunt 964f6d4f17 Bug #6048 - Fix 'are you sure you want to start an attempt' warning. Backported from HEAD. 2006-08-03 14:51:34 +00:00
moodler 905c6f3261 Pushing beyond 1.6.1 2006-08-02 06:18:26 +00:00
moodler e1210ad3c3 Automatic installer.php lang files by installer_builder (20060802) 2006-08-02 02:49:38 +00:00
toyomoyo 2492b30859 fix for 6178 2006-08-01 05:10:33 +00:00
ethem 8e9f9bec69 Don't show authorize.net password for security reasons. 2006-07-31 12:30:44 +00:00
skodak 47c8660050 Bug #6146 - Smiley popup can not be translated 2006-07-31 10:26:18 +00:00
skodak 8860ceb4d2 fixed warning when no referer available 2006-07-31 10:04:18 +00:00
skodak a45c1d139a Bug #6168 - missing link for course request - fixed 2006-07-31 09:17:53 +00:00
skodak ecdb04ca06 Bug #6168 - missing link for course request 2006-07-31 09:14:13 +00:00
martinlanghoff 0f7fcc8377 Backing out fix for bug #4874 2006-07-31 05:56:48 +00:00
martinlanghoff 4b8df782c6 Bug #6147 - Upgrade from 1.5.x breaks with Postgres 7.4.x
Even though Postgres 7.4.x is officially supported, several upgrade scripts use syntax that only works in Postgres 8.x. and it's impossible to finish the upgrade.

The attached patch fixes those scripts.

Saludos. I?aki.

Author: I?aki Arenaza
Review: Jun Yamog, Martin Langhoff
2006-07-31 05:38:20 +00:00
martinlanghoff 3ad4a1097b assignment: count_user_files() no longer creates extraneous dirs (bug#4658)
Applied the fix by Samuli.Karevaara, from the bug report - the directory is checked for existence beforehand.
Previously it was created if it didn't exist, then the files within it were counted.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:57:08 +00:00
martinlanghoff 21c2f2ef29 wiki: Added a link to force reloading of the page (WR#515)
The link allows the page to be reloaded, which saves people from only seeing the cached copy. This is the equivalent of doing Shift+Reload in most
browsers.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:55:59 +00:00
martinlanghoff c58f4f10b3 forum: notification of a moved dicussion (bug#4874)
Moving a discussion now leaves a notification message in the
original location with a link to the new location.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:54:06 +00:00
julmis 9978506b11 Removing formathtml function since it is never going to work. 2006-07-30 23:16:12 +00:00
julmis 980b1e04bc Trying to get rid of insert link bug once and for all 2006-07-30 23:07:49 +00:00
skodak 0fc71cc508 SC #280 force downloading of database files 2006-07-30 22:43:58 +00:00
skodak 9a0d8fd2b3 Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup 2006-07-30 22:23:43 +00:00
skodak d2b00aae1d Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup 2006-07-30 22:18:14 +00:00
skodak 2a94a64a06 Bug #6135 - Reduce unnecessary use of strtolower to make non-English languages look better 2006-07-30 21:46:31 +00:00
skodak d7a5c75f30 Bug #6176 - locale setting on config variables page not functioning correctly 2006-07-30 10:30:07 +00:00
moodler 54ac3dd31a Automatic installer.php lang files by installer_builder (20060730) 2006-07-30 02:49:23 +00:00
skodak be029bdf25 Bug #6181 - icelandic doesn't migrate 2006-07-29 09:43:36 +00:00
skodak b573d77752 Bug #6183 - typo in clean_param() description 2006-07-28 20:56:21 +00:00
urs_hunkler db5219aacd adding missing icons 2006-07-27 19:51:21 +00:00
skodak 9a2539db21 Fixed Call to undefined function: print_progress() in /usr/share/moodle/admin/upgradeforumread.php 2006-07-27 11:48:19 +00:00
ethem dd241f341a Select records as tablename.fieldname when joining tables.
Someone, can add  these fields userid,courseid to course table . :)
2006-07-27 11:23:25 +00:00
ethem fe2bc06329 Bug: Column 'timecreated' in where clause is ambiguous.
We joins 2 tables: course and enrol_authorize.
We didn't select course.timecreated, but it gives this error.
2006-07-27 10:49:54 +00:00
moodler 58643a8110 Automatic installer.php lang files by installer_builder (20060727) 2006-07-27 02:52:30 +00:00
moodler 1a10d9049f Automatic installer.php lang files by installer_builder (20060726) 2006-07-26 02:45:50 +00:00
ethem 4221b8647c Cron error: When authorizenetlib.php require enrol.php, it includes admin/enrol.php. Interesting. Solved as $CFG->dirroot.'/enrol/authorize/enrol.php 2006-07-25 17:34:00 +00:00
ethem 8fd49aa444 New string: costdefaultdesc
<strong>In course settings, enter -1</strong> to cost field to use this default cost.
2006-07-25 17:03:55 +00:00
ethem d91f79789a New string: costdefaultdesc
<strong>In course settings, enter -1</strong> to cost field to use this default cost.
2006-07-25 16:58:22 +00:00
ethem 5eeebefba9 Sometimes ssl connections are slow. Increase max_execution_time to 5 minutes. 2006-07-24 16:27:51 +00:00
tjhunt 87cb44ac9f Bug #6157 - lang strings using concatenation, not $a. 2006-07-24 14:35:03 +00:00
ethem 644600315c * Update record as soon as possible. If update/insert record fails email to admin to have update manually.
* ignore_user_abort(true) at critical section (before fwrite($fp, "POST /gateway/transact.dll).
   This is last change to ignore request for user.
 * Made some functions "static" to call function directly. So, no need new enrolment_plugin_authorize() instance.
   Now, these are static:
   get_list_of_creditcards, zero_cost, get_course_cost, prevent_double_paid, email_to_admin, check_openssl_loaded
 * Some mtrace cleanup. Removed default new line.

This is big work. When PHP5 is required for moodle in the future, I will add static modifier to functions.
Now and future, this plugin is/will unbreakable. :)
2006-07-24 11:42:17 +00:00
skodak 905fdcaa31 Bug #6159 Site settings interface typo - Combo list - my first commit form UK MoodleMoot :-) 2006-07-24 10:31:21 +00:00
danmarsden a97a4a87bd Bug #5882 ldap enrolment doesn't work. $USER->student getting munged 2006-07-24 00:32:06 +00:00
danmarsden c3d36a923f Bug 6130 session has bad entries causes calendar to fail showing events
Workaround untill Session is fixed properly.
2006-07-24 00:14:07 +00:00
danmarsden 3cfe476b39 Fixes for Bug 5749 and Bug 5750
summary of bug 5749 and 5750
fixes for: function causes timeout when deleting temporary files for large scorm objects
scorm\validate.php calls function scorm_delete_files from scorm\lib.php - but lib.php not included in validate.php

Validation of Scorm objects broken - adds entry in modules database even when scorm object is not created.
2006-07-23 23:40:00 +00:00
danmarsden 146a1735ac Fix for Bug 6119 - gives error when choice full, and user submits a choice they have already selected 2006-07-23 22:12:40 +00:00
danmarsden 8dc6117433 fix for Bug #4733 title gets garbled when html inside title. 2006-07-23 22:03:39 +00:00
moodler 08f72e477c Automatic installer.php lang files by installer_builder (20060722) 2006-07-22 02:46:09 +00:00
tjhunt d1c93d9605 Replace a few odd tabs with spaces. 2006-07-21 08:01:34 +00:00
stronk7 eede7619ef Bump to 1.6.1. No DB changes. 2006-07-21 07:55:35 +00:00
tjhunt bf6f63ae00 Bug #5946 - matching question php notice 2006-07-21 07:19:04 +00:00
urs_hunkler 2f1dff3561 corrected bug with teacher rights 2006-07-21 04:53:08 +00:00
urs_hunkler d0b4e8226f corrected a bug with teacher rights 2006-07-21 04:49:47 +00:00
gbateson 889d2b5ead microincrement version to 2.1.21 2006-07-21 00:10:29 +00:00
moodler 43935e12c9 Bump to 1.6.1 2006-07-20 23:43:47 +00:00
skodak ad44e5c049 fixed minor PHP5 compatibility problem with clone() 2006-07-20 06:53:29 +00:00
skodak 4075eb10da Bug #6075 - file admin/index.php is ISO encoded - headers broken by ob_end_flush(), fixed version check 2006-07-20 06:38:12 +00:00
skodak 10bafd3d21 Bug #6141 - Cron output is not plain text - <pre> and missing encoding, minor lang issues 2006-07-20 06:35:25 +00:00
skodak 605737cdfb Bug #6097 - HTML editor and brackets - fixes lesson problems 2006-07-20 06:30:10 +00:00
ikawhero 595eda8d9c Fixed typo. 2006-07-20 00:42:56 +00:00
skodak 56def90b83 yet another fix for course list for guests 2006-07-19 13:57:57 +00:00
skodak 74f6a9fb7e fixed course list for guests 2006-07-19 13:43:40 +00:00
skodak 8e764b36b1 admin should not see list of courses on the frontpage when there are too many of them 2006-07-19 13:33:18 +00:00
skodak 93f973f08b fixed course/index.php category display affected by previous commit - improved category and course list display on front page 2006-07-19 13:15:11 +00:00
skodak 4e7d821b34 section not always moved when requested - page reloading prevented by anchor; added random parameter to force reloading 2006-07-19 12:49:55 +00:00
skodak 31c46027aa Bug #6093 - Removed course sections re-appear after moving existing sections 2006-07-19 12:28:41 +00:00
skodak 4e2b4b1bc2 Improved category and course list display on front page- see bug Bug #5965 - Frontpage Category List also showing courses; new Combo List(categories + courses), fixed categories list and separate settings for not logged in / logged in users 2006-07-19 12:01:38 +00:00
moodler 2fa6e1ff26 Added missing global 2006-07-19 10:17:48 +00:00
moodler e63dc8ea91 Just simplifying logic a little 2006-07-19 10:16:15 +00:00
skodak 8c251d1a93 Bug #6136 - Hard coded admin paths 2006-07-19 07:59:16 +00:00
stronk7 4985c39b50 minor bump to perform some changes on grade_letter 2006-07-18 16:23:28 +00:00
stronk7 4f1c93d6dc Fixing one recently added DB upgrade. Please be careful on STABLE! ;-) 2006-07-18 16:22:36 +00:00
tjhunt 96ef5c792a Fixed typo which caused images in questions to fail to display if NOT using slasharguments. Merged from HEAD - original checkin was 1.49 to 1.50 by danstowell. 2006-07-18 15:37:17 +00:00
tjhunt e10e4fdd55 Bug #6033 - missing string for unknown questiontype. Also tidied up some messy code. 2006-07-18 15:27:50 +00:00
tjhunt f2ea23a1bd SC#277 2006-07-18 13:32:54 +00:00
tjhunt 6b319a8087 Bug #6116 - Quiz database upgrade scripts call renamed function by the old name. 2006-07-18 10:58:40 +00:00
urs_hunkler 172d326c41 enhancements and bugfixes, works now in Safari and Konqueror 2006-07-18 09:06:06 +00:00
urs_hunkler 8d6c9a68b1 some style updates 2006-07-18 07:22:06 +00:00
skodak e2337127eb Bug #2149 - admin/creators.html javascript error 2006-07-18 07:16:29 +00:00
skodak 462a25fe75 Bug #6134 - error of coding, in function grade_download_form() 2006-07-18 06:42:21 +00:00
martinlanghoff 8a774fddb7 Close Bug #5670 - get_courses_page() - remove costly and redundant DISTINCT
get_courses_page() uses get_records_sql() which means that it will actually
break if the first field requested isn't c.id. This in turn means that
the DISTINCT is not needed at all.

So let's go fast again!
2006-07-18 04:35:45 +00:00
martinlanghoff 059366fe22 Course restore - Restrict shortname to <= 15 characters, like the database table.
Author: Donal McMullan <donal@catalyst.net.nz>
2006-07-18 03:32:51 +00:00
moodler 834f10e9b2 Automatic installer.php lang files by installer_builder (20060718) 2006-07-18 02:42:48 +00:00
toyomoyo 14080bd00a fixed a bug where user can view site posts when not logged in 2006-07-18 02:27:17 +00:00
martinlanghoff 23ea06dfbe auth/db: When using internal passwords we must register auth_update_user_password()
Now users can update their password correctly. We did have this before, I
wonder if it got dropped in a merge.
2006-07-18 01:34:19 +00:00
martinlanghoff 8d2529e59e auth/db: use auth_validate_form() to set auth_db_stdchangepassword when passtype is 'internal'
When using the 'internal' password handling, set auth_db_stdchangepassword
so we allow users to change their password normally.
2006-07-18 01:33:45 +00:00
martinlanghoff 8f527a42ee auth: extend API to support auth_validate_form()
Now Auth plugins can register auth_validate_form to get a chance
to validate config form input. Needed on MOODLE_16_STABLE to fix
a bug with auth/db.

The auth API must follow suit with the enrol API, where we can safely
do method_exists().
2006-07-18 01:31:45 +00:00
jgraham909 f8100e3629 Fix for grade_letter table and how MySQL version 5.0.3+ handles DECIMAL
fields

Versions: 5.0.3+ truncate to 99.99 if a value of 100.00 or greater is
input for grade_high or grade_low.

See the following for more info:
http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html
2006-07-17 22:38:58 +00:00
skodak 25cbc9d08f Bug #1395 - Calandar view.php should respect forcelogin 2006-07-17 21:07:06 +00:00
skodak 88e912b1b1 Bug #6129 - Incorrect glossary import file size limit 2006-07-17 13:34:17 +00:00
tjhunt 31222bc4ef Bug 5840 - Image not displayed in Cloze question. 2006-07-17 08:47:29 +00:00
skodak 34db6d30a0 Bug #6120 - Course creation - loginproblem 2006-07-17 08:38:45 +00:00
skodak 63d337cf47 correction - bug 6130, not 3130 2006-07-17 07:29:46 +00:00
skodak 285105fbf1 workaround by Dan for bug #3130, fixed some warnings 2006-07-17 07:28:54 +00:00
martinlanghoff b1682ee480 enrol API: Updated documentation 2006-07-17 06:01:31 +00:00
stronk7 226f066ed5 Close properly the showentry page. Bug 5986.
(http://moodle.org/bugs/bug.php?op=show&bugid=5986)
2006-07-16 08:59:33 +00:00
gbateson 08a1da2bb9 micro-increment version number to v2.1.21 2006-07-16 06:54:53 +00:00
gbateson 9b2f93bcf3 add double quotes to index fields to avoid reserved words errors in pg7. correct setting of default values in HotPot 2006050201 which was incompatible with pg7.3 2006-07-16 06:53:41 +00:00
moodler ec64d5223d Automatic installer.php lang files by installer_builder (20060716) 2006-07-16 02:40:00 +00:00
gbateson 6ce20e4d58 initialized objects using new stdClass() and adjusted use use of empty() and isset() in hotpot_restore_records() function 2006-07-15 14:28:22 +00:00
gbateson e48bc9eb25 fixed setting of empty secondary fields during restore (bug 6113) 2006-07-15 13:47:09 +00:00
stronk7 74b29acec4 Soled bug 6089 plus some minor iteration savings...
(http://moodle.org/bugs/bug.php?op=show&bugid=6089)
2006-07-15 08:38:19 +00:00
skodak 613b02036f Bug #6080 - Loancalc block doesn't define a footer string 2006-07-14 21:04:27 +00:00
skodak 495f166ec4 todo: add detection of incorrect chars in wwwroot 2006-07-14 20:56:16 +00:00
tjhunt d0f8a899f8 Bug 6111 - Rewrite the code for making an indented list of question categories, becase the existing code was so horrible. 2006-07-14 15:32:57 +00:00
moodler 0183254bc5 Automatic installer.php lang files by installer_builder (20060714) 2006-07-14 02:39:22 +00:00
skodak bbdb1c3815 Bug #6099 - Restore alternatively failing on data module - fixed status codes of module restore process 2006-07-13 15:33:37 +00:00
moodler e9dbe49121 Document $CFG->allowvisiblecoursesinhiddencategories 2006-07-13 14:17:49 +00:00
moodler e714706c42 In Moodle 1.6 the behaviour of course access was changed so that visible
courses would be invisible if they were within a hidden category.

However, the old behaviour was useful in many instances, so I've added
a $CFG->coursesinhiddencategoriesarehidden that will return to that old
behaviour if required.
2006-07-13 13:58:14 +00:00
moodler f450edd426 Updates to assignment language file to support upload assignment type
(which is not in 1.6, it's 1.7, but should work in 1.6 in case people
want to try it already)
2006-07-13 07:42:13 +00:00
mark-nielsen 09447862c0 [BugFix] Bug #5466 - Cluster and End of Cluster pages no longer display scores in extended editing view. Also added page type display for cluster and end of cluster pages in the extended editing view (which is displayed for all other pages as well). 2006-07-13 00:34:20 +00:00
skodak 96856b5798 Bug #6087 - alphabetic problem in glossary 2006-07-12 20:28:21 +00:00
moodler 28e58deb41 Automatic installer.php lang files by installer_builder (20060712) 2006-07-12 08:18:08 +00:00
moodler ab6508500c FIxed bad lines 2006-07-12 08:12:16 +00:00
moodler 0b32ca3ba0 Removed bad lines 2006-07-12 08:11:24 +00:00
moodler 9a2e6ce88c Automatic installer.php lang files by installer_builder (20060712) 2006-07-12 08:08:58 +00:00
martinlanghoff 070a7cc0c2 Fixing up broken language packs for sm and to in install. 2006-07-12 06:31:46 +00:00
skodak 2277cfb8fb fixed printing of filenames from zip archives - SC#273 2006-07-12 05:54:37 +00:00
martinlanghoff 551d2b59bf chat: Prevent user from submitting a 2nd message before his 1st is received.
Some users reported that mod/chat was silently dropping some messages. The
user's browser may not be able to keep up with the rate at which he submits
chat messages. This update keeps things sane.

Author: Donal McMullan <donal@catalyst.net.nz>
2006-07-12 02:28:37 +00:00
tjhunt 7203acd306 Bug #6077 - Teacher saving their grades destroys student essay! 2006-07-11 16:10:56 +00:00
moodler 07f579d0bd Automatic installer.php lang files by installer_builder (20060711) 2006-07-11 14:22:47 +00:00
moodler 732581eb56 Manually fixed 2006-07-11 14:14:15 +00:00
skodak 344c23c0ef better cleaning of $file parameter SC#276 2006-07-11 13:18:59 +00:00
skodak b515688ddb workaround for Bug #6035 - editing quiz in one tab changes quiz in other 2006-07-11 13:00:34 +00:00
skodak 76f8821cfc Bug #6067 - The restore process behaves differently depending on which module contains the absolute links 2006-07-11 10:00:02 +00:00
moodler 95e34d9299 new installer.php files added. (stronk7) 2006-07-11 09:41:13 +00:00
toyomoyo bc77686a08 changed feedback in the function that handles user table 2006-07-11 03:35:19 +00:00
moodler 720669a6db Automatic installer.php lang files by installer_builder (20060711) 2006-07-11 02:39:43 +00:00
skodak d6b7aa9c25 Bug #5988 - Branch Tables in 1.6+ (Lesson Module) 2006-07-10 22:38:45 +00:00
skodak 4287b1f51b Bug #5732 - Lesson Scores &quot;out of XX&quot; marks report incorrect mark 2006-07-10 21:51:20 +00:00
ethem 2dc90eb90e - authorize_expired function added to lessen the code.
- All functions in authorize plugin are named with authorize_ prefix.
2006-07-10 09:43:00 +00:00
moodler 243c0e302a Merged fixes from HEAD for missing backup data 2006-07-09 16:26:37 +00:00
mudrd8mz f392379a36 Replaced by improved lang.php from HEAD which is now considered as stable. 2006-07-09 15:20:34 +00:00
skodak 8fdaba4020 Bug #6050 - import glossary entries to new glossary not creating new glossary 2006-07-07 19:53:28 +00:00
thepurpleblob 7e1a25bbdd Note that 'span' tags are permitted as well as 'lang' in multi-language
filter
2006-07-07 10:36:01 +00:00
skodak d8b7f70be3 fixed warning in glossary export 2006-07-06 21:25:42 +00:00
skodak ca567fc69b Bug #5820 - IE returns unsecure items with SSL on login 2006-07-06 15:51:17 +00:00
thepurpleblob ef1c5c394e Bug #4375 - did not work correctly in blocks. 2006-07-06 14:00:43 +00:00
ethem f5a4f9a980 Some outputting debugging info for cron. 2006-07-06 13:23:05 +00:00
ethem 905c4d38ad Performance for welcome message sending to students.
Order by students.
Dear student, welcome to these courses:
Coursename1
Coursename2
Coursename3

This sends an email for each student.
2006-07-06 11:57:43 +00:00
ethem 2044f30ec3 New string: welcometocoursesemail 2006-07-06 11:53:02 +00:00
tjhunt 52bf72770c Bug 6031 - missing parameter for warningmissingtype in libquestionlib.php 2006-07-06 11:09:03 +00:00
skodak 3294198a19 Bug #4698 - Login block is broken!, improved cookie test 2006-07-06 10:09:34 +00:00
tjhunt 68f039dedf 6030 - Can't move question categories back to the top level. 2006-07-06 10:07:02 +00:00
skodak 8c68b750a8 Bug #5921 - editing forum post bug 2006-07-06 10:00:08 +00:00
skodak de288c6099 Bug #5615 - Assigment listing shows duplicate names with paged display 2006-07-06 09:46:49 +00:00
thepurpleblob 39c18c39d1 Bug #4838 - removing spurious blank line at end 2006-07-06 08:36:38 +00:00
martinlanghoff 05a289bf1f wiki: fix for IE6 bug with HTMLArea, where the text area is not drawn
IE6 measures a page element and - sometimes - it does this before the
element is drawn, so the dimensions it finds are zero. This update sets
sensible minimum for the width.

Author:  Donal McMullan <donal@catalyst.net.nz>
2006-07-06 05:35:47 +00:00
martinlanghoff 904bd828c7 wiki: Fix for broken view on new (empty) wiki pages.
The wiki should display the 'edit' screen when a user tries to view a page
that doesn't exist. This output should not be filtered.

Author: Donal McMullan
2006-07-06 05:06:07 +00:00
ethem 27b1d9d581 Daily cron seperated from main cron for performance.
To do:
Performance for welcome message sending to students. Group by student and courses. Like this:
Dear student, welcome to these courses:
1- Coursename 1
2- Coursename 2
3- Coursename 3
2006-07-05 16:54:43 +00:00
thepurpleblob cdc03b2a02 Bug #6011 - fixed bug dropping question name from cloze questions. 2006-07-05 12:38:51 +00:00
thepurpleblob 87e2569a2b Fix for bug #6013. Unable to import blackboard. Some of the changes
in moving to question banks had broken the format.
Also tidied up some notices.
2006-07-05 10:55:24 +00:00
tjhunt e4f8392813 Bug 6019: Quiz timer does not submit the form when it reaches zero. 2006-07-05 10:43:13 +00:00
skodak ce4af6df62 changed memory limit test in healthcenter 2006-07-05 08:37:32 +00:00
skodak a520b47745 healthcenter fixes - new extra whitespace detection, fixed automatic slasharguments detection 2006-07-05 07:41:51 +00:00
toyomoyo e1ddd943fb fixing a bug where global lang is not respected in user table 2006-07-05 01:53:43 +00:00
skodak cb43ec58fb fix for mysqladmin links 2006-07-04 09:39:21 +00:00
skodak c72387b7a0 removing healthcenter link in MOODLE_16_STABLE 2006-07-04 09:30:27 +00:00
skodak 57ba975b11 Bug #5909 - Fix use of user_group() because it returns arrays now - part 2 forum search fixed too 2006-07-04 08:30:16 +00:00
skodak 2cfa6389c8 fixed $site->id warning 2006-07-04 06:04:35 +00:00
skodak fc62b3ed36 Bug #6007 - &quot;The requested URL /course/report/log/view.php was not found on this server&quot; 2006-07-04 05:25:39 +00:00
moodler 825eadf070 Automatic installer.php lang files by installer_builder (20060704) 2006-07-04 02:39:44 +00:00
skodak 25e80a87f9 Bug #5909 - Fix use of user_group() because it returns arrays now - part 1 2006-07-03 21:07:41 +00:00
skodak fdfffda00f Bug #5974 - Course overview report should not error when stats are not up to date; fixed by changing the return value from stats_check_uptodate(), NULL is now OK, string value describes error and adding notify() where needed 2006-07-03 15:42:29 +00:00
skodak 173de2e8fa Bug #5991 - The calendar does not show the month's first day's event 2006-07-03 09:09:15 +00:00
skodak 9f1eaeda4f Bug #5995 - poor English in expiry notice 2006-07-03 07:18:58 +00:00
skodak daf27b51b4 Bug #5996 - block+resource=problem 2006-07-03 06:25:40 +00:00
moodler 2fe6249d41 Automatic installer.php lang files by installer_builder (20060701) 2006-07-01 02:39:58 +00:00
skodak 27e7895379 slashargument fix for healthcenter, better diagnostic messages; renamed file.php/pic.jpg option to file.php/1/pic.jpg because the course number is mandatory -continued 2006-06-30 13:39:04 +00:00
skodak 0b7911a748 slashargument fix for healthcenter, better diagnostic messages; renamed file.php/pic.jpg option to file.php/1/pic.jpg because the course number is mandatory 2006-06-30 13:38:05 +00:00
skodak 92a6edf143 cleanup in admin/index.php; preparation for health center, loginas gui, password salts 2006-06-30 12:54:41 +00:00
skodak 4a4c960d99 fixed // in course root when browsing files 2006-06-30 11:55:41 +00:00
tjhunt 2f12aae186 Bug 5967 - Missing lang strings and help for quiz reports. 2006-06-30 10:27:17 +00:00
skodak 1530745ba6 Bug #5961 - small grammar error 2006-06-30 07:33:16 +00:00
skodak bd93091c8a Bug #5802 - Incorrect length in http partial content (206) packets. 2006-06-30 07:21:55 +00:00
moodler 609784e0aa Automatic installer.php lang files by installer_builder (20060630) 2006-06-30 02:42:55 +00:00
skodak 7c58698a8a Bug #5937 - Fix nonascii chars in graphs:
* text is converted to unicode - no html entities anymore
 * then all nonascii chars are converted to decimal number entites
 * default.ttf is searched in dataroot/lang and local language packs too
 * removed lang_decode() - obsoleded by proper entity converison above
 * updated documentation in lang/en_utf8/fonts/README.txt
2006-06-29 21:19:10 +00:00
ethem 0cf39f9160 Put back last commit. If cost is 0, it always falls back to manual method. 2006-06-29 19:15:26 +00:00
ethem e65b5a1dce Bug #5941, Petr's patch is incorrect. Rewritten.
If course cost is 0 then always fall back to manual method. This is not authorize problem if enrolment key is empty and guest access with key.
2006-06-29 18:59:49 +00:00
ethem ec4fda2d3d Bug #5941, Petr's patch is incorrect. Rewritten.
If course cost is 0 then fall back manual method.
2006-06-29 18:13:03 +00:00
moodler e8b5984085 new installer.php file added. (stronk7) 2006-06-29 16:53:32 +00:00
ethem 0dafbf714a $teacher is used in manual form. No need global. 2006-06-29 15:00:17 +00:00
ethem 381cc85743 get_student_courses and get_teacher_courses functions added for future reference.
Cron description added.
2006-06-29 12:39:42 +00:00
ethem f59c789b28 Don't show choose method string if course cost is 0. 2006-06-29 11:25:04 +00:00
ethem f6c29f43ae New string. No cost yet. 2006-06-29 11:10:27 +00:00
ethem e99b6fb404 Interactive plugins (authorize and paypal ) must use 'manual'.
Some patches must be applied to lib/db.
http://moodle.org/bugs/bug.php?op=show&bugid=5941
Look: version.patch, lib_db.patch

Eloy, your question about enrol fields for interactive plugins were solved.
Now, we sure we never use authorize and paypal field for backup and restore.
Because manual is active and cannot be disabled when restoring.
Bug #5358 - Add support for enrol systems in backup/restore
http://moodle.org/bugs/bug.php?op=show&bugid=5358&pos=0
2006-06-29 10:24:08 +00:00
ethem a395180a81 Bug #5941 - Myriad of problems with Paypal enrollmemts, au_enrol.patch 2006-06-29 09:46:10 +00:00
skodak ce72ff9018 Bug #5944 - error message when moving thread 2006-06-29 08:00:48 +00:00
skodak 4314bcdd89 Bug #5952 - bad links in &quot;about wysiwyg editor&quot; 2006-06-29 07:19:44 +00:00
skodak d23f9f5d48 Bug #5953 - problem in /auth/ldap/lib.php 2006-06-29 07:03:38 +00:00
skodak 1eb6f0cd22 Bug #5955 - link to help item for html editor looks funny 2006-06-29 06:59:26 +00:00
skodak fee582844b Bug #5959 - save and view takes to wrong place 2006-06-29 06:52:48 +00:00
skodak 1c813b4080 Bug #5960 - can't delete or edit comments 2006-06-29 06:47:35 +00:00
moodler 993d8956ea Automatic installer.php lang files by installer_builder (20060629) 2006-06-29 02:40:22 +00:00
tjhunt e067c3a1f0 Bug #5918 - essay question comments from teachers lost in 1.6 upgrade. Thanks to Mark Nielsen the suggestion of how to fix. 2006-06-28 17:13:17 +00:00
skodak 1a833b5836 Bug #5941 - Myriad of problems with Paypal enrollmemts, part 3 - fixed 'login as student' button, now plain guest login action 2006-06-28 15:36:53 +00:00
skodak 48653e6c05 Bug #5941 - Myriad of problems with Paypal enrollmemts, part 2 - Login as guest not shown to guests and there is login link instead of paypal button for guests 2006-06-28 15:25:05 +00:00
skodak 804cc92184 minor loginas cleanup 2006-06-28 14:57:44 +00:00
ethem e5cf77cd19 Multienrol FIX: Move error message from this to manual plugin to show error message. This plugin is never inherited anymore. Each time, we create new manual_plugin() and this causes hiding error message. 2006-06-28 14:47:01 +00:00
skodak 0ea68a9cdd Bug #5941 - Myriad of problems with Paypal enrollmemts, part 1 2006-06-28 12:42:43 +00:00
tjhunt 6d812d61a2 Bug #5922 - comment from manualgraded questions lost during regrade. Thanks to Jean-Michel Vedrine for the fix. 2006-06-28 11:40:56 +00:00
tjhunt a9f56a8f0d Bug #5945: Lang string name missmatch when starting quiz attempt. 2006-06-28 10:10:28 +00:00
moodler 2dc8a5c519 Automatic installer.php lang files by installer_builder (20060628) 2006-06-28 02:39:18 +00:00
skodak 7bd9c89714 Bug #5927 - extending enrollments doesn't 2006-06-26 21:57:42 +00:00
skodak 24999ce035 Bug #5931 - blocks block database 2006-06-26 21:34:13 +00:00
skodak 31053d630f assignments on mymoodle page, Bug #5839 - Found more than one record in get_record_sql ! 2006-06-26 16:15:29 +00:00
skodak 01ac5c3191 fixed broken stats image link, Bug #5924 - User profile statistics tab 2006-06-26 13:47:52 +00:00
tjhunt 6aeb5a1f35 Bug 5889 - Regrading a quiz wipes student answers. Thanks to Jean-Michel Vedrine for the fix. 2006-06-26 11:21:08 +00:00
toyomoyo a73a0a6d8c fix for 5916, when blogs disabled do not print link of blog in profile 2006-06-26 08:30:32 +00:00
skodak d3d91e9a72 fixed Turkish problems see, Bug #5878 - Teachers can't add blog and blocks. 2006-06-26 07:21:13 +00:00
vyshane f64475c360 Using notify instead of error to display error message when purging of RSS
files fail during a discussion move between forums.
2006-06-26 03:59:28 +00:00
stronk7 459154ffbd Some minor changes in order to avoid some notices... 2006-06-25 10:15:31 +00:00
julmis b7504102dc commenting out ob_gzhandler. 2006-06-23 19:50:42 +00:00
toyomoyo 4590fe5598 added support for custom langs, and Eloy's change to 1000 record, see HEAD commit message 2006-06-23 01:51:36 +00:00
toyomoyo f7c1de925b added support for custom lang packs, and Eloy's change to 1000 records before system responds. Please see his commit msg on HEAD for details. 2006-06-23 01:48:18 +00:00
thepurpleblob 07ccf0a68d Fixed mix-up between MikTeX and MimeTeX. 2006-06-21 10:18:51 +00:00
toyomoyo 6408f30173 fix for 5881, no closing tag 2006-06-21 03:12:54 +00:00
moodler bdaee88fac Automatic installer.php lang files by installer_builder (20060621) 2006-06-21 02:43:53 +00:00
ethem 552f0e47dc Very small change. A little performance for cron if admin enabled sending email for pending orders expiring.
1- If dailysettlement is 00:05 and cron executes at this time, nothing will occur. If it is executes at 00:10 it works. I think "<" works faster then "<=" :))
2- Don't compare course->ids by authorize->courseid, because courses are grouped by courseid. We sure each line is unique.
3- Only get pendingorderexpiring strings for sending email if course teachers exist.
2006-06-20 17:07:56 +00:00
moodler 84331e061f Bump past 1.6 2006-06-20 14:58:55 +00:00
stronk7 de43be04ae helper string to explain $CFG->doctonewwindow added. 2006-06-20 14:22:14 +00:00
stronk7 54374e63f0 Now docs are showed in a new window based on $CFG->doctonewwindow 2006-06-20 13:51:47 +00:00
stronk7 294c6adb0a Added new option to decide if docs will be showed in a new window. 2006-06-20 13:40:27 +00:00
moodler 1c05b46ac2 Added back homelink to standard theme 2006-06-19 16:30:00 +00:00
moodler ddc6b0e31d Merged error fix for RSS deletion 2006-06-19 16:21:33 +00:00
moodler 1d9a81c347 OKAY! THIS IS IT! MOODLE 1.6! 2006-06-19 15:35:50 +00:00
moodler 262ec64be3 New tags file 2006-06-19 15:33:01 +00:00
moodler 4541181369 When the tags block is shown in a course context, then make the
links to blogs stay in the same context.
2006-06-19 14:16:42 +00:00
moodler 4d0036e8be Don't show users tab if you can't go there 2006-06-19 13:51:58 +00:00
moodler 0e83e4f5ca FIxed some missing headers 2006-06-19 13:34:46 +00:00
toyomoyo d40b3e1034 changed &amp;copy; to &#169 to validate better 2006-06-19 03:52:23 +00:00
toyomoyo 72343793f6 give IE a bit more time 2006-06-19 03:29:15 +00:00
moodler d4e8a03c53 Added new class FPDF_Protection (see Bug #5855). Code submitted by chardelle at lifeworkouts dot com, commited by vy-shane at moodle dot com. 2006-06-19 02:39:05 +00:00
moodler 6c979e8a24 Some changes to improve the UTF migration output a little 2006-06-18 10:09:12 +00:00
moodler 794e4a05a3 The forum search form was always wrapping no matter what I tried.
I swapped the textbox and helpbutton around (and got rid of one more table)
2006-06-18 08:20:48 +00:00
moodler d067b2005b Moved the "helplink" CSS span outside the help text and image. No effect on themes. 2006-06-18 08:09:51 +00:00
moodler c6d79e46d9 FIxed up the print_header calls 2006-06-18 07:44:21 +00:00
moodler 2b8a5e83ac Fix for resource parameters for users not logged in 2006-06-16 09:41:41 +00:00
moodler 2a1e7c302c Added check for $CFG->disablemycourses 2006-06-16 04:29:22 +00:00
toyomoyo 59b4825741 fixing centering of tabs on blog page 2006-06-16 02:58:44 +00:00
mjollnir_ 38d0c10e3c participants list last access filter should only show for teachers! I noticed this on moodle.org this morning :| 2006-06-15 21:33:06 +00:00
ethem 50d2685d0e $a->course: course information added. 2006-06-15 14:19:49 +00:00
ethem f187b7f98b $a->course: course information added. 2006-06-15 14:06:53 +00:00
ethem 0726456942 pendingordersemailteacher string added 2006-06-15 13:34:30 +00:00
ethem 1bf6b1cc18 pendingordersemailteacher string added 2006-06-15 13:29:10 +00:00
ethem efbd1fc514 When the number of pending orders expiring are sent to the teachers via email, which one is important? The number of the orders or the total of the amounts. 2006-06-15 12:23:46 +00:00
ethem 9900b2f103 If we enabled manual-capture and teachers can manage payment and teachers can be notified about pending orders expiring,
admins can also chooise that what is the sort of importance of expiring orders? 'Sum of total' or 'Count of orders' are emailed first.
You know that the amount of money is important :)
2006-06-15 10:30:55 +00:00
ethem 2716e73e9e Order by order count. Courses that have many orders are emailed first. 2006-06-15 07:45:18 +00:00
toyomoyo abe51bbed9 fix for 5633 2006-06-15 06:32:26 +00:00
toyomoyo cd09750495 fix for 5814 2006-06-15 03:23:47 +00:00
ethem 3377c60427 Email subject for pending orders expiring. 2006-06-14 16:30:46 +00:00
ethem 5242595975 Email subject for pending orders expiring. 2006-06-14 16:19:23 +00:00
tjhunt 2605a5ba8f Moved constant definitions out of function, so they are not run repeatedly giving lots of warnings. 2006-06-14 15:34:22 +00:00
tjhunt 1aa43ea576 Corrected reference to lang string. 2006-06-14 15:30:55 +00:00
ethem f12b2a7d5d If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:52:01 +00:00
ethem 834d5863b9 If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:33:00 +00:00
moodler c8825cfd2d Fix for bug:
Notice: Undefined property: id in /home/moodle/public_html/certificate/mod/forum/discuss.php on line 38

when user is not logged in and want to view a forum of type news.
2006-06-14 08:44:36 +00:00
moodler 380b3b305c Added missing $a to print_error 2006-06-14 03:15:34 +00:00
moodler 2ae294c9d6 Automatic installer.php lang files by installer_builder (20060614) 2006-06-14 02:37:39 +00:00
tjhunt cb82934b8d * Quiz module sometimes left the user staring at a blank page. Now there is an error message. 2006-06-13 18:58:17 +00:00
tjhunt c1c70a909a Bug #5812 - Standard theme font size CSS not sufficiently defensive 2006-06-13 18:52:17 +00:00
ethem 541ba098e7 Link to Payment Management page? 2006-06-13 18:29:28 +00:00
ethem c298a8b8e0 Link to help file 'Order Review'. 2006-06-13 18:02:24 +00:00
ethem 94863d1946 Help file for 'Order Review'. Merged from HEAD 2006-06-13 17:52:58 +00:00
ethem 6b8155d4a8 file orderreview.html was added on branch MOODLE_16_STABLE on 2006-06-13 17:52:58 +0000 2006-06-13 17:51:11 +00:00
ethem d9e4f9eb2a Handle also formatted time 00:30 for settlement time. 2006-06-13 15:59:11 +00:00
ethem d864c083c2 Predict the time of settlement at first time. Probably, admin user set up own country timezone and we can use this time as settlement time.
Function used: get_user_timezone_offset()
2006-06-13 15:24:28 +00:00
tjhunt 80970e2938 Bug #5810 missing ' > 7' in debug test. 2006-06-13 14:36:08 +00:00
vyshane c196e0f3cb Merged from 1.5. Fix for Bug #5767 - Section links block is removed from
course view after settings update.
2006-06-13 07:47:51 +00:00
tjhunt 5a6dba91bb Fix restore notice. 2006-06-12 15:35:28 +00:00
tjhunt 4600286cd2 Bug #5793: remember whether Show all has been clicked in the question bank. 2006-06-12 13:51:11 +00:00
tjhunt 4bbd7130f1 Bug #5790: Answer order for MC qtype not specified. Fix. Thanks to Peter Bulmer. 2006-06-12 11:03:11 +00:00
toyomoyo b862c77e93 proper html for help file 2006-06-12 07:24:24 +00:00
toyomoyo 1a149c0d33 a few mismatches between db and this html 2006-06-12 07:17:59 +00:00
toyomoyo 84f3391271 adding help file 2006-06-12 04:07:27 +00:00
moodler 1f66b55e6e Fixed hardcoded style widths in all formats 2006-06-11 06:47:43 +00:00
moodler 4339f32452 Removing hardcoded style widths and replaced with table widths, which improves page build appearance 2006-06-11 06:42:42 +00:00
stronk7 00b8db5f4f Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775)
the [[cntrl]] pcre class was breaking some chars. Changed to a safer
alternative. Bug 5777.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 23:31:21 +00:00
stronk7 b0bba0e704 Change the moodle_strtolower() function to use textlib services.
Also, mark it as deprecated, code should use text services directly.
Partially, bug 5777. It continues under investigation.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 10:38:27 +00:00
moodler d501331e75 Automatic installer.php lang files by installer_builder (20060610) 2006-06-10 02:36:19 +00:00
moodler ac9ed861a4 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 18:58:21 +00:00
moodler effa8cd5d1 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 17:19:42 +00:00
stronk7 3dbdb64c89 The absolutely incredible bug! It was working being wrong! Bug 5775.
(http://moodle.org/bugs/bug.php?op=show&bugid=5775)
2006-06-09 14:21:49 +00:00
ethem 660e6d5f9d Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:24:09 +00:00
ethem 277ea82b49 Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:18:16 +00:00
ethem dce99d41f4 Show 'name on card' string instead of moodle.php's user string. 2006-06-09 10:56:54 +00:00
ethem 44c4e47a1c Some config sections 'Order Review' moved to
an_teachermanagepay -> Site-Wide Settings
an_emailexpired: -> Email-Sending Settings
an_cutoff: -> Authorize.net Settings
2006-06-09 10:25:24 +00:00
stronk7 ba4f9b230f Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 10:00:47 +00:00
stronk7 2ba777cd5a Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 09:43:59 +00:00
stronk7 03b40486ca Avoid empty processing both for PLAIN_SQL_UPDATE and PHP_FUNCTION
Merged from HEAD
2006-06-09 09:18:35 +00:00
toyomoyo ea257a167e typo should be 0 not 1 2006-06-09 02:52:05 +00:00
toyomoyo a666b9dbcf disable the blog tag if blog is disabled 2006-06-09 02:44:49 +00:00
bobopinna 986a50e26d change advanced to parameters 2006-06-08 15:35:06 +00:00
bobopinna 625c8a70aa Fixed some language refinements 2006-06-08 15:24:23 +00:00
moodler 66a14b7292 Help content for available tags. 2006-06-08 08:26:50 +00:00
skodak 0a265f0fcd Bug #5663 - errors after changing grade weight 2006-06-08 06:38:08 +00:00
skodak be8137a81b Fixed course searching 2006-06-08 06:23:34 +00:00
vyshane 8bdb6d99a8 Added missing string norecentactivity. 2006-06-08 06:18:06 +00:00
toyomoyo 07c8c52cbf bug fix for 5748 2006-06-08 04:07:24 +00:00
toyomoyo b588ef46f4 changed recordset size to 50 2006-06-08 02:45:48 +00:00
stronk7 cdb048acd7 Solve one issue with skipped courses and email to admin
being set every xx minutes. Bug 5621.
(http://moodle.org/bugs/bug.php?op=show&bugid=5621)
2006-06-07 22:17:31 +00:00
ethem dd9a68560e Unnecesary strings removed. 2006-06-07 18:42:47 +00:00
skodak c731399ff1 Bug #5522 - question/restorelib.php error 2006-06-07 14:56:36 +00:00
skodak c8d483b80c incorrect course number in categories after course delete 2006-06-07 14:04:55 +00:00
vyshane 75775efcf7 Fix for Bug #5131 - RSS Feeds and Moving Discussions. 2006-06-07 08:16:01 +00:00
toyomoyo de8c6852d3 fix for 5720 2006-06-07 06:03:41 +00:00
toyomoyo 36d7c02847 fix for 5720 2006-06-07 05:56:59 +00:00
vyshane 64375cb146 Fixed bug: SCORM module window options were not being saved properly - array
values used instead of keys in scorm_option2text().
2006-06-07 04:34:29 +00:00
toyomoyo 1f7569c38a some javescript progress bar changes, 1) status updates correctly when resuming 2) table numbers is not hardcoded anymore 2006-06-07 04:30:50 +00:00
toyomoyo d636096334 changes are made to facilitate the migration of user table by row. function migrate2utf_user is added. This only affects mysql atm. Please help test and report bugs! 2006-06-07 04:09:37 +00:00
skodak 1f1a9a809c Bug #5659 - Problem with build-in buttons when creating templates 2006-06-06 20:54:16 +00:00
skodak fe19f91525 Bug #5734 - Enrolled students can't access metacourse after unhiding while logged in 2006-06-06 19:00:51 +00:00
tjhunt aea38264b5 Fix notices when you restore a course with an empty forum. 2006-06-06 17:23:42 +00:00
tjhunt 44e2500992 Bug #5559: revised fix - using better CSS class names. 2006-06-06 17:07:58 +00:00
stronk7 ecf140979f Adding two new strings for RESTRICTED tests in environmenlib. 2006-06-06 16:56:16 +00:00
stronk7 9531202c10 Now environmentlib supports RESTRICT sections (to be able to deny
any general test with more detail (the opposite to the BYPASS section)
(http://moodle.org/bugs/bug.php?op=show&bugid=5653)

Merged from MOODLE_15_STABLE
2006-06-06 16:15:35 +00:00
skodak a5436ee747 Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet 2006-06-06 15:11:34 +00:00
bobopinna 826067335c Fixed some regular expression Bug 5041 2006-06-06 14:33:10 +00:00
tjhunt d5306794ec Fix for calculated questions where each one builds on the last. 2006-06-06 14:27:45 +00:00
tjhunt 89905101b7 Fix notices from the quiz module on backup and restore. 2006-06-06 14:13:55 +00:00
tjhunt f6849778a7 Make cron a bit more rebust by changing the way the require is done. 2006-06-06 14:10:33 +00:00
skodak c0f904046c Bug #5678 - Question marks, single quotes in field name cause trouble - cleaning hack ported from clean_filename() 2006-06-06 10:15:49 +00:00
tjhunt 23da79eff2 Fix notice. 2006-06-06 10:10:07 +00:00
skodak 176d1229af Bug #5680 - Fixed duplicate field names 2006-06-06 09:34:23 +00:00
skodak 6aef11722c Bug #5444 - Import PowerPoint - PHP5 clone bug 2006-06-06 08:52:51 +00:00
vyshane 5218d67aca New stats admin report. This shares code with /course/report/stats. Basically
the same report, but in an admin context.
2006-06-06 04:18:16 +00:00
vyshane 9b037d3842 New files with required code after refactoring this report module. 2006-06-06 04:13:44 +00:00
vyshane 6481349eb3 Refactored this report module so that we can also use it from
/admin/reports/stats.
2006-06-06 04:09:31 +00:00
tjhunt 9abb0f813a Bug #5672: Make calculated questions less confusing to create. 2006-06-05 16:56:31 +00:00
tjhunt 914d8f5801 Fixed reference to incorrect language string. 2006-06-05 14:14:12 +00:00
ethem 7a553f06a3 Some cron performance. Run clean-ups and send email daily on settlement date.
an_nextmail config deleted, instead of old config new an_dailysettlement inserted into config_plugins table.
2006-06-05 12:58:16 +00:00
skodak a9fd047eea Bug #5725 - Assignment grading pop up windows do not close, broken by 4976 2006-06-05 12:17:20 +00:00
bobopinna b225c41b53 Fixed a typo 2006-06-05 08:23:34 +00:00
bobopinna 2d0ee29b15 Added class name for IFRAME element 2006-06-05 07:40:18 +00:00
bobopinna 0bfac2fe7a Fixed a modified name for some constants 2006-06-05 07:19:07 +00:00
skodak c7d9b99dae Bug #5715 - error message in messaging - notice lastaccess 2006-06-04 23:10:32 +00:00
skodak f87c87b9ba Bug #5721 - students cannot take quiz when course language set to French 2006-06-04 23:00:00 +00:00
skodak 88c0c27c83 fixed warning when no students graded yet (caused by useless assignment) 2006-06-04 21:34:14 +00:00
stronk7 395c75becd make_default_scale() now searches properly under
both dataroot and dirroot, defaulting to en_utf8. Bug 5719.
(http://moodle.org/bugs/bug.php?op=show&bugid=5719)
2006-06-04 15:17:03 +00:00
stronk7 b02e4ee384 report XXXX actions added. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:35:04 +00:00
stronk7 fae3f45758 course report xxxx actions now are supported on restore. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:00:02 +00:00
skodak 5d46f73a3c Bug #5716 - Impossible to turn off highlighted current topic 2006-06-03 23:46:50 +00:00
stronk7 1ac7d05730 course report xxxx actions must send courseid in the info field. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-03 20:33:44 +00:00
stronk7 27f60090f6 And some more (the last) notices out! Bug 5713.
(http://moodle.org/bugs/bug.php?op=show&bugid=5713)
2006-06-03 20:16:19 +00:00
stronk7 28dc928f43 And one more collection of innocent notices avoided. Bug 5712.
(http://moodle.org/bugs/bug.php?op=show&bugid=5712)
2006-06-03 20:00:10 +00:00
skodak 7fe8550e18 clarification for restrict modules option - bug #5688 2006-06-03 19:57:42 +00:00
stronk7 c9aecec6be And another notice in restore out. Bug 5711.
(http://moodle.org/bugs/bug.php?op=show&bugid=5711)
2006-06-03 19:48:50 +00:00
stronk7 69b693dbc9 One less notice. Bug 5710.
(http://moodle.org/bugs/bug.php?op=show&bugid=5710)
2006-06-03 19:44:15 +00:00
stronk7 0803379406 Avoid one notice in backup. Bug 5709.
(http://moodle.org/bugs/bug.php?op=show&bugid=5709&)
2006-06-03 18:59:35 +00:00
stronk7 4eb4b874ba Adding support to the forum user report action
in restore. Bug 3854.
(http://moodle.org/bugs/bug.php?op=show&bugid=3854)
2006-06-03 17:44:05 +00:00
skodak aff589d128 Making sure timelimit is converted to integer before being written to database, otherwise postgreSQL complains. Closing bug 5401; merged from MOODLE_15_STABLE 2006-06-02 16:01:05 +00:00
tjhunt c4c9a5d860 Bug #5559: Move CLOZE qtype hightight colours into CSS insted of hardcoding, so themes can override. 2006-06-02 15:37:10 +00:00
nfreear 805720ebd3 Fix, bug 5614 - added ALT text for link icons (x 5), based on TITLE. 2006-06-02 13:11:38 +00:00
ethem af70ea6a96 Merged from HEAD. 2006-06-02 09:48:27 +00:00
thepurpleblob ae8df5acdf Added CLOZE question support.
Thanks to Joseph Rezeau for this one!
2006-06-02 09:44:13 +00:00
vyshane 1e900c139d Fixed bug: php warnings when there are no users in the selected course. 2006-06-02 07:35:36 +00:00
skodak ef93a24f23 fixed warning and removed ugly hack in attachment path 2006-06-02 06:47:26 +00:00
vyshane 47737013d3 Fix for Bug #5682 - 'Reset template' button in CSS template adds HTML 2006-06-02 04:27:42 +00:00
vyshane 476b3195fa Added missing language string. 2006-06-02 04:19:06 +00:00
toyomoyo ed7ce12186 fix for 5686, include_once course/lib.php in case it doesn't get included when interrupted 2006-06-02 02:53:31 +00:00
stronk7 de78b7e81b Adding propper support for the forum->user report log action. It was
a bit wrong. Code credits go to Petr!
2006-06-01 23:11:55 +00:00
skodak bf48c7abcd fixed problem in restricted modules - mods were accessed using strtolower(translated module name) instead of directory name as usual, it partially worked for English 2006-06-01 19:48:37 +00:00
skodak 26e6e8c048 fixed - unable to disable blocks 2006-06-01 19:12:42 +00:00
ethem d0bdb4d3c9 Documentation for status codes and actions. 2006-06-01 16:05:29 +00:00
skodak 7af4d79611 Bug #5643 - add Yahoo online status to user profile 2006-06-01 15:18:10 +00:00
skodak 49f020ec0c Bug #5684 - frameset page in UTF8 doesn't appear on IE 2006-06-01 14:49:31 +00:00
thepurpleblob a4bb593422 Fixing bugs #5676 and #5677
Text strings not properly escaped in a couple of places.
Conditional check inserted for optional units data in numerical questions.
2006-06-01 10:12:00 +00:00
ethem d799a9aef2 Just some tidy-ups 2006-06-01 08:44:01 +00:00
vyshane 6b611eb82d Fix for Bug #5552 - Filters conf. table looks awful. 2006-06-01 08:08:23 +00:00
ethem 1e04f3179a Just some tidy-ups 2006-06-01 07:38:23 +00:00
skodak ec7418d3ce Bug #5661 - mymoodle redirect problem 2006-06-01 05:39:46 +00:00
vyshane 6d895ae5e9 Fixed missing string 2006-06-01 04:07:23 +00:00
vyshane b194dfbf15 Fix for get_string(), which was not building the path to the language files
for reports correctly.
2006-06-01 03:05:18 +00:00
toyomoyo 278bd07a17 bug fix for 5352, setting ignore_user_abort to false 2006-06-01 02:30:20 +00:00
danmarsden 2aa86d2d33 BUG 5662 - bad check for 1.6 version. 2006-05-31 20:25:37 +00:00
stronk7 74e97cf096 Prevent doubleslashes once and again in paths. Also prevent them when writing config.php 2006-05-31 17:50:42 +00:00
tjhunt d86503c7cf Fix for bug 5379: Item analysis report should not have a hard coded list of question types.
Please test this if you have a moodle install with some unusual question types. Thanks.
2006-05-31 15:53:12 +00:00
julmis ee16e98eb1 Another try to fix IE's problem to load editable iframe. 2006-05-31 11:35:32 +00:00
moodler 800085d9ae Don't show stupid warnings to teachers 2006-05-31 08:24:28 +00:00
toyomoyo c8937fb8ea changepassword obsolete 2006-05-31 07:23:11 +00:00
toyomoyo 08d1ef9d83 changepassword is obsolete 2006-05-31 07:11:16 +00:00
toyomoyo 2fd3511227 changepassword obsolete 2006-05-31 06:57:58 +00:00
toyomoyo 3abe15dd14 change password obsolete 2006-05-31 06:41:55 +00:00
toyomoyo 213b568441 always allow admin to check the force password change box, if using internal_auth 2006-05-31 06:28:07 +00:00
stronk7 91a036b599 Users with messages (and messages) are only included in
SITEID backup. Bug 5658.
(http://moodle.org/bugs/bug.php?op=show&bugid=5658)

Merged from MOODLE_15_STABLE
2006-05-30 16:57:20 +00:00
nfreear 5484222182 Fix bug 5628 (Farsi RTL language), modify '.accesshide' style so top is large negative, not left. 2006-05-30 11:16:52 +00:00
skodak 321a23004b blacklist PHP 5.0.x in installation precheck 2006-05-30 09:49:22 +00:00
skodak 272fecfce4 blacklist PHP 5.0.x in installation precheck 2006-05-30 09:37:26 +00:00
ethem ffccc532c6 If config wwwroot starts with 'https', ignore config loginhttps value.
Dependency: Bug #5647
2006-05-30 08:25:57 +00:00
skodak ad6ae2c4e5 fixed typo - randomsmatch notice bug 5652 2006-05-30 06:27:59 +00:00
toyomoyo 76816913ed fix for 5648, utf-8 migration bug 2006-05-30 02:50:16 +00:00
martinlanghoff 4c74601224 auth/ldap: better handling of empty values from ldap 2006-05-30 00:42:53 +00:00
stronk7 b4c8301258 Bump or I'll forget it. 2006-05-29 22:49:54 +00:00
skodak c446109283 fixed warning from clone($SITE) during site setup 2006-05-29 20:30:07 +00:00
stronk7 b4ab174902 Normalize oracle driver name.
Merged from HEAD.
2006-05-29 17:43:07 +00:00
stronk7 2deb9e2501 Adding environmental checks for 1.7 (mssql and oracle added)
Merged from HEAD
2006-05-29 17:38:48 +00:00
moodler be02c7520a Improved title 2006-05-29 09:55:07 +00:00
moodler 364f1151a6 Updated some "my moodle" strings 2006-05-29 09:39:55 +00:00
moodler fb3a583b2b Improved the appearance of the My Moodle page with some CSS 2006-05-29 09:27:01 +00:00
moodler 83bf9af99e DOn't even show assignments without a due date 2006-05-29 09:20:53 +00:00
moodler a00095da48 FIxed some bugs 2006-05-29 09:09:22 +00:00
moodler 3ed4068ee1 Cleaned up admin reports a little 2006-05-29 09:03:13 +00:00
skodak 949f570992 Bug #5620 - MyMoodle shows bogus Assignment due date 2006-05-29 08:36:52 +00:00
moodler 2bef2c7dca FIxed admin block link for reports 2006-05-29 08:35:33 +00:00
moodler 36e32ba459 Checking in skodak's fixes to help blocks in more contexts (esp MyMoodle) 2006-05-29 08:15:23 +00:00
moodler baa1209e37 Merged from HEAD, better definition of $COURSE 2006-05-29 07:34:55 +00:00
skodak 4878c5a6d2 fixed array warning when editting blocks 2006-05-29 06:03:17 +00:00
skodak 5d4353a158 global $course fix 2006-05-29 05:55:39 +00:00
wildgirl 446088fa5d Updated small MP3 player to handle autoPlay (by Andrew Walker, Alton College) 2006-05-28 20:20:55 +00:00
skodak 33f519119b sanitize submitted numerical values 2006-05-26 11:52:35 +00:00
skodak 7acc6626c5 sanitize submitted numerical values 2006-05-26 11:46:32 +00:00
skodak e616f403eb sanitize submitted numerical values 2006-05-26 11:38:16 +00:00
skodak b51b3dd05c sanitize submitted numerical values 2006-05-26 11:31:16 +00:00
skodak e4fd3f4f06 Bug #5619 - Assignment Feedback mail lacks linefeed 2006-05-26 09:06:05 +00:00
skodak bce3627ed9 Bug #4647 - Undefined property in lib/statslib.php 2006-05-26 08:59:52 +00:00
skodak 567596e8c2 Bug #5456 - Item Analysis fails to calculate results for random question type 2006-05-26 06:54:22 +00:00
skodak f703afe925 Bug #5472 - Download quiz grades in Excel format does not show correct foelds 2006-05-26 06:47:32 +00:00
skodak 6483738028 Bug #5612 - language string missing in blog 2006-05-25 19:23:54 +00:00
skodak 086018ae01 Bug #5582 - sort by numerical field doesn't work properly with decimals 2006-05-25 15:55:55 +00:00
nfreear ae04fba0cd Ongoing fix, bug 5614 - added ALT text for link icons, based on TITLE. 2006-05-25 15:50:19 +00:00
skodak db9529f65f Bug #5416 - sorting by question column in overview report plugin broken - please test 2006-05-25 09:59:06 +00:00
skodak 97ae5efdf0 Bug #5566 - wrong display of student's answers in MATCHING question type 2006-05-25 08:12:30 +00:00
skodak a636a125da Bug #4779 - lib/moodlelib.php: typo 2006-05-25 06:33:01 +00:00
vyshane b3ed98f7ba Changed string to make it more general so we can use it for error message that
is shown when a student tries to add an entry and no fields are defined.
2006-05-25 05:16:43 +00:00
vyshane 46941b6043 Fix for bug: when students try to add an entry while no field is defined, the
foreach barfs on the value of $fields, which is false.
2006-05-25 05:14:53 +00:00
gbateson 670cced63a added blank lines for to improve readability 2006-05-25 05:14:49 +00:00
toyomoyo f6c74641dd backup-restore, utfmigrate for rsstitletemplate field 2006-05-25 02:29:15 +00:00
toyomoyo 3141843a1a dropping backticks 2006-05-25 02:06:44 +00:00
toyomoyo 4da8b58b36 forgot to check this in 2006-05-25 01:43:32 +00:00
gbateson 7c8304a6c9 clarified the wording in point (5) of the "TO USE" section 2006-05-25 00:00:34 +00:00
skodak fee588e503 fixed my yet another bug 2006-05-24 21:53:46 +00:00
skodak 42e2fba317 fixed broken operations in subfolders - result of my recent patching :-( :-( bug #5603 2006-05-24 21:49:25 +00:00
skodak 48c54e90ce Bug #5604 - LDAP error notice when users update profile 2006-05-24 21:11:56 +00:00
skodak dad92a063d fixed warnings on save profile 2006-05-24 21:04:33 +00:00
skodak 9033ed3212 Bug #5587 - Redirect fails after a failed login and proper variable initialisation 2006-05-24 20:54:59 +00:00
skodak 146132bffc fixed bug #5562 I hope 2006-05-24 18:55:41 +00:00
gbateson 331c6f4620 fixed typos in $string['configshowtimes'] 2006-05-24 11:22:07 +00:00
toyomoyo ed501d3e98 added a rsstitle field 2006-05-24 07:01:33 +00:00
toyomoyo d2780b2594 added rsstitletemplate field 2006-05-24 06:14:16 +00:00
toyomoyo 3054f2faf2 renaming reads and writes to statsreads and statswrites 2006-05-24 05:02:09 +00:00
vyshane 3c0fd35102 Fix for undefined property notice when cron.php is run. 2006-05-24 03:06:16 +00:00
stronk7 67e55d7e0b Solving one SQL error in data_get_participants()
plus some improved readability.
2006-05-23 22:30:58 +00:00
stronk7 5b0d565bcd course_modules->deleted and user->guid are now out.
(they disappeared from DB ages ago)
2006-05-23 22:04:50 +00:00
skodak ade83600e1 fix for printing of multiple group pictures bug #5548 2006-05-23 19:16:04 +00:00
skodak b87862b89a fixed bug #5593 - logged in nested in <p> and <div> 2006-05-23 18:58:37 +00:00
skodak 30faf003ba fixed file backup and converted other forgotten "assignments" 2006-05-23 18:37:05 +00:00
skodak c9a53bb206 fixed broken SQL that was throwing errors in backup 2006-05-23 18:14:56 +00:00
skodak 6fb6c9d960 fixed bug 5594 - can not save group details 2006-05-23 17:59:19 +00:00
skodak 5d502dc3e4 fixed warning 2006-05-23 13:32:43 +00:00
skodak 30d36e2f3e fixed incorrect output buffer use - bug #5590 2006-05-23 10:54:43 +00:00
skodak 989e230b3d fixed RSS feeds warning bug #5591 2006-05-23 10:24:40 +00:00
skodak f45b5a05c0 make sure variables are properly cleaned 2006-05-23 09:46:56 +00:00
skodak 48cd99809d proper initialisation of $oldquestionid 2006-05-23 09:31:04 +00:00
skodak 6ebca3c77e removed reliance on register globals 2006-05-23 09:10:23 +00:00
skodak 2e311d898c extra cleaning of variables 2006-05-23 09:00:58 +00:00
stronk7 a87bbde1a1 Allowing also numbers and underscores in sessioncookie.
Merged from MOODLE_15_STABLE
2006-05-22 17:54:13 +00:00
skodak 71777355b1 fixed register globals issues for $sort SC #256 2006-05-22 16:51:56 +00:00
tjhunt 01d50616ee Fix for Bug #5588 - Editing a question after sorting leads to an error. 2006-05-22 15:42:42 +00:00
skodak d44136dee7 fixed bug #5578 - remove login as button for other teachers in course 2006-05-22 13:14:14 +00:00
tjhunt 5c9fe50894 Fix an undefined variable notice. 2006-05-22 13:04:17 +00:00
tjhunt e620c033cb Fix an undefined variable notice. 2006-05-22 11:19:32 +00:00
nfreear d3b5c5f081 Ongoing, fix bug 5400, navbar/breadcrumb TABLE to DIV, to improve semantics. 2006-05-22 09:11:10 +00:00
skodak 6936ef91df fixed bug #5572 missing PARAM_CLEAN 2006-05-22 05:59:06 +00:00
toyomoyo 3f94709321 fix for 5551, can not edit post when set to 1 discussion 2006-05-22 02:38:11 +00:00
gbateson 6428434a5f fixed typo: clck -> click 2006-05-22 00:21:00 +00:00
gbateson 9bb14972af modified CVS URLs to start http://moodle.cvs.sourceforge.net 2006-05-22 00:19:51 +00:00
gbateson 01f3128264 Give Up button modified to send results and set status to abandoned. Microincrement version to 2006052200 (release = v2.1.20) 2006-05-22 00:07:33 +00:00
skodak 3e55705455 fixed register globals issue with $loginasguest 2006-05-21 20:50:50 +00:00
skodak 889209d1fa fixed redirection to https:// for edit profile and change password when loginhttps on 2006-05-21 20:34:31 +00:00
skodak efc346b5ca temporary workaround for bug #5534, html editor now disabled for IE when loginhttps on and wwwroot starts with http:// 2006-05-21 20:20:45 +00:00
skodak 5eb64d447e removed isset 2006-05-21 10:10:54 +00:00
skodak 9446d15749 fixed register globals issue with $text 2006-05-21 08:08:48 +00:00
skodak dc28278d18 proper initialisation of passwordchangeurl 2006-05-21 07:50:21 +00:00
skodak d04f1621e8 proper initialisation of sqlsortkey SC#258 2006-05-21 07:42:05 +00:00
koenr ef38765d91 adding missing </p> and one point 2006-05-20 19:14:13 +00:00
skodak 7c3c8b7249 fixed register globals issues in course/search.php 2006-05-20 18:39:48 +00:00
skodak eb676fdf9a proper initialisation of $focus SC#257 2006-05-20 18:18:30 +00:00
skodak bf55369e5d do not show pending courses button for nonadmins bug #5564 2006-05-20 18:07:25 +00:00
skodak 56a6a9ff49 fixed cleaning of path in custom scripts SC#221 2006-05-20 17:21:44 +00:00
stronk7 91e4976c08 Bump to Beta5 2006-05-20 00:10:13 +00:00
skodak 299560a9fc fixed block width calculation 2006-05-19 21:00:28 +00:00
skodak 23cb8a304c submission in post.php cleanup, fixes for bugs #5530, #5484 and SC#252 2006-05-19 20:15:44 +00:00
skodak 9c71eb42b8 fixed - disabled autologinguest not always respected in require_login() SC#255 2006-05-19 19:10:19 +00:00
nfreear f642809590 Ongoing, fix bug 5400, DIV to H1, to improve semantics. 2006-05-19 13:24:48 +00:00
nfreear 3edb646260 Fix bug 5434 - hardcoded missing Alt text, with a warning comment. 2006-05-19 10:29:08 +00:00
vyshane 7828580904 Fix for Bug #5541 2006-05-19 06:23:16 +00:00
mark-nielsen 2711fbb039 [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:59:22 +00:00
mark-nielsen d226adef8b [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:54:15 +00:00
skodak 88aba6189b deprecated nvl() function similar to optional_variable() - fixed missing global $CFG 2006-05-18 22:10:40 +00:00
skodak e371190c10 deprecated nvl() function similar to optional_variable() 2006-05-18 22:09:25 +00:00
dwoolhead dd3b147a87 Bug 5536 Replaced references to hide by show 2006-05-18 16:10:33 +00:00
ethem 653c70a063 Removed </td>. Help button appears on top :))
Merged from HEAD
2006-05-18 10:04:42 +00:00
ethem bb75ef114c I have just found a cute function called print_checkbox. :)
Merged from HEAD.
2006-05-18 07:58:54 +00:00
skodak f220d982f2 fixed bug #5533, could not choose from file root 2006-05-18 05:46:58 +00:00
martinlanghoff 1db555e84d login: Changing passwords now works when logged in as guest 2006-05-18 00:53:08 +00:00
skodak 2c97ca5d59 admins can now edit user images even when $CFG->disableuserimages = true; see bug #5494 and SC#253 2006-05-17 18:57:18 +00:00
skodak 4a1f1588f0 fixed version number 2006-05-17 18:15:43 +00:00
skodak 2b5c23c82b fixed some warnings and removed ugly hack error_reporting(E_ALL ^ E_NOTICE); that was only hiding warnings in this and other code
I am going to watch forums and bug tracker and fix any other problems that may surface before the release
2006-05-17 18:05:28 +00:00
tjhunt e1b8eb512c Convert tabs to spaces in files where there were only a few rogue tabs. 2006-05-17 16:37:14 +00:00
exe-cutor fca3ef18aa Removed all tabs 2006-05-17 12:37:13 +00:00
exe-cutor d2c77a0dc0 Fixed some typos 2006-05-17 12:33:01 +00:00
tjhunt f76e87652c Fix URL syntax error when slasharguments is off. 2006-05-17 11:29:31 +00:00
tjhunt 108145970d Fix wrong variable name. 2006-05-17 11:28:59 +00:00
ethem d4d1873933 action.php renamed to authorizenetlib.php 2006-05-17 08:12:41 +00:00
martinlanghoff 52a85b5475 moodle16cleanup: lib/db correct prefix, patch by Tim Hunt for bug 5515 2006-05-17 06:26:32 +00:00
martinlanghoff 6f1c69ec02 mod/choice mod/lesson mod/scorm moodle16cleanup: Added notification
for cleanup that may fail if one is starting fresh from moodle 1.5.3+,
previous cleanup before 1.5.3 is not needed
2006-05-17 06:25:46 +00:00
martinlanghoff f184d1610b moodle16cleanup: mod/forum correctly dropping the constraint, so it does
not report an error during upgrade
2006-05-17 06:25:20 +00:00
martinlanghoff 7832d94156 moodle16cleanup: mod/quiz correctly sync the constraints and indexes
which was not changed when it was moved from quiz module to question lib
2006-05-17 06:24:59 +00:00
martinlanghoff 289b648803 moodle16cleanup: mod/quiz uniqueid does not exists, taking upgrade script
from mysql.php ver 2005070202. dropping some unused tables during the
transition from quiz to question lib
2006-05-17 06:24:28 +00:00
martinlanghoff c86c9b30c5 moodle16cleanup: lib/db correctly put the default values, change the
length of log_display.module which is just 20 chars on postgres7.sql
2006-05-17 06:20:52 +00:00
martinlanghoff a722923c62 moodle16cleanup: backup/ set the correct column datatype and default value 2006-05-17 06:20:37 +00:00
martinlanghoff ae3f15fac1 moodle16cleanup: blocks/rss_client set the correct column default value 2006-05-17 06:20:09 +00:00
martinlanghoff d5b0187a32 moodle16cleanup: enrol/authorize not null set which is similar to mysql
and that was upgraded on postgres7.php
2006-05-17 06:19:50 +00:00
martinlanghoff 100aa1d7be moodle16cleanup: mod/hotpot set the correct column datatype and default
value
2006-05-17 06:19:34 +00:00
martinlanghoff 4ff35d69bc moodle16cleanup: mod/lesson drop unused table lesson_essay, set the
correct column datatype and default value
2006-05-17 06:19:17 +00:00
martinlanghoff ec29c403be moodle16cleanup: mod/dialog we need to drop some more dialog module tables 2006-05-17 06:18:43 +00:00
martinlanghoff a576feacb8 moodle16cleanup: mod/scorm drop a weird check constraint that is showing
up after upgrade
2006-05-17 06:18:16 +00:00
martinlanghoff 9c44a6972c moodle16cleanup: mod/scrom set the correct defaults and correctly recreate
the new check constraint
2006-05-17 06:17:53 +00:00
martinlanghoff 1ce5928d35 moodle16cleanup: mod/scorm version column should not be dropped, it must
exist. it was not upgraded as with mysql.php 2005041600
2006-05-17 06:17:32 +00:00
martinlanghoff 35c30e915e moodle16cleanup: mod/wiki synch upgrade script and .sql with mysql
counterpart, drop the not null constraint to sync with postgres7.sql
2006-05-17 06:17:06 +00:00
martinlanghoff f59139d640 moodle16cleanup: mod/forum added notification message 2006-05-17 06:15:48 +00:00
martinlanghoff b4bdcbe535 blocklib: cache (and used cached) block instances properly in $pageblocks
Now blocks_have_content() caches instantiated block objects inside $pageblocks
and blocks_print_blocks() uses them if available. This behaviour now matches
the documentation: blocks instances are created only once, get_content()
may be invoked several times.

A better fix would be to cache the _output_ of the block (the ->content
property) but it may bite us if any block is counting on being called twice.

Discussion at: http://moodle.org/mod/forum/discuss.php?d=45867
2006-05-17 04:51:12 +00:00
skodak b6d175eeb7 I hope this is the last patch for header already printed trouble in error() and redirect() 2006-05-16 20:29:20 +00:00
ethem a7084ab10b confirm_sesskey() implementation for capture,delete,refund and void. I hope it works. :)
Merged from HEAD.
2006-05-16 15:37:06 +00:00
ethem 6a4c28904a Allow showing error message when insert_record fails. 2006-05-16 15:00:08 +00:00
ethem d0e1fd06c5 Manual capture settings for sending email: cron=enabled, an_review=checked, an_capture_day=0, an_emailexpired=1-5
merged from HEAD
2006-05-16 11:40:00 +00:00
nfreear 287a93580b Fix bug 5477 "Strange 'you are here'...", <span> now <h2> in function print_navigation. 2006-05-16 11:31:50 +00:00
ethem 53fedccb0b (Manual capture settings: cron=enabled, an_review=checked, an_capture_day=0)
Merged from HEAD.
2006-05-16 10:46:55 +00:00
thepurpleblob a08ccf0a61 Added note that export now exports all subcategories. 2006-05-16 09:38:03 +00:00
toyomoyo df8baa04c3 forgot to take out comment 2006-05-16 08:22:03 +00:00
toyomoyo 3b0e0d4df4 fix for 5513 2006-05-16 07:57:54 +00:00
vyshane 250ea6271e Fixed bug #5467. Converted newlines to UNIX format, tabs to spaces and removed
extra newlines at the end of php scripts.
2006-05-16 07:04:05 +00:00
vyshane f356fbe45e Fix for grade_drop_lowest (missed from last fix for bug 5354) 2006-05-16 06:57:08 +00:00
vyshane 37f401637b Fixed Bug #5354 - Gradebook [DropXLowest and Exclude] 2006-05-16 05:49:59 +00:00
mark-nielsen 13f944bc55 [BugFix] Bug 5485 - problem with regular expressions with simple analysis 2006-05-16 03:04:44 +00:00
stronk7 3e21f15895 Updated to latest version (1.56). Bug 5165.
(http://moodle.org/bugs/bug.php?op=show&bugid=5165)
2006-05-15 23:29:13 +00:00
danmarsden fc410020b8 Fixes bug 5464 also makes response clearer to students -see:
http://moodle.org/mod/forum/discuss.php?d=45504

also finishes off Bug 662
2006-05-15 23:21:39 +00:00
mjollnir_ 200460b0c8 mod/quiz/view No-longer display final grade when quiz settings forbid it.
Changed view.php so that it checked if there were any attempts with
concealed grades before printing the student's overall score.
Credit: Peter Bulmer <peter.bulmer@catalyst.net.nz>
2006-05-15 21:51:30 +00:00
skodak d1014faf32 fixed problem when set both loginhttps and https in wwwroot, closes bug #5507 and #3848 2006-05-15 21:32:21 +00:00
gustav_delius b692cb65b7 Answers to essay questions are now saved correctly when navigating to another page, fixing bug 4478 2006-05-15 20:27:04 +00:00
mark-nielsen 3f566d8f2e [BugFix] Bug 5505 - function lesson_print_tree now checks for teacher editing priv before printing editing icons. Had to change arguments for this function as well which is the edit in view.php.
lesson.php how checks for teacher editing priv for all actions except for continue.  This is just in case the user hacks the URL.
2006-05-15 19:05:58 +00:00
stronk7 46beca01b3 Avoid [[namesite]] to appear when ADDING site activities.
I sent this on May 8th! :-(
2006-05-15 17:52:39 +00:00
stronk7 0257c6d6b0 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes have dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:28:02 +00:00
stronk7 b10192c1e4 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes had dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:26:38 +00:00
skodak 0772879f24 fix my previous incorrect short tag fix, fixed register globals, IP address used as mail user when not logged in 2006-05-15 15:44:36 +00:00
skodak 5563b4e151 fixed short php tags 2006-05-15 15:10:49 +00:00
skodak ffcce04152 changed cleaning of entry title, now matches handling of forum post titles 2006-05-15 15:03:44 +00:00
skodak b374d60430 better cleaning of post title SC#251 revisited 2006-05-15 14:47:09 +00:00
skodak 848e124eab better cleaning of post title SC#251 2006-05-15 14:31:09 +00:00
exe-cutor a53b09c16b Fixed an inconsistent link 2006-05-15 12:18:40 +00:00
toyomoyo 8374432bdb fix for 5493 2006-05-15 02:58:43 +00:00
toyomoyo 18ab64ef11 tidying up constants 2006-05-15 02:56:56 +00:00
toyomoyo e1b6fbf2eb fix for 4404 2006-05-15 02:25:42 +00:00
toyomoyo a37df0735f fix for 5465 2006-05-15 02:01:54 +00:00
skodak 8b0c3b6551 fixed secure forms handling when POST url contained GET parameters (cookieless mode and some other forms) 2006-05-14 20:57:01 +00:00
skodak 5ee7e12e26 fixed bug #5489 - can not edit file, minor bugfixes and whitespace cleanup 2006-05-14 19:08:34 +00:00
skodak f4aaf2f7b5 fixed whitespace and Id tag 2006-05-14 17:21:02 +00:00
skodak c385f70296 I hope final fix for warnings when using error() after print_header() with buffering on, solution was to flush all buffers and reenable SID rewrite when needed. 2006-05-14 17:10:35 +00:00
gbateson 00fe4b8045 microincrement version number to v2.1.19 2006-05-14 08:34:23 +00:00
gustav_delius 0472d056f6 Removing obsolete defaults 2006-05-13 17:04:11 +00:00
gustav_delius 07f8831194 Introduce question_attempts table, closing bug 5468
Fixed incorrect check for whether to update state or insert new one in save_question_session()
Deal with manually graded states correctly during regrading
Increase state sequence number during manual grading
Supplied missing userid to quiz_save_best_grade() during manual grading
2006-05-13 16:41:22 +00:00
ethem a7f53e74f6 Fix: Redirect to order details page 10 seconds later, not home page. 2006-05-13 16:14:36 +00:00
gustav_delius 8a6733ead1 Updated comments and made sure teacher preview gets restarted when changes are saved, fixing bug 5478 2006-05-13 10:34:02 +00:00
ethem e5bafac7d2 *** empty log message *** 2006-05-13 08:55:38 +00:00
ethem f101e4f736 Language direction is important. Changed as: <b>AVS Result:</b> $a 2006-05-13 08:51:12 +00:00
thepurpleblob 53b824ef1f Fixes for bugs #5435 - subcategories were not exported and
#5470 - true/false questions not exported due to internal format
change.
2006-05-13 08:47:57 +00:00
ethem 672007443c More readable coding. Now, I understand everything. :) 2006-05-13 08:30:06 +00:00
ethem 1180c98509 Deleting test transactions are not good. They may be in proggress. Let's update WHERE transid<>'0'. 2006-05-13 05:58:17 +00:00
ethem 337f36b459 Fix: Don't show newly created orders prior to 2 minutes.
They may be still in proggress and these aren't test transacions(transid=0).
We check timecreated field to prevent this.
2006-05-12 19:48:42 +00:00
ethem be1ed90464 Fix: Delete test transactions before update status as AN_STATUS_AUTHCAPTURE. 2006-05-12 18:32:02 +00:00
ethem 55c0d5b8a4 Status: 'New' string. Merged from HEAD. 2006-05-12 17:23:59 +00:00
stronk7 aa912c49e2 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)
2006-05-08 16:36:40 +00:00
nfreear 8abfee6962 Fixes bug 5412 "Recent Activity block, New Users, markup should be a list" - style and lib.php: print_recent_activity. 2006-05-08 11:24:35 +00:00
thepurpleblob f1068df6c6 Moved some category functions back to questionlib. Original move
caused all sorts of problems.
2006-05-08 10:40:42 +00:00
thepurpleblob 3b438e0db9 Moved some of the category functions back here. Caused much
more grief than I anticipated.
2006-05-08 10:38:03 +00:00
toyomoyo 6d699a924d fix for 5438 2006-05-08 07:07:51 +00:00
vyshane f6de1e03d7 Fix for Bug #5441. Typo was causing an undefined variable notice. 2006-05-08 03:53:49 +00:00
vyshane 0416a3be25 Changed field length to 20 for module field in log table (Bug #5419). 2006-05-08 03:07:27 +00:00
moodler 1e4f7f125b Updated hints about stable versions 2006-05-08 01:47:25 +00:00
stronk7 1b2472e584 glossary print view is now valid XHTML. 2006-05-07 10:48:10 +00:00
stronk7 51aca6a92f Now, when a single forum is restored and no user data was created,
the initial discussion/post is automatically generated. Bug 5418.
(http://moodle.org/bugs/bug.php?op=show&bugid=5418)

Merged from MOODLE_15_STABLE
2006-05-06 16:55:38 +00:00
ethem 04803a039d Admin can setup which credit card types will be accepted. 2006-05-05 18:25:03 +00:00
ethem 8d101bc522 Admin can setup which credit card types will be accepted. 2006-05-05 18:09:38 +00:00
stronk7 474c8d3f00 Now the help link in the admin block points to Docs. Bug 4803.
(http://moodle.org/bugs/bug.php?op=show&bugid=4803)
2006-05-05 17:54:59 +00:00
vyshane e48f4e502d Fix for Bug #5419 - Inconsistency between log_display and log tables. 2006-05-05 08:01:27 +00:00
toyomoyo 00b9ff724b fix for 4478 2006-05-05 06:43:36 +00:00
toyomoyo d5be1194cb fix for 5428 2006-05-05 05:13:12 +00:00
thepurpleblob d3176779c8 htmlentities() replaced by s() 2006-05-04 11:15:11 +00:00
stronk7 8e4485c69b Anything against the ISO-8859-1 word? 2006-05-04 10:38:17 +00:00
toyomoyo e565767d24 fix for 5426, inconsistent prefixes, and lengthened some index to varchar(100) during migration 2006-05-04 09:36:32 +00:00
ethem aca29171b4 Enable 'Authorize.net plugin' and setup cron properly; or uncheck an_review again. 2006-05-04 08:15:29 +00:00
toyomoyo 1710f639ae fix for 3644 2006-05-04 06:56:24 +00:00
moodler 711d6de23f Whoops, proper merge now 2006-05-04 05:47:27 +00:00
moodler fdee3caacb Merged fixes from stable 2006-05-04 04:42:18 +00:00
vyshane 0c19b8fd99 Fix for Bug #4805 2006-05-04 04:25:22 +00:00
toyomoyo 1bad990a14 fix for 5417 2006-05-04 02:22:37 +00:00
stronk7 155a4e17a2 Now more quiz actions are restored properly:
-preview
 -start attempt
 -close attempt
 -continue attempt (too long. See Bug 5419)
Bug 5122
(http://moodle.org/bugs/bug.php?op=show&bugid=5122)
2006-05-03 23:45:55 +00:00
stronk7 11a5d6c147 Fixing some non-production values I left after testing.
Thanks James!
2006-05-03 22:03:06 +00:00
stronk7 ca5b6b6506 XHTML validation. Bug 5332.
(http://moodle.org/bugs/bug.php?op=show&bugid=5332)
2006-05-03 18:20:09 +00:00
urs_hunkler d0fcd925f9 patch: 2 if propertyIsEnumerable blocks added to make HTMLeditor work with the prototype AJAX library 2006-05-03 18:14:42 +00:00
stronk7 b985f62858 1.6 compliance added
Merged from HEAD
2006-05-03 17:57:26 +00:00
stronk7 e793cddc22 Solving some changes in course-view and sections... 2006-05-03 17:47:29 +00:00
64973 changed files with 622054 additions and 9213395 deletions
-185
View File
@@ -1,185 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Generates tsconfig.aliases.json for cross-component TypeScript imports.
*
* Moodle ESM source files can import from other components using the alias
* scheme @moodle/lms/<component>/* (e.g. @moodle/lms/core/SomeUtil). This
* file reads the Moodle component registry (.grunt/components.js), finds every
* component that has a js/esm/src/ directory, and writes the corresponding
* TypeScript path mappings to tsconfig.aliases.json.
*
* tsconfig.json extends tsconfig.aliases.json, so TypeScript picks up the
* mappings automatically. The file is skipped if its content is unchanged, to
* avoid unnecessary rebuilds.
*
* This must run before esbuild compilation. The Grunt `jsconfig` task calls
* generateAliases() so that both jsconfig.json and tsconfig.aliases.json are
* kept in sync. The `react` task depends on `jsconfig`, so aliases are always
* up to date before a React build.
*
* @copyright 2026 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import fs from "fs";
import path from "path";
import { createRequire } from "module";
const rootDir = process.cwd();
const tsconfigOut = path.join(rootDir, "tsconfig.aliases.json");
const TS_ALIASES_WARNING =
"// WARNING: Do not edit this file manually. It is generated by `grunt jsconfig`.\n";
/**
* Load Moodle component paths from `.grunt/components.js`.
*
* @returns {Record<string, string>} Map of component paths to component names.
*/
function loadComponentPathMap() {
const require = createRequire(import.meta.url);
// Load Moodle's components data from .grunt/components.js.
const { fetchComponentData } = require(
path.join(process.cwd(), ".grunt", "components.js")
);
// Format: `{ components: { "public/lib": "core", ... } }`.
const componentsData = fetchComponentData().components;
// Expected:
// `{ "public/lib": "core", "public/ai": "core_ai", ... }`.
return componentsData;
}
/**
* Compare two TypeScript `paths` maps for exact equality.
*
* @param {Record<string, string[]>} a First paths map.
* @param {Record<string, string[]>} b Second paths map.
* @returns {boolean} True when keys and values match in order.
*/
function pathsEqual(a, b) {
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) {
return false;
}
for (const key of aKeys) {
if (!Object.prototype.hasOwnProperty.call(b, key)) {
return false;
}
const aArr = a[key] ?? [];
const bArr = b[key] ?? [];
if (aArr.length !== bArr.length) {
return false;
}
for (let i = 0; i < aArr.length; i++) {
if (aArr[i] !== bArr[i]) {
return false;
}
}
}
return true;
}
/**
* Parse JSON content and tolerate line comments.
*
* @param {string} content Raw JSON/JSONC file content.
* @returns {unknown}
*/
function parseJsonWithComments(content) {
const stripped = content
.replace(/^\uFEFF/, "")
.replace(/^\s*\/\/.*$/gm, "");
return JSON.parse(stripped);
}
/**
* Convert JSON output so single-value arrays are rendered on one line.
*
* @param {unknown} obj Data to stringify.
* @returns {string} JSON string with flattened single-value arrays.
*/
function stringifyFlatArrays(obj) {
const json = JSON.stringify(obj, null, 2);
return TS_ALIASES_WARNING + json.replace(/\[\s+\"(.*?)\"\s+\]/g, '["$1"]') + "\n";
}
/**
* Generate `tsconfig.aliases.json` from Moodle component metadata.
*
* Includes core aliases, discovers plugin React source aliases, and skips
* rewriting when aliases have not changed.
*
* @returns {void}
*/
export function generateAliases() {
const componentPathMap = loadComponentPathMap();
// Build TS paths for tsconfig.aliases.json
/** @type {Record<string, string[]>} */
const tsPaths = {
// Always include core alias.
"@moodle/lms/core/*": ["./public/lib/js/esm/src/*"],
};
for (const [componentPath, componentName] of Object.entries(componentPathMap)) {
const runtimeAliasKey = `@moodle/lms/${componentName}/*`;
const targetPattern = `./${path
.join(componentPath, "js", "esm", "src", "*")
.replace(/\\/g, "/")}`;
tsPaths[runtimeAliasKey] = [targetPattern];
}
const tsconfig = {
compilerOptions: { paths: tsPaths },
};
// If tsconfig paths didn't change, skip regeneration
let previousPaths = null;
let hasWarningHeader = false;
if (fs.existsSync(tsconfigOut)) {
try {
const previousContent = fs.readFileSync(tsconfigOut, "utf8");
hasWarningHeader = previousContent.startsWith(TS_ALIASES_WARNING);
const previousTsconfig = /** @type {{compilerOptions?: {paths?: Record<string, string[]>}}} */ (
parseJsonWithComments(previousContent)
);
previousPaths = previousTsconfig.compilerOptions?.paths ?? {};
} catch {
// ignore parse errors and treat as "no previous cache"
previousPaths = null;
}
}
if (previousPaths && hasWarningHeader && pathsEqual(previousPaths, tsPaths)) {
console.log("✓ Generating tsconfig.aliases.json was skipped. No alias modifications detected.");
return;
}
// Write tsconfig.aliases.json
fs.writeFileSync(tsconfigOut, stringifyFlatArrays(tsconfig));
console.log("✓ Generating tsconfig.aliases.json");
}
-324
View File
@@ -1,324 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Core esbuild library for Moodle ESM components.
*
* This is the single source of all build logic. The Grunt tasks
* (.grunt/tasks/react.js) import from here rather than duplicating
* configuration or build steps.
*
* Source layout convention:
* <component>/js/esm/src/**\/*.{ts,tsx} → <component>/js/esm/build/**\/*.js
*
* Exports:
* createBuildConfig(isDev) esbuild config object; pass isDev=true
* to disable minification / add sourcemaps.
* buildPluginComponents(isDev) Glob for every js/esm/src tree across
* core and plugins, compile all in parallel.
* buildSingleFile(filePath, isDev) Compile one source file; used by the
* Grunt watch task on incremental changes.
* watchComponents(isDev) Start esbuild's native watch mode so the
* compiler rebuilds affected files on save.
* resolveComponentPaths(entry) Map an absolute source path to its
* relative input path and output path.
*
* @copyright 2026 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import esbuild from "esbuild";
import { glob } from "glob";
import chalk from "chalk";
import path from "path";
import fs from "fs";
const projectRoot = process.cwd();
/**
* Resolve a path from the current project root.
*
* @param {...string} segments Path segments to resolve.
* @returns {string} Absolute path from project root.
*/
const fromRoot = (...segments) => path.resolve(projectRoot, ...segments);
/**
* Create an incremental dot progress indicator.
* Prints one dot per completed build and wraps lines for readability.
*
* @param {number} total Total number of items to build.
* @returns {{ start: () => void, tick: () => void, succeed: (msg: string) => void, fail: (msg: string) => void }}
*/
function createDotProgress(total) {
const dotsPerLine = 60;
let printed = 0;
return {
start: () => {
process.stdout.write(`${chalk.cyan("Building")} `);
},
tick: () => {
printed++;
process.stdout.write(chalk.cyan("."));
if (printed % dotsPerLine === 0 && printed < total) {
process.stdout.write(` ${chalk.dim(`[${printed}/${total}]`)}\n`);
}
},
succeed: (msg) => {
process.stdout.write(` ${chalk.dim(`[${printed}/${total}]`)}\n`);
process.stdout.write(`${chalk.green("✓")} ${msg}\n`);
},
fail: (msg) => {
process.stdout.write(` ${chalk.dim(`[${printed}/${total}]`)}\n`);
process.stdout.write(`${chalk.red("✗")} ${msg}\n`);
},
};
}
/**
* Build a single React component entry file.
*
* @param {string} entry Absolute entry file path.
* @param {import('esbuild').BuildOptions} buildConfig Shared esbuild configuration.
* @returns {Promise<{file: string, output?: string, error: Error|null}>}
*/
async function buildComponent(entry, buildConfig) {
const resolved = resolveComponentPaths(entry);
if (!resolved) {
return { file: entry, error: new Error(`Unknown path pattern: ${entry}`) };
}
const { file, output } = resolved;
fs.mkdirSync(path.dirname(output), { recursive: true });
try {
await esbuild.build({
...buildConfig,
entryPoints: [entry],
outfile: output,
});
return { file, output, error: null };
} catch (error) {
return { file, error: error instanceof Error ? error : new Error(String(error)) };
}
}
/**
* Resolve source and output paths for a component entry.
*
* @param {string} entry Absolute component source path.
* @returns {{file: string, output: string} | null} Relative file info and output path, or null for unsupported paths.
*/
export function resolveComponentPaths(entry) {
const rel = path.relative(projectRoot, entry);
if (rel.includes(path.join('esm', 'src'))) {
const [part, rawFile] = rel.split(path.join('esm', 'src'));
const file = rawFile.replace(/^[\/\\]/, '');
return {
file,
output: fromRoot(part, 'esm', 'build', file.replace(/\.(ts|tsx)$/, '.js')),
};
}
return null;
}
/**
* Run all builds in parallel, showing incremental dot progress.
*
* @param {string[]} entryPoints Absolute entry file paths.
* @param {import('esbuild').BuildOptions} buildConfig Shared esbuild configuration.
* @returns {Promise<{errors: {file: string, output?: string, error: Error|null}[]}>}
*/
async function runParallelBuilds(entryPoints, buildConfig) {
const total = entryPoints.length;
/** @type {{file: string, output?: string, error: Error|null}[]} */
const errors = [];
const startTime = Date.now();
const progress = createDotProgress(total);
progress.start();
await Promise.all(entryPoints.map(async (entry) => {
const result = await buildComponent(entry, buildConfig);
if (result.error) {
errors.push(result);
}
progress.tick();
}));
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
const succeeded = total - errors.length;
if (errors.length > 0) {
progress.fail(`${succeeded}/${total} built · ${elapsed}s`);
for (const e of errors) {
console.error(chalk.red(`${e.file}: ${e.error?.message ?? ''}`));
}
} else {
progress.succeed(chalk.bold(`${total} components built`) + chalk.dim(` · ${elapsed}s`));
}
return { errors };
}
/**
* Create the shared esbuild build configuration.
*
* @param {boolean} isDev Whether development mode is enabled.
* @returns {import('esbuild').BuildOptions} esbuild configuration object.
*/
export function createBuildConfig(isDev) {
return {
bundle: true,
format: "esm",
external: ["react", "react/*", "react-dom", "react-dom/*", "@moodlehq/design-system", "@moodlehq/design-system/*", "@moodle/lms", "@moodle/lms/*"],
jsx: "automatic",
minify: !isDev,
sourcemap: isDev ? 'inline' : false,
jsxDev: isDev,
keepNames: isDev,
treeShaking: !isDev,
define: { 'process.env.NODE_ENV': isDev ? '"development"' : '"production"' },
};
}
/**
* Build all plugin and core React components.
*
* @param {boolean} isDev Whether development mode is enabled.
* @returns {Promise<void>}
*/
export async function buildPluginComponents(isDev) {
console.log(chalk.green('> Building components...'));
const entryPoints = glob.sync("**/js/esm/src/**/*.{ts,tsx}", {
cwd: projectRoot,
absolute: true,
ignore: [
`${process.cwd()}/node_modules/**`,
`${process.cwd()}/vendor/**`,
],
});
const buildConfig = createBuildConfig(isDev);
const { errors } = await runParallelBuilds(entryPoints, buildConfig);
if (errors.length > 0) {
throw new Error(`React build failed: ${errors.length} component(s) could not be built`);
}
}
/**
* Start esbuild in native watch mode over all React components.
*
* Creates a single incremental build context for all entry points so that
* esbuild can reuse its internal graph between rebuilds instead of starting
* from scratch on every file change.
*
* @param {boolean} isDev Whether to build in development mode.
* @param {((srcFiles: string[]) => void) | undefined} [onRebuild] Called with the rebuilt entry source
* files (relative to project root) after each non-initial successful rebuild. Use this to run
* follow-up tasks such as linting without coupling them to this module.
* @returns {Promise<import('esbuild').BuildContext|null>} The active context, or null if no source files exist.
*/
export async function watchComponents(isDev, onRebuild) {
const entryPoints = glob.sync("**/js/esm/src/**/*.{ts,tsx}", {
cwd: projectRoot,
absolute: true,
ignore: [
`${process.cwd()}/node_modules/**`,
`${process.cwd()}/vendor/**`,
],
});
if (entryPoints.length === 0) {
return null;
}
const buildConfig = createBuildConfig(isDev);
// Map each source file to an {in, out} pair so esbuild can write each
// component to its custom output directory while sharing a single context.
// The 'out' path is relative to outdir (projectRoot) and has no extension —
// esbuild appends the appropriate extension automatically.
// Build entry pairs and ensure output directories exist in a single pass.
const entryPairs = entryPoints.flatMap(entry => {
const resolved = resolveComponentPaths(entry);
if (!resolved) {
return [];
}
fs.mkdirSync(path.dirname(resolved.output), { recursive: true });
return [{ in: entry, out: path.relative(projectRoot, resolved.output).replace(/\.js$/, '') }];
});
// Report build results to the terminal after every build (initial and on each change).
// metafile: true populates result.metafile.outputs so we know which files were written.
// On a rebuild only the affected outputs appear, so it effectively names the changed file.
/** @type {import('esbuild').Plugin} */
const watchReporter = {
name: 'watch-reporter',
setup(build) {
let isInitial = true;
let startTime = 0;
build.onStart(() => {
startTime = Date.now();
});
build.onEnd(result => {
const now = new Date().toLocaleTimeString();
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
if (result.errors.length > 0) {
console.error(chalk.red(`[${now}] ✗ Build failed (${result.errors.length} error(s))`) + chalk.dim(` · ${elapsed}s`));
return;
}
const outputs = Object.keys(result.metafile?.outputs ?? {});
console.log(chalk.green(`[${now}] ✓ ${outputs.length} component(s) built`) + chalk.dim(` · ${elapsed}s`));
if (isInitial) {
isInitial = false;
} else if (onRebuild) {
// entryPoint is the source file (relative to projectRoot) that triggered
// this rebuild. Pass it to the caller so they can run follow-up tasks
// (e.g. linting) without this module needing to know about them.
const srcFiles = Object.values(result.metafile?.outputs ?? {})
.map(output => output.entryPoint)
.filter(/** @param {string|undefined} f */ f => !!f);
onRebuild(/** @type {string[]} */ (srcFiles));
}
});
},
};
const ctx = await esbuild.context({
...buildConfig,
entryPoints: entryPairs,
outdir: projectRoot,
metafile: true,
plugins: [watchReporter],
});
await ctx.watch();
return ctx;
}
-266
View File
@@ -1,266 +0,0 @@
{
'plugins': [
'@babel',
'promise',
'jsdoc'
],
'extends': [
'eslint:recommended',
'plugin:promise/recommended'
],
'env': {
'browser': true,
// Enable ES6+ features by default.
// See http://eslint.org/docs/user-guide/configuring#specifying-environments
// Note: The YUI override must exactly match this when disabling the ES6+ version because those features are not supported by Shifter.
'es2020': true,
'amd': true
},
'globals': {
'M': true,
'Y': true
},
// Warn about unused eslint-disable statements.
'reportUnusedDisableDirectives': true,
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
'no-console': 'error',
'no-empty': 'warn',
'no-extra-parens': 'off',
'no-prototype-builtins': 'off',
'no-unreachable': 'warn',
// === Best Practices ===
// (these mostly match our jshint config)
'array-callback-return': 'warn',
'block-scoped-var': 'warn',
'complexity': 'warn',
'consistent-return': 'warn',
'curly': 'error',
'dot-notation': 'warn',
'no-alert': 'warn',
'no-caller': 'error',
'no-div-regex': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-loop-func': 'error',
'no-multi-spaces': 'warn',
'no-multi-str': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-restricted-globals': ['error', { 'name': 'Notification' }],
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
'wrap-iife': ['error', 'any'],
// === Variables ===
'no-undef-init': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
// === Stylistic Issues ===
'array-bracket-spacing': 'warn',
'block-spacing': 'warn',
'brace-style': ['warn', '1tbs'],
'camelcase': 'warn',
'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
'comma-spacing': ['warn', { 'before': false, 'after': true }],
'comma-style': ['warn', 'last'],
'computed-property-spacing': 'error',
'consistent-this': 'off',
'eol-last': 'off',
'func-call-spacing': ['warn', 'never'],
'func-names': 'off',
'func-style': 'off',
// indent currently not doing well with our wrapping style, so disabled.
'indent': ['off', 4, { 'SwitchCase': 1 }],
'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
'keyword-spacing': 'warn',
'linebreak-style': ['error', 'unix'],
'lines-around-comment': 'off',
'max-len': ['error', 132],
'max-lines': 'off',
'max-depth': 'warn',
'max-nested-callbacks': ['warn', 5],
'max-params': 'off',
'max-statements': 'off',
'max-statements-per-line': ['warn', { max: 2 }],
'new-cap': ['warn', { 'properties': false }],
'new-parens': 'warn',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
'no-continue': 'off',
'no-inline-comments': 'off',
'no-lonely-if': 'off',
'no-mixed-operators': 'off',
'no-multiple-empty-lines': 'warn',
'no-negated-condition': 'off',
'no-nested-ternary': 'warn',
'no-new-object': 'off',
'no-plusplus': 'off',
'no-tabs': 'error',
'no-ternary': 'off',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-unneeded-ternary': 'off',
'no-whitespace-before-property': 'warn',
'object-curly-newline': 'off',
'object-curly-spacing': 'warn',
'object-property-newline': 'off',
'one-var': 'off',
'one-var-declaration-per-line': ['warn', 'initializations'],
'operator-assignment': 'off',
'operator-linebreak': 'off',
'padded-blocks': 'off',
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
'quotes': 'off',
'semi': 'error',
'semi-spacing': ['warn', {'before': false, 'after': true}],
'sort-vars': 'off',
'space-before-blocks': 'warn',
'space-before-function-paren': ['warn', 'never'],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
'spaced-comment': 'warn',
'unicode-bom': 'error',
'wrap-regex': 'off',
// === Promises (override plugin:promise/recommended) ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail', 'always'], allowFinally: true}],
'promise/no-native': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
'message': 'Use "core/str" module or M.util.get_string()'
}],
},
overrides: [
{
files: ["**/yui/src/**/*.js"],
'env': {
// Disable ES6+ for YUI files.
'es2020': false,
},
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off',
// === JSDocs ===
"jsdoc/check-access": 'off',
"jsdoc/check-alignment": 'off',
"jsdoc/check-param-names": 'off',
"jsdoc/check-property-names": 'off',
"jsdoc/empty-tags": 'off',
"jsdoc/implements-on-classes": 'off',
"jsdoc/multiline-blocks": 'off',
"jsdoc/require-jsdoc": 'off',
"jsdoc/require-param": 'off',
"jsdoc/require-param-name": 'off',
"jsdoc/require-param-type": 'off',
"jsdoc/require-property": 'off',
"jsdoc/require-property-name": 'off',
"jsdoc/require-property-type": 'off',
}
},
{
files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
// We're using babel transpiling so use their parser
// for linting.
parser: '@babel/eslint-parser',
// Check AMD with some slightly stricter rules.
rules: {
'no-implicit-globals': 'error',
// Disable all of the rules that have babel versions.
'new-cap': 'off',
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'no-invalid-this': 'off',
'object-curly-spacing': 'off',
'quotes': 'off',
'semi': 'off',
'no-unused-expressions': 'off',
// Enable all of the babel version of these rules.
'@babel/new-cap': ['warn', { 'properties': false }],
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'@babel/no-invalid-this': 'off',
'@babel/object-curly-spacing': 'warn',
'@babel/semi': 'error',
'@babel/no-unused-expressions': 'error',
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off',
// === JSDocs ===
'jsdoc/check-access': 'error',
'jsdoc/check-alignment': 1, // Recommended.
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/empty-tags': 'error',
'jsdoc/implements-on-classes': 'error',
'jsdoc/multiline-blocks': 'error',
'jsdoc/require-jsdoc': 'error',
'jsdoc/require-param': 'error',
'jsdoc/require-param-name': 'error',
'jsdoc/require-param-type': 'error',
'jsdoc/require-property': 'error',
'jsdoc/require-property-name': 'error',
'jsdoc/require-property-type': 'error'
},
parserOptions: {
'sourceType': 'module',
'requireConfigFile': false
}
},
{
files: ["**/*.ts", "**/*.tsx"],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true
},
allowSyntheticDefaultImports: true
},
rules: {
// promise/no-native crashes on TypeScript ASTs (same reason it is
// disabled for AMD files above). Native Promises are standard in TS.
'promise/no-native': 'off',
'promise/avoid-new': 'off',
}
}
]
}
-24
View File
@@ -1,24 +0,0 @@
{
"indentation": ["on",{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4,
"given": 4,
"and": 4
}],
"no-dupe-feature-names": "on",
"no-dupe-scenario-names": "off",
"no-empty-file": "on",
"no-files-without-scenarios": "on",
"no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on",
"no-examples-in-scenarios": "on",
"new-line-at-eof": ["on", "yes"]
}
-9
View File
@@ -1,9 +0,0 @@
**/yui/build/** -diff
**/amd/build/** -diff
**.js.map -diff
**-min.js -diff
**.min.js -diff
# Remove composer lock file changes from standard diff views.
/composer.lock -diff
/lib/js/bundles/*/*.js -diff
-2
View File
@@ -1,2 +0,0 @@
# Primary donations pages.
custom: ["https://moodle.com/donations/"]
-7
View File
@@ -1,7 +0,0 @@
*** PLEASE DO NOT OPEN PULL REQUESTS VIA GITHUB ***
The moodle.git repository at Github is just a mirror of the official repository. We do not accept pull requests at Github.
See CONTRIBUTING.md guidelines for how to contribute patches for Moodle. Thank you.
--
-6
View File
@@ -1,6 +0,0 @@
> [!IMPORTANT]
> PLEASE DO NOT PUBLISH SECURITY FINDINGS PUBLICLY.
If you discover a potential security issue, please report it via our [Security Submission Form](https://moodle.org/security/report).
For more information about our security processes and responsible disclosure policy, see the [Security Procedures documentation](https://moodledev.io/general/development/process/security).
-1
View File
@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1231.24 314.44" preserveAspectRatio="xMinYMid meet"><defs><style>.cls-1{fill:#f48020;}.cls-2,.cls-3{fill:#383738;stroke:#4a4a4c;}.cls-2{stroke-width:2.37px;}.cls-3{stroke-width:2.38px;}.cls-4{fill:#585858;}</style></defs><title>Moodle_Logo_UseonBlack_RGB</title><path class="cls-1" d="M1086.3,235.34a53.42,53.42,0,0,0,16.71,29q13.26,12.27,29.48,12.27,11.29,0,24.56-5.89,16.23-6.88,16.22-16.22l58-.49q-12.29,29-41.76,45.2-27.52,15.23-60.43,15.24-42.25,0-70-26.29t-27.75-68.54q0-43.73,27.75-69.51t72-25.8q48.15,0,75.17,31.94,25.07,29.47,25.06,79.1Zm89.91-33.91q-3.43-17.69-14.73-29-12.8-12.28-29.49-12.29-17.21,0-28.74,11.79t-15.47,29.48Z"/><path class="cls-1" d="M965.45,308.54V0h55V308.54Z"/><path class="cls-1" d="M892.69,308.54V290.36q-7.38,9.83-25.06,15.72a92.31,92.31,0,0,1-30,5.41q-39.31,0-63.13-27T750.7,217.65q0-39.3,23.34-65.84t62.15-26.53q43.71,0,56.5,23.58V0h53.55V308.54Zm0-102.68q0-14.75-14-28.26t-28.74-13.51q-21.12,0-33.41,17.2-10.8,15.24-10.8,37.33,0,21.63,10.8,36.85,12.29,17.71,33.41,17.69,12.78,0,27.76-12t15-24.81Z"/><path class="cls-1" d="M647,313.45q-41.77,0-69-26.53t-27.27-68.3q0-41.73,27.27-68.28t69-26.53q41.75,0,69.27,26.53t27.52,68.28q0,41.79-27.52,68.3T647,313.45ZM647,168q-19.89,0-30.58,15.07t-10.68,35.79q0,20.73,9.94,35.05,11.43,16.31,31.32,16.28t31.32-16.28q10.44-14.31,10.44-35.05t-9.94-35Q667.42,168,647,168Z"/><path class="cls-1" d="M448.07,313.45q-41.76,0-69-26.53t-27.27-68.3q0-41.73,27.27-68.28t69-26.53q41.74,0,69.28,26.53t27.5,68.28q0,41.79-27.5,68.3T448.07,313.45Zm0-145.43q-19.89,0-30.59,15.07t-10.69,35.79q0,20.73,9.94,35.05,11.43,16.31,31.34,16.28t31.32-16.28q10.42-14.31,10.44-35.05t-9.94-35Q468.45,168,448.07,168Z"/><path class="cls-1" d="M288.89,309.11V201q0-33.9-28-33.9t-28,33.9V309.11h-55V201q0-33.9-27.52-33.9-28,0-28,33.9V309.11h-55V194.65q0-35.37,24.56-53.54,21.61-16.22,58.46-16.22,37.35,0,55,19.16,15.23-19.16,55.51-19.16,36.86,0,58.45,16.22,24.57,18.16,24.57,53.54V309.11Z"/><path class="cls-2" d="M.76,145.76"/><path class="cls-3" d="M1.73,145.32"/><path class="cls-4" d="M173.86,116.85l55.08-40.1-.7-2.44C135,83.92,80.42,96.44,0,144.13l.73,2.38,21-.67c15.17.52,30.85,1.26,46,1.32-1,24.09.83,32.65.83,32.65,51.92,17.58,101.22,1.53,127.14-43.9A248.72,248.72,0,0,0,173.86,116.85Z"/><path class="cls-4" d="M113.78,110c-.3-1.08-2.23-1.48-4.28-.9a4.73,4.73,0,0,0-3.14,2.19c-18.53,5-49.16,13.72-70.73,21l-1.33.45c-16.68,5.61-24.73,8.49-25.22,12.55-2.29,18.44-.87,42.18-.86,42.48l.19,6.4c-9.74,27.56.06,49.6,8.38,69.77.06-24.92,1.07-45.22-6-71-.2-3.82-1.49-30.36.61-47.34.34-2.75,11.65-6.56,23.63-10.59l1.33-.44c22-7.42,53.57-16.39,71.9-21.29a6.75,6.75,0,0,0,2.29-.25C112.64,112.43,114.08,111.09,113.78,110Z"/></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

-31
View File
@@ -1,31 +0,0 @@
name: 'Close Pull Requests'
on:
pull_request_target:
types: opened
workflow_dispatch:
jobs:
close:
# Avoid forks to run this job
if: github.repository_owner == 'moodle'
name: Close Pull Requests
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v4
with:
process-only: prs
close-pr: true
skip-closed-pr-comment: true
pr-comment: >
**Please, don't open pull requests via GitHub.**
This repository (moodle.git) at GitHub is just a mirror of the official Moodle repository.
For how to contribute patches for Moodle see
[CONTRIBUTING.md](https://github.com/moodle/moodle/blob/main/CONTRIBUTING.md).
Closing this pull request.
-118
View File
@@ -1,118 +0,0 @@
name: Run tests in a Composed Moodle Setup
on:
push:
branches-ignore:
- main
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.4
jobs:
PHPUnit:
runs-on: ${{ matrix.os }}
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
postgres:
image: ${{ matrix.db == 'pgsql' && 'postgres:16' || '' }}
env:
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
include:
# MySQL builds always run with the lowest PHP supported version.
- os: ubuntu-24.04
php: 8.3
extensions:
db: mysqli
# PostgreSQL builds always run with the highest PHP supported version.
- os: ubuntu-24.04
php: 8.4
db: pgsql
steps:
- name: Run MySQL Server
if: ${{ matrix.db == 'mysqli' }}
run: |
docker run --rm \
-e MYSQL_DATABASE=test \
-e MYSQL_USER=test \
-e MYSQL_PASSWORD=test \
-e MYSQL_ROOT_PASSWORD=test \
-p 3306:3306 \
-d \
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=1024M \
mysql:8.4 \
--skip-log-bin \
--collation-server=utf8mb4_bin
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v5
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
tools: composer
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v6
with:
path: 'moodle'
- name: 'Preparing the environment'
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
sudo locale-gen en_AU.UTF-8
- name: Create the new Composer Project
run: |
mkdir testsite
cp moodle/.github/workflows/composed/composer.json testsite/composer.json
cp moodle/.github/workflows/composed/config.php testsite/config.php
mkdir -p testsite/data/moodledata
mkdir -p testsite/data/phpunitdata
- name: Install the Moodle test site
working-directory: testsite
run: |
composer install --no-interaction
- name: Setting up PHPUnit
working-directory: testsite
env:
dbtype: ${{ matrix.db }}
run: |
php moodle/public/admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
working-directory: testsite
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: |
vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
-25
View File
@@ -1,25 +0,0 @@
{
"type": "project",
"require": {
"moodle/composer-installer": "^1",
"moodle/moodle-composer-scaffold": "^1",
"moodle/moodle": "@dev",
"moodle/moodle-testing": "^1.0"
},
"repositories": [
{
"name": "moodleundertest",
"type": "path",
"url": "../moodle"
}
],
"config": {
"audit": {
"block-insecure": false
},
"allow-plugins": {
"moodle/composer-installer": true,
"moodle/moodle-composer-scaffold": true
}
}
}
-67
View File
@@ -1,67 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Template configuraton file for GitHub Actions CI/CD using Composer.
*
* @package core
* @copyright 2020 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This cannot be used out from a GitHub Actions workflow, so just exit.
getenv('GITHUB_WORKFLOW') || die; // phpcs:ignore moodle.Files.MoodleInternal.MoodleInternalGlobalState
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = getenv('dbtype');
$CFG->dblibrary = 'native';
$CFG->dbhost = '127.0.0.1';
$CFG->dbname = 'test';
$CFG->dbuser = 'test';
$CFG->dbpass = 'test';
$CFG->prefix = 'm_';
$CFG->dboptions = ['dbcollation' => 'utf8mb4_bin'];
$host = 'localhost';
$CFG->wwwroot = "http://{$host}";
$CFG->dataroot = __DIR__ . '/data/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
// Debug options - possible to be controlled by flag in future.
$CFG->debug = (E_ALL); // DEBUG_DEVELOPER.
$CFG->debugdisplay = 1;
$CFG->debugstringids = 1; // Add strings=1 to url to get string ids.
$CFG->perfdebug = 15;
$CFG->debugpageinfo = 1;
$CFG->allowthemechangeonurl = 1;
$CFG->passwordpolicy = 0;
$CFG->cronclionly = 0;
$CFG->pathtophp = getenv('pathtophp');
$CFG->phpunit_dataroot = __DIR__ . '/data/phpunitdata';
$CFG->phpunit_prefix = 't_';
$CFG->routerconfigured = true;
define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://localhost:8080');
define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://localhost:8080');
define('TEST_SESSION_REDIS_HOST', 'localhost');
define('TEST_CACHESTORE_REDIS_TESTSERVERS', 'localhost');
-73
View File
@@ -1,73 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Template configuraton file for github actions CI/CD.
*
* @package core
* @copyright 2020 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This cannot be used out from a github actions workflow, so just exit.
getenv('GITHUB_WORKFLOW') || die; // phpcs:ignore moodle.Files.MoodleInternal.MoodleInternalGlobalState
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = getenv('dbtype');
$CFG->dblibrary = 'native';
$CFG->dbhost = '127.0.0.1';
$CFG->dbname = 'test';
$CFG->dbuser = 'test';
$CFG->dbpass = 'test';
$CFG->prefix = 'm_';
$CFG->dboptions = ['dbcollation' => 'utf8mb4_bin'];
$host = 'localhost';
$CFG->wwwroot = "http://{$host}";
$CFG->dataroot = realpath(dirname(__DIR__)) . '/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
// Debug options - possible to be controlled by flag in future.
$CFG->debug = (E_ALL); // DEBUG_DEVELOPER.
$CFG->debugdisplay = 1;
$CFG->debugstringids = 1; // Add strings=1 to url to get string ids.
$CFG->perfdebug = 15;
$CFG->debugpageinfo = 1;
$CFG->allowthemechangeonurl = 1;
$CFG->passwordpolicy = 0;
$CFG->cronclionly = 0;
$CFG->pathtophp = getenv('pathtophp');
$CFG->phpunit_dataroot = realpath(dirname(__DIR__)) . '/phpunitdata';
$CFG->phpunit_prefix = 't_';
$CFG->routerconfigured = true;
define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://localhost:8080');
define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://localhost:8080');
define('TEST_SESSION_REDIS_HOST', 'localhost');
define('TEST_CACHESTORE_REDIS_TESTSERVERS', 'localhost');
// TODO: add others (solr, mongodb, memcached, ldap...).
// Too much for now: define('PHPUNIT_LONGTEST', true); // Only leaves a few tests out and they are run later by CI.
require_once(__DIR__ . '/lib/setup.php');
-143
View File
@@ -1,143 +0,0 @@
name: One by One Testing
# Run all the individual unit tests one by one, with
# fully independent PHPUnit executions. Useful to
# detect issues with some tests that are using stuff
# that has been made available by others, but is not
# available when running individually.
#
# Note that we aren't using PHPUnit's own isolation
# here but completely separated runs, one for each
# test.
#
# The workflow will fail reporting all the tests
# that have failed (and will pass if no failure is
# detected, of course).
#
# It's only executed via workflow dispatch (automated
# or manual), not by push/tag. And acceptd configuration
# of phpunit, specially useful to run it with PHPUnit's
# own isolation or any other option.
on:
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
chunks: 7
jobs:
collect:
name: Collect individual unit tests
runs-on: ubuntu-latest
outputs:
matrix: ${{steps.individual-tests.outputs.matrix }}
steps:
- name: Checking out code
uses: actions/checkout@v4
- name: Looking for all individual tests
id: individual-tests
run: |
count=0 # Number of individual tests found.
while read -r testfile; do # For each test file.
while read -r testname; do # For each unit test in a file.
count=$((count + 1))
# Sent it to the correct chunk file.
chunk=$(((($count % $chunks)) + 1))
echo "$testname $testfile" >> ./chunk_$chunk.txt
done < <(grep "function test_" "${testfile}" | sed -r "s/^.*function (test_[a-zA-Z0-9_]+).*/\1/")
done < <(find . -name "*_test.php" -not -path "*/fixtures/*")
# Generate the matrix to run tests.
echo "matrix=$(ls -1 chunk_*.txt | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
echo "$count individual tests collected in $chunks files"
- name: Upload individual tests files
uses: actions/upload-artifact@v4
with:
name: individual_tests
path: chunk_*.txt
retention-days: 1
test:
name: Run tests
needs: collect
runs-on: ubuntu-latest
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.collect.outputs.matrix) }}
steps:
- name: Setting up DB pgsql
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 16
postgresql db: test
postgresql user: test
postgresql password: test
- name: Setting up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
ini-values: max_input_vars=5000
coverage: none
- name: Checking out code
uses: actions/checkout@v4
- name: Download individual test files
uses: actions/download-artifact@v4
with:
name: individual_tests # Make all the chunk files available for the next steps.
- name: Setting up PHPUnit
env:
dbtype: pgsql
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
sudo locale-gen en_AU.UTF-8
php public/admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Run PHPUnit test (one by one)
env:
dbtype: pgsql
run: |
status=0
count=0
while read -r line; do # For each line in the chunk file
count=$((count + 1))
filter="${line% *}"
file="${line#* }"
# Run the individual unit test and report problems if needed to.
if ! php vendor/bin/phpunit \
--fail-on-empty-test-suite \
--fail-on-warning \
--fail-on-risky \
--filter "$filter" ${{ inputs.phpunit_extra_options }} \
"$file" >/dev/null 2>&1; then
if [ $status -eq 0 ]; then
echo "Problems found, list of PHPUnit commands failing:"
fi
echo "vendor/bin/phpunit --filter '${filter}' ${{ inputs.phpunit_extra_options }} $file"
status=$((status + 1))
fi
done < ${{ matrix.file }}
echo "Finished: $count individual tests executed, $status tests failed"
exit $status
-128
View File
@@ -1,128 +0,0 @@
name: Core
on:
push:
branches-ignore:
- main
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.4
jobs:
Grunt:
runs-on: ubuntu-24.04
steps:
- name: Checking out code
uses: actions/checkout@v4
- name: Configuring node & npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Installing node stuff
run: npm install
- name: Running grunt
run: npx grunt
- name: Looking for uncommitted changes
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
# We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
run: |
git add .
git reset -- npm-shrinkwrap.json
git diff --cached --exit-code
PHPUnit:
runs-on: ${{ matrix.os }}
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
postgres:
image: ${{ matrix.db == 'pgsql' && 'postgres:16' || '' }}
env:
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
include:
# MySQL builds always run with the lowest PHP supported version.
- os: ubuntu-24.04
php: 8.3
extensions:
db: mysqli
# PostgreSQL builds always run with the highest PHP supported version.
- os: ubuntu-24.04
php: 8.4
db: pgsql
steps:
- name: Run MySQL Server
if: ${{ matrix.db == 'mysqli' }}
run: |
docker run --rm \
-e MYSQL_DATABASE=test \
-e MYSQL_USER=test \
-e MYSQL_PASSWORD=test \
-e MYSQL_ROOT_PASSWORD=test \
-p 3306:3306 \
-d \
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=1024M \
mysql:8.4 \
--skip-log-bin \
--collation-server=utf8mb4_bin
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v4
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
sudo locale-gen en_AU.UTF-8
php public/admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
- name: Git status
run: git status
-23
View File
@@ -1,23 +0,0 @@
name: Web Installer Testing
on:
workflow_dispatch:
jobs:
InstallationTest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.3, 8.4]
steps:
- name: Construct repository URL
run: echo "REPOSITORY_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
shell: bash
- uses: moodlehq/moodle-webinstaller-test@main
with:
repository: ${{ env.REPOSITORY_URL }}
branch: ${{ github.ref_name }}
php: ${{ matrix.php }}
-149
View File
@@ -1,149 +0,0 @@
name: Windows Testing
on:
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.4
jobs:
Grunt:
runs-on: windows-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code
uses: actions/checkout@v4
- name: Configuring node & npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Installing node stuff
run: npm ci
- name: Running grunt
run: npx grunt
- name: Looking for uncommitted changes
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
# We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
run: |
git add .
git reset -- npm-shrinkwrap.json
git diff --cached --exit-code
PHPUnit:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
php: 8.4
# Ideally we should use mysql/mariadb, but they are 4x slower without tweaks and configuration
# so let's run only postgres (1.5h vs 6h) only, If some day we want to improve the mysql runs,
# this is the place to enable them.
# db: mysqli
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
- os: windows-latest
php: 8.3
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: 8.4
user: test
password: test
- name: Creating DB mysql
if: ${{ matrix.db == 'mysqli' }}
run: mysql --host 127.0.0.1 -utest -ptest -e 'CREATE DATABASE IF NOT EXISTS test COLLATE = utf8mb4_bin;';
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
# TODO: Remove these conf. modifications when php74 or php80 are lowest.
# Change to old md5 auth, because php73 does not support it.
# #password_encryption = scram-sha-256
(Get-Content "$env:PGDATA\postgresql.conf"). `
replace('#password_encryption = scram-sha-256', 'password_encryption = md5') | `
Set-Content "$env:PGDATA\postgresql.conf"
(Get-Content "$env:PGDATA\pg_hba.conf"). `
replace('scram-sha-256', 'md5') | `
Set-Content "$env:PGDATA\pg_hba.conf"
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
& $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
- name: Creating DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
& $env:PGBIN\createdb --owner=test test
$env:PGPASSWORD = 'test'
& $env:PGBIN\psql --username=test --host=localhost --list test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v4
# Needs to be done after php is available, git configured and Moodle checkout has happened.
- name: Setting up moodle-exttests service
run: |
git clone https://github.com/moodlehq/moodle-exttests.git
nssm install php-built-in C:\tools\php\php.exe -S localhost:8080 -t D:\a\moodle\moodle\moodle-exttests
nssm start php-built-in
- name: Setting up redis service
run: |
choco install redis --version 5.0.7 --no-progress
nssm install redis redis-server
nssm start redis
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
shell: bash
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
php public/admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
-63
View File
@@ -1,63 +0,0 @@
# This file specifies intentionally untracked files that all Moodle git
# repositories should ignore. It is recommended not to modify this file in your
# local clone. Instead, use .git/info/exclude and add new records there as
# needed.
#
# Example: if you deploy a contributed plugin mod/foobar into your site, put
# the following line into .git/info/exclude file in your Moodle clone:
# /mod/foobar/
#
# See gitignore(5) man page for more details
#
# Swap files (vim)
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Temporary files including undo
*~
#
/config.php
/tags
/TAGS
/cscope.*
/.patches/
/.idea/
.phpstorm.*
!/.phpstorm.meta.php/
/.phpstorm.meta.php/*
!/.phpstorm.meta.php/di.php
/nbproject/
CVS
.DS_Store
/.settings/
/.project
/.buildpath
/.cache
.phpunit.result.cache
phpunit.xml
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
composer.phar
/vendor/
/behat.yml
*/yui/build/*/*-coverage.js
/public/lib/yuilib/*/build/*/*-coverage.js
# lib/yuilib/version/module/module-coverage.js
/public/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
/node_modules/
/.vscode/
moodle-plugin-ci.phar
.eslintignore
.stylelintignore
/jsdoc
/public/admin/tool/componentlibrary/docs
/public/admin/tool/componentlibrary/hugo/site/data/my-index.json
.hugo_build.lock
phpcs.xml
jsconfig.json
UPGRADING-CURRENT.md
.phpunit.cache
tsconfig.aliases.json
-169
View File
@@ -1,169 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This is a babel plugin to add the Moodle module names to the AMD modules
* as part of the transpiling process.
*
* In addition it will also add a return statement for the default export if the
* module is using default exports. This is a highly specific Moodle thing because
* we're transpiling to AMD and none of the existing Babel 7 plugins work correctly.
*
* This will fix the issue where an ES6 module using "export default Foo" will be
* transpiled into an AMD module that returns {default: Foo}; Instead it will now
* just simply return Foo.
*
* Note: This means all other named exports in that module are ignored and won't be
* exported.
*
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
module.exports = ({template, types}) => {
const fs = require('fs');
const path = require('path');
const cwd = process.cwd();
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
/**
* Search the list of components that match the given file name
* and return the Moodle component for that file, if found.
*
* Throw an exception if no matching component is found.
*
* @throws {Error}
* @param {string} searchFileName The file name to look for.
* @return {string} Moodle component
*/
function getModuleNameFromFileName(searchFileName) {
searchFileName = fs.realpathSync(searchFileName);
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
const [componentPath, file] = relativeFileName.split('/amd/src/');
const fileName = file.replace('.js', '');
// Check subsystems first which require an exact match.
const componentName = ComponentList.getComponentFromPath(componentPath);
if (componentName) {
return `${componentName}/${fileName}`;
}
// This matches the previous PHP behaviour that would throw an exception
// if it couldn't parse an AMD file.
throw new Error(`Unable to find module name for ${searchFileName} (${componentPath}::${file}}`);
}
/**
* This is heavily inspired by the babel-plugin-add-module-exports plugin.
* See: https://github.com/59naga/babel-plugin-add-module-exports
*
* This is used when we detect a module using "export default Foo;" to make
* sure the transpiled code just returns Foo directly rather than an object
* with the default property (i.e. {default: Foo}).
*
* Note: This means that we can't support modules that combine named exports
* with a default export.
*
* @param {String} path
* @param {String} exportObjectName
*/
function addModuleExportsDefaults(path, exportObjectName) {
const rootPath = path.findParent(path => {
return path.key === 'body' || !path.parentPath;
});
// HACK: `path.node.body.push` instead of path.pushContainer(due doesn't work in Plugin.post).
// This is hardcoded to work specifically with AMD.
rootPath.node.body.push(template(`return ${exportObjectName}.default`)());
}
return {
pre() {
this.seenDefine = false;
this.addedReturnForDefaultExport = false;
},
visitor: {
// Plugin ordering is only respected if we visit the "Program" node.
// See: https://babeljs.io/docs/en/plugins.html#plugin-preset-ordering
//
// We require this to run after the other AMD module transformation so
// let's visit the "Program" node.
Program: {
exit(path) {
path.traverse({
CallExpression(path) {
// If we find a "define" function call.
if (!this.seenDefine && path.get('callee').isIdentifier({name: 'define'})) {
// We only want to modify the first instance of define that we find.
this.seenDefine = true;
// Get the Moodle component for the file being processed.
var moduleName = getModuleNameFromFileName(this.file.opts.filename);
// The function signature of `define()` is:
// define = function (name, deps, callback) {...}
// Ensure that if the moduel supplied its own name that it is replaced.
if (path.node.arguments.length > 0) {
// Ensure that there is only one name.
if (path.node.arguments[0].type === 'StringLiteral') {
// eslint-disable-next-line
console.log(`Replacing module name '${path.node.arguments[0].extra.rawValue}' with ${moduleName}`);
path.node.arguments.shift();
}
}
// Add the module name as the first argument to the define function.
path.node.arguments.unshift(types.stringLiteral(moduleName));
// Add a space after the define function in the built file so that previous versions
// of Moodle will not try to add the module name to the file when it's being served
// by PHP. This forces the regex in PHP to not match for this file.
path.node.callee.name = 'define ';
}
// Check for any Object.defineProperty('exports', 'default') calls.
if (!this.addedReturnForDefaultExport && path.get('callee').matchesPattern('Object.defineProperty')) {
const [identifier, prop] = path.get('arguments');
const objectName = identifier.get('name').node;
const propertyName = prop.get('value').node;
if ((objectName === 'exports' || objectName === '_exports') && propertyName === 'default') {
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
},
AssignmentExpression(path) {
// Check for an exports.default assignments.
if (
!this.addedReturnForDefaultExport &&
(
path.get('left').matchesPattern('exports.default') ||
path.get('left').matchesPattern('_exports.default')
)
) {
const objectName = path.get('left.object.name').node;
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
}, this);
}
}
}
};
};
-455
View File
@@ -1,455 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Helper functions for working with Moodle component names, directories, and sources.
*
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
/** @var {Object} A list of subsystems in Moodle */
const componentData = {};
/**
* Load details of all moodle modules.
*
* @returns {object}
*/
const fetchComponentData = () => {
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const gruntFilePath = process.cwd();
if (!Object.entries(componentData).length) {
componentData.subsystems = {};
componentData.pathList = [];
componentData.components = {};
componentData.standardComponents = {};
// Fetch the component definiitions from the distributed JSON file.
const components = JSON.parse(fs.readFileSync(`${gruntFilePath}/lib/components.json`));
const pluginData = JSON.parse(fs.readFileSync(`${gruntFilePath}/lib/plugins.json`));
componentData.pluginTypes = components.plugintypes
const standardPlugins = Object.entries(pluginData.standard).map(
([pluginType, pluginNames]) => {
return pluginNames.map(pluginName => `${pluginType}_${pluginName}`);
}
).reduce((acc, val) => acc.concat(val), []);
// Build the list of moodle subsystems.
componentData.subsystems['public/lib'] = 'core';
componentData.pathList.push(`${process.cwd()}/public/lib`);
for (const [component, thisPath] of Object.entries(components.subsystems)) {
if (thisPath) {
// Prefix "core_" to the front of the subsystems.
componentData.subsystems[thisPath] = `core_${component}`;
componentData.pathList.push(`${process.cwd()}/${thisPath}`);
}
}
// The list of components includes the list of subsystems.
componentData.components = Object.fromEntries(
Object.entries(componentData.subsystems)
.map(([path, name]) => ([path, name]))
);
const subpluginAdder = (subpluginType, subpluginTypePath) => {
glob.sync(`${subpluginTypePath}/*/version.php`).forEach(versionPath => {
const componentPath = fs.realpathSync(path.dirname(versionPath));
const componentName = path.basename(componentPath);
const frankenstyleName = `${subpluginType}_${componentName}`;
componentData.components[`${subpluginTypePath}/${componentName}`] = frankenstyleName;
componentData.pathList.push(componentPath);
});
};
// Go through each of the plugintypes.
Object.entries(components.plugintypes).forEach(([pluginType, pluginTypePath]) => {
// We don't allow any code in this place..?
glob.sync(`${pluginTypePath}/*/version.php`).forEach(versionPath => {
const componentPath = fs.realpathSync(path.dirname(versionPath));
const componentName = path.basename(componentPath);
const frankenstyleName = `${pluginType}_${componentName}`;
componentData.components[`${pluginTypePath}/${componentName}`] = frankenstyleName;
componentData.pathList.push(componentPath);
// Look for any subplugins.
const subPluginConfigurationFile = `${componentPath}/db/subplugins.json`;
if (fs.existsSync(subPluginConfigurationFile)) {
const subpluginList = JSON.parse(fs.readFileSync(fs.realpathSync(subPluginConfigurationFile)));
if (subpluginList.subplugintypes) {
Object.entries(subpluginList.subplugintypes).forEach(([subpluginType, subpluginTypePath]) => {
subpluginAdder(
subpluginType,
`${pluginTypePath}/${componentName}/${subpluginTypePath}`
);
});
} else if (subpluginList.plugintypes) {
Object.entries(subpluginList.plugintypes).forEach(([subpluginType, subpluginTypePath]) => {
subpluginAdder(subpluginType, `public/${subpluginTypePath}`);
});
}
}
});
});
// Create a list of the standard subsystem and plugins.
componentData.standardComponents = Object.fromEntries(
Object.entries(componentData.components).filter(([, name]) => {
if (name === 'core' || name.startsWith('core_')) {
return true;
}
return standardPlugins.indexOf(name) !== -1;
})
);
componentData.componentMapping = Object.fromEntries(
Object.entries(componentData.components).map(([path, name]) => [name, path])
);
}
return componentData;
};
/**
* Get the list of component paths.
*
* @param {string} relativeTo
* @returns {array}
*/
const getComponentPaths = (relativeTo = '') => fetchComponentData().pathList.map(componentPath => {
return componentPath.replace(relativeTo, '');
});
/**
* Get the list of paths to build AMD sources.
*
* @returns {Array}
*/
const getAmdSrcGlobList = () => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
globList.push(`${componentPath}/amd/src/*.js`);
globList.push(`${componentPath}/amd/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to build YUI sources.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getYuiSrcGlobList = relativeTo => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
const relativeComponentPath = componentPath.replace(relativeTo, '');
globList.push(`${relativeComponentPath}/yui/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to thirdpartylibs.xml.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getThirdPartyLibsList = relativeTo => {
const fs = require('fs');
const path = require('path');
const pathList = fetchComponentData().pathList
.map(componentPath => path.relative(relativeTo, componentPath) + '/thirdpartylibs.xml')
.map(componentPath => componentPath.replace(/\\/g, '/'))
.filter(path => fs.existsSync(path));
pathList.push('lib/thirdpartylibs.xml');
return pathList.sort();
};
/**
* Get the list of thirdparty library paths.
*
* @returns {array}
*/
const getThirdPartyPaths = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const path = require('path');
const xpath = require('xpath');
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
const libs = ['node_modules/', 'vendor/'];
const addLibToList = lib => {
if (!lib.match('\\*') && fs.statSync(lib).isDirectory()) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
};
thirdpartyfiles.forEach(function(file) {
const dirname = path.dirname(file);
const xmlContent = fs.readFileSync(file, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const nodes = xpath.select("/libraries/library/location/text()", doc);
nodes.forEach(function(node) {
let lib = path.posix.join(dirname, node.toString());
addLibToList(lib);
});
});
return libs;
};
/**
* Find the name of the component matching the specified path.
*
* @param {String} path
* @returns {String|null} Name of matching component.
*/
const getComponentFromPath = path => {
const componentList = fetchComponentData().components;
if (componentList.hasOwnProperty(path)) {
return componentList[path];
}
return null;
};
/**
* Check whether the supplied path, relative to the Gruntfile.js, is in a known component.
*
* @param {String} checkPath The path to check. This can be with either Windows, or Linux directory separators.
* @returns {String|null}
*/
const getOwningComponentDirectory = checkPath => {
const path = require('path');
// Fetch all components into a reverse sorted array.
// This ensures that components which are within the directory of another component match first.
const pathList = Object.keys(fetchComponentData().components).sort().reverse();
for (const componentPath of pathList) {
// If the componentPath is the directory being checked, it will be empty.
// If the componentPath is a parent of the directory being checked, the relative directory will not start with ..
if (!path.relative(componentPath, checkPath).startsWith('..')) {
return componentPath;
}
}
return null;
};
/**
* Get the latest tag in a remote GitHub repository.
*
* @param {string} url The remote repository.
* @returns {Array}
*/
const getRepositoryTags = async(url) => {
const gtr = require('git-tags-remote');
try {
const tags = await gtr.get(url);
if (tags !== undefined) {
return tags;
}
} catch (error) {
return [];
}
return [];
};
/**
* Get the list of thirdparty libraries that could be upgraded.
*
* @returns {Array}
*/
const getThirdPartyLibsUpgradable = async() => {
const libraries = getThirdPartyLibsData().filter((library) => !!library.repository);
const upgradableLibraries = [];
const versionCompare = (a, b) => {
if (a === b) {
return 0;
}
const aParts = a.split('.');
const bParts = b.split('.');
for (let i = 0; i < Math.min(aParts.length, bParts.length); i++) {
const aPart = parseInt(aParts[i], 10);
const bPart = parseInt(bParts[i], 10);
if (aPart > bPart) {
// 1.1.0 > 1.0.9
return 1;
} else if (aPart < bPart) {
// 1.0.9 < 1.1.0
return -1;
} else {
// Same version.
continue;
}
}
if (aParts.length > bParts.length) {
// 1.0.1 > 1.0
return 1;
}
// 1.0 < 1.0.1
return -1;
};
for (let library of libraries) {
upgradableLibraries.push(
getRepositoryTags(library.repository).then((tagMap) => {
library.version = library.version.replace(/^v/, '');
const currentVersion = library.version.replace(/moodle-/, '');
const currentMajorVersion = library.version.split('.')[0];
const tags = [...tagMap]
.map((tagData) => tagData[0])
.filter((tag) => !tag.match(/(alpha|beta|rc)/))
.map((tag) => tag.replace(/^v/, ''))
.sort((a, b) => versionCompare(b, a));
if (!tags.length) {
library.warning = "Unable to find any comparable tags.";
return library;
}
library.latestVersion = tags[0];
tags.some((tag) => {
if (!tag) {
return false;
}
// See if the version part matches.
const majorVersion = tag.split('.')[0];
if (majorVersion === currentMajorVersion) {
library.latestSameMajorVersion = tag;
return true;
}
return false;
});
if (versionCompare(currentVersion, library.latestVersion) > 0) {
// Moodle somehow has a newer version than the latest version.
library.warning = `Newer version found: ${currentVersion} > ${library.latestVersion} for ${library.name}`;
return library;
}
if (library.version !== library.latestVersion) {
// Delete version and add it again at the end of the array. That way, current and new will stay closer.
delete library.version;
library.version = currentVersion;
return library;
}
return null;
})
);
}
return (await Promise.all(upgradableLibraries)).filter((library) => !!library);
};
/**
* Get the list of paths to build react sources.
*
* @param {string} relativeTo
* @returns {string[]}
*/
const getReactTsSrcGlobList = (relativeTo = '') => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
const relativeComponentPath = componentPath.replace(relativeTo, '');
globList.push(`${relativeComponentPath}/js/esm/src/**/*.ts`);
globList.push(`${relativeComponentPath}/js/esm/src/**/*.tsx`);
});
return globList.map(componentPath => componentPath.replace(/\\/g, '/'));
};
/**
* Get the list of thirdparty libraries.
*
* @returns {Array}
*/
const getThirdPartyLibsData = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const xpath = require('xpath');
const path = require('path');
const libraryList = [];
const libraryFields = [
'location',
'name',
'version',
'repository',
];
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
thirdpartyfiles.forEach(function(libraryPath) {
const xmlContent = fs.readFileSync(libraryPath, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const libraries = xpath.select("/libraries/library", doc);
for (const library of libraries) {
const libraryData = [];
for (const field of libraryFields) {
libraryData[field] = xpath.select(`${field}/text()`, library)?.toString();
}
libraryData.location = path.join(path.dirname(libraryPath), libraryData.location);
libraryList.push(libraryData);
}
});
return libraryList.sort((a, b) => a.location.localeCompare(b.location));
};
module.exports = {
fetchComponentData,
getAmdSrcGlobList,
getComponentFromPath,
getComponentPaths,
getOwningComponentDirectory,
getYuiSrcGlobList,
getThirdPartyLibsList,
getThirdPartyPaths,
getThirdPartyLibsUpgradable,
getReactTsSrcGlobList,
};
-19
View File
@@ -1,19 +0,0 @@
# Moodle JavaScript Documentation
```
.-..-.
_____ | || |
/____/-.---_ .---. .---. .-.| || | .---.
| | _ _ |/ _ \/ _ \/ _ || |/ __ \
* | | | | | || |_| || |_| || |_| || || |___/
|_| |_| |_|\_____/\_____/\_____||_|\_____)
Moodle - the world's open source learning platform
```
## About
This generated documentation includes API documentation for JavaScript written in the AMD and ES2015 module formats within Moodle.
## Related information
See [https://moodledev.io](https://moodledev.io) for other related Developer Documentation.
-131
View File
@@ -1,131 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Helper functions for working with Moodle component names, directories, and sources.
*
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
// Do not include any plugins as stanard.
const plugins = [];
plugins.push('plugins/markdown');
/**
* Get the source configuration.
*
* @return {Object}
*/
const getSource = () => {
const glob = require('glob');
const path = require('path');
const ComponentList = require(path.resolve('.grunt/components.js'));
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
const source = {
include: [],
includePattern: ".+\\.js$",
};
let includeList = [];
ComponentList.getAmdSrcGlobList().forEach(async pattern => {
includeList.push(...glob.sync(pattern));
});
const cwdLength = process.cwd().length + 1;
includeList.forEach(path => {
if (source.include.indexOf(path) !== -1) {
// Ensure no duplicates.
return;
}
const relPath = path.substring(cwdLength);
if (thirdPartyPaths.indexOf(relPath) !== -1) {
return;
}
source.include.push(path);
});
source.include.push('.grunt/jsdoc/README.md');
return source;
};
const tags = {
// Allow the use of unknown tags.
// We have a lot of legacy uses of these.
allowUnknownTags: true,
// We make use of jsdoc and closure dictionaries as standard.
dictionaries: [
'jsdoc',
'closure',
],
};
// Template configuraiton.
const templates = {
cleverLinks: false,
monospaceLinks: false,
};
module.exports = {
opts: {
destination: "./public/jsdoc/",
template: "node_modules/docdash",
},
plugins,
recurseDepth: 10,
source: getSource(),
sourceType: 'module',
tags,
templates,
docdash: {
collapse: true,
search: true,
sort: true,
sectionOrder: [
"Namespaces",
"Modules",
"Events",
"Classes",
"Externals",
"Mixins",
"Tutorials",
"Interfaces"
],
"menu": {
"Developer Docs": {
href: "https://moodledev.io",
target: "_blank",
"class": "menu-item",
id: "devdocs"
},
"MDN Docs": {
href: "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
target: "_blank",
"class": "menu-item",
id: "mdndocs",
},
},
typedefs: true,
},
};
-138
View File
@@ -1,138 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import * as Components from '../../components.js';
const componentData = Components.fetchComponentData();
/**
* The standard components shipped with core Moodle.
*
* @type {Object}
*/
export const standardComponents = componentData.standardComponents;
/**
* All components of the current Moodle instance.
*
* @type {Object}
*/
export const allComponents = componentData.components;
/**
* Get all components of the current Moodle instance.
*
* @returns {Array}
*/
export const getAllComponents = () => {
let components = new Map(Object.entries(componentData.pluginTypes).map(([value, path]) => ([path,{
path,
value,
name: `${value} (plugin type)`,
}])));
Object
.entries(componentData.components)
.filter(([path, value]) => Object.values(componentData.standardComponents).includes(value))
.forEach(([path, value]) => {
const entry = {
path,
value,
name: value,
};
if (Object.values(componentData.subsystems).includes(value)) {
if (components.has(path)) {
entry.name = `${value} (subsystem / plugintype)`;
} else {
entry.name = `${value} (subsystem)`;
}
}
components.set(path, entry);
});
return Array.from(components.values());
};
/**
* Whether the specified component is a standard component shipped with core Moodle.
*
* @param {string} componentName
* @returns {boolean}
*/
export const isStandardComponent = (componentName) => {
if (Object.values(componentData.standardComponents).includes(componentName)) {
return true;
}
if (Object.keys(componentData.pluginTypes).includes(componentName)) {
return true;
}
return false;
};
export const rewritePlugintypeAsSubsystem = (componentName) => {
if (Object.keys(componentData.pluginTypes).includes(componentName)) {
const pluginTypePath = componentData.pluginTypes[componentName];
if (Object.keys(componentData.subsystems).includes(pluginTypePath)) {
return true;
}
}
return false;
};
/**
* Whether the specified component is a community component.
*
* @param {string} componentName
* @returns {boolean}
*/
export const isCommunityComponent = (componentName) => {
if (isStandardComponent(componentName)) {
return false;
}
return Object.values(componentData.components).indexOf(componentName) !== -1;
};
/**
* Sort method for components.
*
* This method sorts components putting `core` first, followed by core subsystems, then everything else.
*
* @param {String} a
* @param {String} b
* @returns {Number}
*/
export const sortComponents = (a, b) => {
// Always put 'core' first.
if (a === 'core') {
return -1;
} else if (b === 'core') {
return 1;
}
// Put core subsystems next.
if (a.startsWith('core_') && !b.startsWith('core_')) {
return -1;
} else if (b.startsWith('core_') && !a.startsWith('core_')) {
return 1;
}
// Sort alphabetically for everything else.
return a.localeCompare(b);
};
-85
View File
@@ -1,85 +0,0 @@
#!/usr/bin/env node
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import inquirer from 'inquirer';
import chalk from 'chalk';
import { createNote } from './note.mjs';
import { getInitialValues, getIssueNumberFromBranchName } from './helpers.mjs';
import * as Prompts from './prompts.mjs';
import logger from './logger.mjs';
export default async (options) => {
// Processs the initial values.
const initialValues = getInitialValues(options);
// Fetch information.
const messages = [];
const { issueNumber } = await inquirer.prompt([
Prompts.getIssuePrompt(getIssueNumberFromBranchName()),
], initialValues);
let selection = {};
let notePath;
do {
selection = {};
selection = await inquirer.prompt([
Prompts.getComponentsPrompt(),
Prompts.getTypePrompt(),
Prompts.getMessagePromptInput(),
], initialValues);
if (selection.message === '') {
selection = Object.assign(
selection,
await inquirer.prompt([
Prompts.getMessagePromptEditor(),
]),
);
}
logger.info(`
Creating upgrade note with the following options:
- Issue: ${chalk.bold(issueNumber)}
- Component: ${chalk.bold(selection.components)}
- Type: ${chalk.bold(selection.type)}
- Message:
${chalk.bold(selection.message)}
`);
messages.push({
components: [selection.components],
type: selection.type,
message: selection.message,
});
// Save the note so far.
if (notePath) {
await createNote(issueNumber, messages, notePath);
logger.info(`Updated note at: ${chalk.underline(chalk.bold(notePath))}`);
} else {
notePath = await createNote(issueNumber, messages);
logger.info(`Note created at: ${chalk.underline(chalk.bold(notePath))}`);
}
selection = Object.assign(
selection,
await inquirer.prompt([
Prompts.getAddAnotherPrompt(),
], initialValues),
);
} while (selection.addAnother);
};
-357
View File
@@ -1,357 +0,0 @@
#!/usr/bin/env node
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import chalk from 'chalk';
import { getAllComponents } from './components.mjs';
import { getCombinedNotesByComponent, deleteAllNotes } from './note.mjs';
import { getNoteName } from './noteTypes.mjs';
import { writeFile, readFile, unlink } from 'fs/promises';
import { join as joinPath } from 'path';
import logger from './logger.mjs';
import { getCurrentVersion } from './helpers.mjs';
/**
* Helper to fetch the current notes from a file.
*
* @param {string} file
* @returns {Promise<string>}
*/
const getCurrentNotes = async (file) => {
try {
return await readFile(file, 'utf8');
} catch (error) {
return null;
}
}
/**
* Update the UPGRADING.md file.
*
* @param {string} upgradeNotes
* @param {Object} options
* @param {boolean} options.deleteNotes
* @returns {Promise<void>}
*/
const updateUpgradeNotes = async (upgradeNotes, options) => {
const fileName = 'UPGRADING.md';
// Write the notes to a file.
logger.info(`Writing notes to ${chalk.underline(chalk.bold(fileName))}`);
// Prepend to the existing file.
const existingContent = await getCurrentNotes(fileName);
if (existingContent) {
await writeFile(fileName, getUpdatedNotes(existingContent, upgradeNotes));
} else {
// This should not normally happen.
await writeFile(fileName, upgradeNotes);
}
if (options.deleteNotes) {
logger.warn(`>>> Deleting all notes <<<`)
// Delete the notes.
deleteAllNotes();
}
};
/**
* Create the current summary notes.
*
* @param {string} upgradeNotes
* @returns {Promise<void>}
*/
const createCurrentSummary = async (upgradeNotes) => {
const fileName = 'UPGRADING-CURRENT.md';
const notes = `# Moodle upgrade notes\n\n${upgradeNotes}`;
await writeFile(fileName, notes);
logger.info(`Running upgrade notes written to ${chalk.underline(chalk.bold(fileName))}`);
};
/**
* Get the indexes of the lines that contain the version headings.
*
* @param {array<string>} lines
* @returns {array<object>}
*/
const getVersionLineIndexes = (lines) => {
const h2Indexes = [];
lines.forEach((line, index) => {
const matches = line.match(/^##\s(?<version>.*)$/);
if (matches) {
h2Indexes.push({
index,
line,
version: matches.groups.version,
});
}
});
return h2Indexes;
};
/**
* Find the index of the Unreleased heading.
*
* @param {array<object>} versionHeadings
* @returns {number}
*/
const findUnreleasedHeadingIndex = (versionHeadings) => versionHeadings.findIndex((heading) => {
if (heading.version === 'Unreleased') {
// Used if version cannot be guessed.
return true;
}
if (heading.version.endsWith('+')) {
// Weekly release for a stable branch.
return true;
}
if (heading.version.match(/beta|rc\d/)) {
// Beta and RC rolls are treated as weeklies.
return true;
}
if (heading.version.endsWith('dev')) {
// Development version.
return true;
}
return false;
});
/**
* Get the before and after content, to facilitate replacing any existing Unreleased notes.
*
* @param {array<string>} lines
* @returns {Object} {beforeContent: string, afterContent: string}
*/
const getBeforeAndAfterContent = (lines) => {
const existingLines = lines.split('\n');
const versionHeadings = getVersionLineIndexes(existingLines);
if (versionHeadings.length > 0) {
const unreleasedHeadingIndex = findUnreleasedHeadingIndex(versionHeadings);
if (unreleasedHeadingIndex !== -1) {
const beforeContent = existingLines.slice(0, versionHeadings[unreleasedHeadingIndex].index).join('\n');
if (versionHeadings.length > unreleasedHeadingIndex + 1) {
const afterContent = existingLines.slice(versionHeadings[unreleasedHeadingIndex + 1].index).join('\n');
return {
beforeContent,
afterContent,
};
}
return {
beforeContent,
afterContent: '',
};
}
return {
beforeContent: existingLines.slice(0, versionHeadings[0].index).join('\n'),
afterContent: existingLines.slice(versionHeadings[0].index).join('\n'),
};
}
return {
beforeContent: existingLines.join('\n'),
afterContent: '',
}
};
/**
* Get the notes for the component.
*
* @param {string} types
* @param {Number} headingLevel
* @returns {string}
*/
const getNotesForComponent = (types, headingLevel) => {
let upgradeNotes = '';
Object.entries(types).forEach(([type, notes]) => {
upgradeNotes += '#'.repeat(headingLevel);
upgradeNotes += ` ${getNoteName(type)}\n\n`;
notes.forEach(({ message, issueNumber }) => {
// Split the message into lines, removing empty lines.
const messageLines = message
.split('\n')
// Remove empty lines between tables, and list entries, but not after lists.
.filter((line, index, lines) => {
if (line.trim().length === 0) {
// This line is empty.
// If it's the first line in the file, remove it.
if (index === 0) {
return false;
}
// This is the last line in the file, remove it.
if (index === lines.length - 1) {
return false;
}
// If the previous line relates to a table, remove this line.
if (lines[index - 1].match(/^\s*\|/)) {
return false;
}
// If the next line is also empty, do not remove this line.
if (lines[index + 1].trim().length === 0) {
return true;
}
// Do not remove the line if the previous line was a list item.
if (lines[index - 1].match(/^\s*[-*]\s/)) {
return true;
}
if (lines[index - 1].match(/^\s*\d+\.\s/)) {
return true;
}
// Preserve all other empty lines by default.
return true;
}
// Keep any line which has content.
return true;
});
const firstLine = messageLines.shift().trim();
upgradeNotes += `- ${firstLine}\n`;
messageLines
.forEach((line) => {
upgradeNotes += ` ${line}`.trimEnd() + `\n`;
});
upgradeNotes += `\n For more information see [${issueNumber}](https://tracker.moodle.org/browse/${issueNumber})\n`;
});
upgradeNotes += '\n';
});
return upgradeNotes;
};
/**
* Get the updated notes mixed with existing content.
*
* @param {string} existingContent
* @param {string} upgradeNotes
*/
const getUpdatedNotes = (existingContent, upgradeNotes) => {
const { beforeContent, afterContent } = getBeforeAndAfterContent(existingContent);
const newContent = `${beforeContent}\n${upgradeNotes}\n${afterContent}`
.split('\n')
.filter((line, index, lines) => {
if (line === '' && lines[index - 1] === '') {
// Remove multiple consecutive empty lines.
return false;
}
return true;
})
.join('\n');
return newContent;
};
/**
* Update the notes for each component.
*/
const updateComponentNotes = (
notes,
version,
notesFileName = 'UPGRADING.md',
removeEmpty = false,
) => {
return getAllComponents().map(async (component) => {
logger.verbose(`Updating notes for ${component.name} into ${component.path}`);
const fileName = joinPath(component.path, notesFileName);
const existingContent = await getCurrentNotes(fileName);
if (!existingContent) {
if (!notes[component.value]) {
// No existing notes, and no new notes to add.
return;
}
} else {
if (!notes[component.value]) {
// There is existing content, but nothing to add.
if (removeEmpty) {
logger.verbose(`Removing empty notes file ${fileName}`);
await unlink(fileName);
}
return;
}
}
const componentNotes = notes[component.value];
let upgradeNotes = `## ${version}\n\n`;
upgradeNotes += getNotesForComponent(componentNotes, 3);
if (existingContent) {
await writeFile(fileName, getUpdatedNotes(existingContent, upgradeNotes));
} else {
await writeFile(
fileName,
`# ${component.name} Upgrade notes\n\n${upgradeNotes}`,
);
}
});
}
/**
* Generate the upgrade notes for a new release.
*
* @param {string|undefined} version
* @param {Object} options
* @param {boolean} options.generateUpgradeNotes
* @param {boolean} options.deleteNotes
* @returns {Promise<void>}
*/
export default async (version, options = {}) => {
const notes = await getCombinedNotesByComponent();
if (Object.keys(notes).length === 0) {
logger.warn('No notes to generate');
return;
}
if (!version) {
version = await getCurrentVersion();
}
// Generate the upgrade notes for this release.
// We have
// - a title with the release name
// - the change types
// - which contain the components
// - which document each change
let upgradeNotes = `## ${version}\n\n`;
Object.entries(notes).forEach(([component, types]) => {
upgradeNotes += `### ${component}\n\n`;
upgradeNotes += getNotesForComponent(types, 4);
});
await Promise.all([
createCurrentSummary(upgradeNotes),
...updateComponentNotes(notes, version, 'UPGRADING-CURRENT.md', true),
]);
if (options.generateUpgradeNotes) {
await Promise.all(updateComponentNotes(notes, version));
await updateUpgradeNotes(upgradeNotes, options);
}
};
-244
View File
@@ -1,244 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import chalk from 'chalk';
import branchName from 'current-git-branch';
import { isStandardComponent, isCommunityComponent, rewritePlugintypeAsSubsystem } from './components.mjs';
import { isValidNoteName } from './noteTypes.mjs';
import logger from './logger.mjs';
import { readFile } from 'fs/promises';
/**
* Validate an issue number input
*
* @param {string} input
* @returns {string|boolean}
*/
export const validateIssueNumber = (input) => {
if (!input) {
return 'You must provide a tracker issue number';
}
if (input.match(/^[a-zA-Z]*-\d+$/)) {
return true;
}
if (input.match(/^\d+$/)) {
return true;
}
return 'The issue number was not recognised as a valid issue number';
};
/**
* Format an issue number input.
*
* @param {string} input
* @returns {string}
*/
export const formatIssueNumber = (input) => {
if (input.match(/^[a-zA-Z]*-\d+$/)) {
return input;
}
if (input.match(/^\d+$/)) {
return `MDL-${input}`;
}
return input;
};
/**
* Get the issue number, based off current git branch name
*
* @returns {string|null}
*/
export const getIssueNumberFromBranchName = () => {
const issueNumber = String(branchName()).match(/^[a-zA-Z]*-\d+/);
if (issueNumber) {
return formatIssueNumber(issueNumber[0]);
}
return null;
};
/**
* Validate a component.
*
* @param {string} input
* @returns {string|boolean}
*/
export const validateComponent = (input) => {
if (isStandardComponent(input)) {
return true;
}
if (isCommunityComponent(input)) {
return 'Currently only core plugins are supported.';
}
return 'The component was not recognised as a standard component';
};
export const formatComponent = (input) => {
if (rewritePlugintypeAsSubsystem(input)) {
return `core_${input}`;
}
return input;
}
/**
* Get the initial values from the options.
*
* @param {object} options
* @returns {object}
*/
export const getInitialValues = (options) => {
const initialValues = {};
const type = getInitialTypeValue(options);
if (type) {
initialValues.type = type;
}
const issueNumber = getInitialIssueValue(options);
if (issueNumber) {
initialValues.issueNumber = issueNumber;
}
const component = getInitialComponentValue(options);
if (component) {
initialValues.components = component;
}
const message = getInitialMessageValue(options);
if (message) {
initialValues.message = message
initialValues.addAnother = false;
}
return initialValues;
};
/**
* Get the initial type value.
*
* @param {Object} options
* @returns {string|undefined}
*/
const getInitialTypeValue = (options) => {
if (!options.type) {
return;
}
options.type = options.type.trim().toLowerCase();
if (isValidNoteName(options.type)) {
return options.type;
}
logger.warn(`Note type "${chalk.underline(chalk.red(options.type))}" is not valid.`);
};
/**
* Get the initial issue number value.
*
* @param {Object} options
* @returns {string|undefined}
*/
const getInitialIssueValue = (options) => {
if (!options.issue) {
return;
}
options.issue = options.issue.trim().toUpperCase();
const issueNumberValidated = validateIssueNumber(options.issue);
if (issueNumberValidated === true) {
const issueNumber = formatIssueNumber(options.issue);
if (issueNumber !== options.issue) {
logger.warn(
`Issue number "${chalk.underline(chalk.red(options.issue))}" was updated to ` +
`"${chalk.underline(chalk.green(issueNumber))}"`
);
}
return issueNumber;
} else {
logger.warn(`Issue number "${chalk.underline(chalk.red(options.issue))}" is not valid: ${issueNumberValidated}`);
}
};
/**
* Get the initial component value.
*
* @param {Object} options
* @returns {string|undefined}
*/
const getInitialComponentValue = (options) => {
if (!options.component) {
return;
}
options.component = options.component.trim().toLowerCase();
const componentValidated = validateComponent(options.component);
if (componentValidated === true) {
const component = formatComponent(options.component);
if (component !== options.component) {
logger.warn(
`Component "${chalk.underline(chalk.red(options.component))}" was updated to ` +
`"${chalk.underline(chalk.green(component))}"`
);
}
return component;
} else {
logger.warn(`Component "${chalk.underline(chalk.red(options.component))}" is not valid: ${componentValidated}`);
}
};
/**
* Get the initial message value.
*
* @param {Object} options
* @returns {string|undefined}
*/
const getInitialMessageValue = (options) => {
if (!options.message) {
return;
}
return options.message.trim();
};
/**
* Get the current version from the project /version.php file.
*
* @returns {Promise<string>}
*/
export const getCurrentVersion = async () => {
const versionRegex = new RegExp(/^ *\$release *= *['\"](?<release>[^ \+]+\+?) *\(Build:.*/m);
try {
const versionFile = await readFile('public/version.php', 'utf8');
const match = versionFile.match(versionRegex);
if (match) {
return match.groups.release;
}
} catch(error) {
logger.error('Unable to read the version file');
}
return "Unreleased";
}
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env node
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import winston from 'winston';
const logger = winston.createLogger({
level: 'info',
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
),
transports: [
new winston.transports.Console(),
],
});
export default logger;
-194
View File
@@ -1,194 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import yaml from 'js-yaml';
import path from 'path';
import { writeFile, mkdir, readdir, readFile, unlink } from 'fs/promises';
import { isValidNoteName, sortNoteTypes } from './noteTypes.mjs';
import { sortComponents } from './components.mjs';
const unreleasedPath = path.resolve('.upgradenotes');
/**
* Get the filename for the note.
*
* @param {string} issueNumnber The issue number
* @returns {string}
*/
const getFilename = (issueNumber) => {
const dateTimeFormat = new Intl.DateTimeFormat(undefined, {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
fractionalSecondDigits: 2,
timeZone: 'UTC',
});
const date = Object.fromEntries(
dateTimeFormat.formatToParts(new Date())
.filter((p) => p.type !== 'literal')
.map((p) => ([p.type, p.value]))
);
const dateString = [
date.year,
date.month,
date.day,
date.hour,
date.minute,
date.second,
date.fractionalSecond,
].join('');
return `${issueNumber}-${dateString}.yml`;
};
/**
* Create a new note.
*
* @param {string} issueNumber
* @param {[type: string]: {message: string}} messages
* @returns {string} The path to the note on disk
*/
export const createNote = async (
issueNumber,
messages,
notePath,
) => {
const note = {
issueNumber,
notes: {},
};
messages.forEach(({components, type, message}) => {
note.notes[components] = note.notes[components] || [];
note.notes[components].push({message, type});
});
if (!notePath) {
notePath = path.resolve(unreleasedPath, getFilename(issueNumber));
}
const noteContent = yaml.dump(note);
await mkdir(unreleasedPath, {recursive: true});
await writeFile(notePath, noteContent);
return notePath;
};
/**
* Get all unreleased notes.
*
* @returns {Promise<{issueNumber: string, components: string[], types: {[type: string]: {message: string}[]}}[]>
*/
export const getAllNotes = async () => {
const files = await readdir(unreleasedPath);
const notes = files
.filter((file) => file.endsWith('.yml'))
.map(async (file) => {
const filePath = path.resolve(unreleasedPath, file);
const fileContent = await readFile(filePath, 'utf8');
return {
...yaml.load(fileContent),
filePath,
};
});
return Promise.all(notes);
};
/**
* Get the list of notes, grouped by note type, then component.
*
* @returns {Promise<{[type: string]: {[components: string]: {message: string, issueNumber: string}[]}}>}
*/
export const getCombinedNotes = async () => {
const notes = await getAllNotes();
const combinedNotes = {};
notes.forEach((note) => {
Object.entries(note.notes).forEach(([components, data]) => {
data.forEach((entry) => {
if (!isValidNoteName(entry.type)) {
throw new Error(`Invalid note type: "${entry.type}" in file ${note.filePath}`);
}
combinedNotes[entry.type] = combinedNotes[entry.type] || {};
combinedNotes[entry.type][components] = combinedNotes[entry.type][components] || [];
combinedNotes[entry.type][components].push({message: entry.message, issueNumber: note.issueNumber});
});
});
});
return combinedNotes;
};
/**
* Get the list of notes, grouped by component, then by note type.
*
* @returns {Promise<{[component: string]: {[type: string]: {message: string, issueNumber: string}[]}}>}
*/
export const getCombinedNotesByComponent = async () => {
const notes = await getAllNotes();
const combinedNotes = {};
notes.forEach((note) => {
Object.entries(note.notes).forEach(([component, data]) => {
combinedNotes[component] = combinedNotes[component] || {};
data.forEach((entry) => {
if (!isValidNoteName(entry.type)) {
throw new Error(`Invalid note type: "${entry.type}" in file ${note.filePath}`);
}
combinedNotes[component][entry.type] = combinedNotes[component][entry.type] || [];
combinedNotes[component][entry.type].push({
component,
message: entry.message,
issueNumber: note.issueNumber,
type: entry.type,
});
});
});
});
// Sort notes by note type.
Object.entries(combinedNotes).forEach(([component, types]) => {
combinedNotes[component] = Object.fromEntries(
Object.entries(types).sort(([a], [b]) => sortNoteTypes(a, b))
);
});
// Sort components.
return Object.fromEntries(
Object.entries(combinedNotes).sort(([a], [b]) => sortComponents(a, b))
);
};
/**
* Delete all unreleased notes.
*
* @returns {Promise<void>}
*/
export const deleteAllNotes = async () => {
const files = await readdir(unreleasedPath);
return Promise.all(
files
.filter((item, index) => files.indexOf(item) === index)
.filter((file) => file.endsWith('.yml'))
.map((file) => unlink(`${unreleasedPath}/${file}`))
);
};
-80
View File
@@ -1,80 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The note types.
*
* Matches the suggested order in https://keepachangelog.com/en/1.1.0/.
* @type {Object<string, string>}
*/
const noteTypes = {
'improved': 'Added',
'changed': 'Changed',
'deprecated': 'Deprecated',
'removed': 'Removed',
'fixed': 'Fixed',
};
/**
* The preferred order of note types.
*
* @type {string[]}
*/
const preferredOrder = Object.keys(noteTypes);
/**
* Comparison method to sort note types.
*
* @param {String} a
* @param {String} b
* @returns {Number}
*/
export const sortNoteTypes = (a, b) => {
const aIndex = preferredOrder.indexOf(a);
const bIndex = preferredOrder.indexOf(b);
if (aIndex === -1) {
return 1;
}
if (bIndex === -1) {
return -1;
}
return aIndex - bIndex;
};
/**
* Get the note names.
*
* @returns {string[]}
*/
export const getNoteNames = () => Object.keys(noteTypes);
/**
* Get the human-readable note name.
*
* @param {string} type
* @returns {string}
*/
export const getNoteName = (type) => noteTypes[type];
/**
* Whether the note name is valid.
*
* @param {string} type
* @returns {boolean}
*/
export const isValidNoteName = (type) => noteTypes[type] !== undefined;
-153
View File
@@ -1,153 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import inquirer from 'inquirer';
import SearchList from 'inquirer-search-list';
import { getNoteNames } from './noteTypes.mjs';
import { getAllComponents } from './components.mjs';
import {
formatComponent,
formatIssueNumber,
validateComponent,
validateIssueNumber,
} from './helpers.mjs';
/**
* A Search List which accepts an initial value.
*/
class SearchListWithInitialValue extends SearchList {
constructor(options, ...args) {
super(options, ...args);
if (options.default) {
const pointer = this.filterList.findIndex((item) => {
return item.value === options.default;
});
if (pointer > -1) {
this.pointer = pointer;
}
}
}
}
inquirer.registerPrompt('search-list', SearchListWithInitialValue);
/**
* Get the issue type prompt.
*
* @param {string} defaultData The initially selected value
* @returns {Object}
*/
export const getTypePrompt = (defaultData) => ({
default: defaultData,
type: 'search-list',
message: 'Type of change',
name: 'type',
choices: getNoteNames(),
validate: (selection) => {
if (selection.length < 1) {
return 'You must select at least one type of change';
}
return true;
},
});
/**
* Get the component prompt.
*
* @param {string} [defaultValue='core'] The initally selected value.
* @returns
*/
export const getComponentsPrompt = (defaultValue) => {
if (!defaultValue ) {
defaultValue = 'core';
}
return {
choices: getAllComponents(),
default: defaultValue,
type: 'search-list',
message: 'Component',
name: 'components',
validate: validateComponent,
filter: formatComponent,
};
};
/**
* Get the issue number prompt as an inline input.
*
* @param {string} defaultData
* @returns {object}
*/
export const getIssuePrompt = (defaultData) => ({
default: defaultData,
type: 'input',
message: 'Tracker issue number',
name: 'issueNumber',
validate: validateIssueNumber,
filter: formatIssueNumber,
});
/**
* Get a message prompt.
*
* @param {string} defaultData
* @returns
*/
export const getMessagePromptEditor = (defaultData) => ({
default: defaultData,
type: process.stdin.isTTY ? 'editor' : 'input',
postfix: '.md',
message: 'Message',
name: 'message',
waitUserInput: false,
validate: (input) => {
if (!input) {
return 'You must provide a message';
}
return true;
},
// Remove any trailing whitespace.
filter: (input) => input.split('\n').map((line) => line.trimEnd()).join('\n'),
});
/**
* Get a message prompt.
*
* @param {string} defaultData
* @returns
*/
export const getMessagePromptInput = (defaultData) => ({
default: defaultData,
type: 'input',
message: 'Message (leave empty to use editor)',
name: 'message',
filter: (input) => input.trim(),
});
/**
* Get a prompt to ask the user if they wish to add another entry.
*
* @returns {Object}
*/
export const getAddAnotherPrompt = () => ({
type: 'confirm',
message: 'Do you want to add another note?',
default: false,
name: 'addAnother',
});
-58
View File
@@ -1,58 +0,0 @@
#!/usr/bin/env node
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import { getAllComponents } from './components.mjs';
import { getCombinedNotesByComponent } from './note.mjs';
import logger from './logger.mjs';
import { existsSync } from 'fs';
/**
* Generate links to component-specific upgrade notes for each component.
*
* @param {string|undefined} tag The git tag to link to
* @returns {Promise<void>}
*/
export default async (tag) => {
const notes = await getCombinedNotesByComponent();
if (Object.keys(notes).length === 0) {
logger.warn('No notes to generate');
return;
}
if (!tag) {
logger.error('No tag provided');
return;
}
// Generate the links for the components which have upgrade notes in this release.
let upgradeNotes = `### Component API updates\n<!--cspell: disable -->\n\n`;
const componentList = Object.fromEntries(
Object.values(getAllComponents()).map(({path, value}) => [value, path]),
);
Object.entries(notes)
.map(([component]) => ({
component,
componentPath: componentList[component],
}))
.filter(({ componentPath }) => existsSync(`./${componentPath}/UPGRADING.md`))
.forEach(({component, componentPath}) => {
upgradeNotes += `- [${component}](https://github.com/moodle/moodle/blob/${tag}/${componentPath}/UPGRADING.md)\n`;
});
console.log(upgradeNotes);
};
-142
View File
@@ -1,142 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* Component Library build tasks.
*
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get a child path of the component library.
*
* @param {string} path
* @returns {string}
*/
const getCLPath = path => `public/admin/tool/componentlibrary/${path}`;
/**
* Get a spawn handler.
*
* This is a generic function to write the spawn output, and then to exit if required and mark the async task as
* complete.
*
* @param {Promise} done
* @returns {function}
*/
const getSpawnHandler = done => (error, result, code) => {
grunt.log.write(result);
if (error) {
grunt.log.error(result.stdout);
process.exit(code);
}
done();
};
/**
* Spawn a function against Node with the provided args.
*
* @param {array} args
* @returns {object}
*/
const spawnNodeCall = (args) => grunt.util.spawn({
cmd: 'node',
args,
}, getSpawnHandler(grunt.task.current.async()));
/**
* Build the docs using Hugo.
*
* @returns {Object} Reference to the spawned task
*/
const docsBuild = () => spawnNodeCall([
'node_modules/hugo-bin/cli.js',
'--config', getCLPath('config.yml'),
'--cleanDestinationDir',
]);
/**
* Build the docs index using the hugo-lunr-indexer.
*
* @returns {Object} Reference to the spawned task
*/
const indexBuild = () => spawnNodeCall([
'node_modules/hugo-lunr-indexer/bin/hli.js',
'-i', getCLPath('content/**'),
'-o', getCLPath('hugo/site/data/my-index.json'),
'-l', 'yaml',
'-d', '---',
]);
/**
* Build the hugo CSS.
*
* @returns {Object} Reference to the spawned task
*/
const cssBuild = () => spawnNodeCall([
'node_modules/sass/sass.js',
'--style', 'expanded',
'--source-map',
'--embed-sources',
'--precision', 6,
'--load-path', `${process.cwd()}/public`,
getCLPath('hugo/scss/docs.scss'),
getCLPath('hugo/dist/css/docs.css'),
]);
// Register the various component library tasks.
grunt.registerTask('componentlibrary:docsBuild', 'Build the component library', docsBuild);
grunt.registerTask('componentlibrary:cssBuild', 'Build the component library', cssBuild);
grunt.registerTask('componentlibrary:indexBuild', 'Build the component library', indexBuild);
grunt.registerTask('componentlibrary', 'Build the component library', [
'componentlibrary:docsBuild',
'componentlibrary:cssBuild',
'componentlibrary:indexBuild',
]);
grunt.config.merge({
watch: {
componentLibraryDocs: {
files: [
getCLPath('content/**/*.md'),
getCLPath('hugo'),
],
tasks: ['componentlibrary:docsBuild', 'componentlibrary:indexBuild'],
},
componentLibraryCSS: {
files: [
getCLPath('hugo/scss/**/*.scss'),
'hugo',
],
tasks: ['componentlibrary:cssBuild'],
},
},
});
// Add the 'componentlibrary' task as a startup task.
grunt.moodleEnv.startupTasks.push('componentlibrary');
return {
docsBuild,
cssBuild,
indexBuild,
};
};
-72
View File
@@ -1,72 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
const files = grunt.moodleEnv.files;
// Project configuration.
grunt.config.merge({
eslint: {
// Even though warnings dont stop the build we don't display warnings by default because
// at this moment we've got too many core warnings.
// To display warnings call: grunt eslint --show-lint-warnings
// To fail on warnings call: grunt eslint --max-lint-warnings=0
// Also --max-lint-warnings=-1 can be used to display warnings but not fail.
options: {
quiet: (!grunt.option('show-lint-warnings')) && (typeof grunt.option('max-lint-warnings') === 'undefined'),
maxWarnings: ((typeof grunt.option('max-lint-warnings') !== 'undefined') ? grunt.option('max-lint-warnings') : -1)
},
// Check AMD src files.
amd: {src: files ? files : grunt.moodleEnv.amdSrc},
// Check YUI module source files.
yui: {src: files ? files : grunt.moodleEnv.yuiSrc},
// Check React source files.
'react': {
options: {
fix: true,
},
src: files ? files : grunt.moodleEnv.reactSrc,
},
},
});
grunt.loadNpmTasks('grunt-eslint');
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
};
-92
View File
@@ -1,92 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get the list of feature files to pass to the gherkin linter.
*
* @returns {Array}
*/
const getGherkinLintTargets = () => {
if (grunt.moodleEnv.files) {
// Specific files were requested. Only check these.
return grunt.moodleEnv.files;
}
if (grunt.moodleEnv.inComponent) {
return [`${grunt.moodleEnv.runDir}/tests/behat/*.feature`];
}
return ['**/tests/behat/*.feature'];
};
const handler = function() {
const done = this.async();
const options = grunt.config('gherkinlint.options');
// Grab the gherkin-lint linter and required scaffolding.
const linter = require('gherkin-lint/dist/linter.js');
const featureFinder = require('gherkin-lint/dist/feature-finder.js');
const configParser = require('gherkin-lint/dist/config-parser.js');
const formatter = require('gherkin-lint/dist/formatters/stylish.js');
// Run the linter.
return linter.lint(
featureFinder.getFeatureFiles(grunt.file.expand(options.files)),
configParser.getConfiguration(configParser.defaultConfigFileName)
)
.then(results => {
// Print the results out uncondtionally.
formatter.printResults(results);
return results;
})
.then(results => {
// Report on the results.
// The done function takes a bool whereby a falsey statement causes the task to fail.
return results.every(result => result.errors.length === 0);
})
.then(done); // eslint-disable-line promise/no-callback-in-promise
};
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', handler);
grunt.config.set('gherkinlint', {
options: {
files: getGherkinLintTargets(),
}
});
grunt.config.merge({
watch: {
gherkinlint: {
files: [grunt.moodleEnv.inComponent ? 'tests/behat/*.feature' : '**/tests/behat/*.feature'],
tasks: ['gherkinlint'],
},
},
});
// Add the 'gherkinlint' task as a startup task.
grunt.moodleEnv.startupTasks.push('gherkinlint');
return handler;
};
-139
View File
@@ -1,139 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate the PHPCS configuration.
*
* @param {Object} thirdPartyPaths
*/
const phpcsIgnore = (thirdPartyPaths) => {
const {toXML} = require('jstoxml');
const config = {
_name: 'ruleset',
_attrs: {
name: "MoodleCore",
},
_content: [
{
rule: {
_attrs: {
ref: './phpcs.xml.dist',
},
},
},
],
};
thirdPartyPaths.forEach(library => {
config._content.push({
'exclude-pattern': library,
});
});
grunt.file.write('phpcs.xml', toXML(config, {
header: true,
indent: ' ',
}) + "\n");
};
/**
* Extracts ignore entries from a local ignore file.
*
* @param {string} componentPath the file path to the component, relative to the code base directory
* @param {string} ignoreFilePath the path to the ignore file
* @return {array} array of ignore paths to be included in the global ignore files
*/
const getEntriesFromLocalIgnoreFile = (componentPath, ignoreFilePath) => {
const ignorePaths = [];
if (grunt.file.exists(ignoreFilePath)) {
const ignoreFile = grunt.file.read(ignoreFilePath);
const entries = ignoreFile.split('\n');
entries.forEach(entry => {
entry = entry.trim();
if (entry.length > 0 && !entry.startsWith('#') && !entry.startsWith('!')) {
while (entry.startsWith('/')) {
entry = entry.substring(1);
}
ignorePaths.push(componentPath + '/' + entry);
}
});
}
return ignorePaths;
};
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of paths to third party directories.
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
const localStylelintIgnorePaths = [];
const localEslintIgnorePaths = [];
ComponentList.getComponentPaths(process.cwd() + '/').forEach(componentPath => {
const localEslintIgnorePath = process.cwd() + '/' + componentPath + '/.eslintignore';
const localEslintIgnoreEntries = getEntriesFromLocalIgnoreFile(componentPath, localEslintIgnorePath);
if (localEslintIgnoreEntries.length > 0) {
localEslintIgnorePaths.push(...localEslintIgnoreEntries);
}
const localStylelintIgnorePath = process.cwd() + '/' + componentPath + '/.stylelintignore';
const localStylelintIgnoreEntries = getEntriesFromLocalIgnoreFile(componentPath, localStylelintIgnorePath);
if (localStylelintIgnoreEntries.length > 0) {
localStylelintIgnorePaths.push(...localStylelintIgnoreEntries);
}
});
// Generate .eslintignore.
const eslintIgnores = [
'# Generated by "grunt ignorefiles"',
// Do not ignore the .grunt directory.
'!/.grunt',
// Ignore all yui/src meta directories and build directories.
'*/**/yui/src/*/meta/',
'*/**/build/',
].concat(thirdPartyPaths).concat(localEslintIgnorePaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n') + '\n');
// Generate .stylelintignore.
const stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'**/yui/build/*',
'public/theme/boost/style/moodle.css',
'public/theme/classic/style/moodle.css',
'jsdoc/styles/*.css',
'public/admin/tool/componentlibrary/hugo/dist/css/docs.css',
].concat(thirdPartyPaths).concat(localStylelintIgnorePaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n') + '\n');
phpcsIgnore(thirdPartyPaths);
};
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', handler);
return handler;
};
-218
View File
@@ -1,218 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Function to generate the destination for the minification task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
*
* @param {String} destPath the current destination
* @param {String} srcPath the matched src path
* @return {String} The rewritten destination path.
*/
const babelRename = function(destPath, srcPath) {
destPath = srcPath.replace(`amd/src`, `amd/build`);
destPath = destPath.replace(/\.js$/, '.min.js');
return destPath;
};
module.exports = grunt => {
// Load the React build tasks.
require('./react')(grunt);
// Load the Ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Shifter tasks.
require('./shifter')(grunt);
// Load ESLint.
require('./eslint')(grunt);
// Load jsconfig.
require('./jsconfig')(grunt);
// Load JSDoc.
require('./jsdoc')(grunt);
const path = require('path');
// Register JS tasks.
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'rollup']);
grunt.registerTask('js', ['amd', 'yui', 'react']);
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
const babelTransform = require('@babel/core').transform;
const babel = (options = {}) => {
return {
name: 'babel',
transform: (code, id) => {
grunt.log.debug(`Transforming ${id}`);
options.filename = id;
const transformed = babelTransform(code, options);
return {
code: transformed.code,
map: transformed.map
};
}
};
};
// Note: We have to use a rate limit plugin here because rollup runs all tasks asynchronously and in parallel.
// When we kick off a full run, if we kick off a rollup of every file this will fork-bomb the machine.
// To work around this we use a concurrent Promise queue based on the number of available processors.
const rateLimit = () => {
const queue = [];
let queueRunner;
const startQueue = () => {
if (queueRunner) {
return;
}
queueRunner = setTimeout(() => {
const limit = Math.max(1, require('os').cpus().length / 2);
grunt.log.debug(`Starting rollup with queue size of ${limit}`);
runQueue(limit);
}, 100);
};
// The queue runner will run the next `size` items in the queue.
const runQueue = (size = 1) => {
queue.splice(0, size).forEach(resolve => {
grunt.log.debug(`Item resolved. Kicking off next one.`);
resolve();
});
};
return {
name: 'ratelimit',
// The options hook is run in parallel.
// We can return an unresolved Promise which is queued for later resolution.
options: async(options) => {
return new Promise(resolve => {
queue.push(resolve);
startQueue();
return options;
});
},
// When an item in the queue completes, start the next item in the queue.
generateBundle: (options, bundle) => {
grunt.log.debug(`Finished output phase for ${Object.keys(bundle).join(', ')}`);
runQueue();
},
};
};
const terser = require('rollup-plugin-terser').terser;
grunt.config.merge({
rollup: {
options: {
format: 'esm',
dir: 'output',
sourcemap: true,
treeshake: false,
context: 'window',
plugins: [
rateLimit(),
babel({
sourceMaps: true,
comments: false,
compact: false,
plugins: [
'transform-es2015-modules-amd-lazy',
'system-import-transformer',
// This plugin modifies the Babel transpiling for "export default"
// so that if it's used then only the exported value is returned
// by the generated AMD module.
//
// It also adds the Moodle plugin name to the AMD module definition
// so that it can be imported as expected in other modules.
path.resolve('.grunt/babel-plugin-add-module-to-define.js')
],
presets: [
['@babel/preset-env', {
modules: false,
useBuiltIns: false
}]
]
}),
terser({
// Do not mangle variables.
// Makes debugging easier.
mangle: false,
}),
],
},
dist: {
files: [{
expand: true,
src: grunt.moodleEnv.files ? grunt.moodleEnv.files : grunt.moodleEnv.amdSrc,
rename: babelRename
}],
},
},
});
grunt.config.merge({
watch: {
amd: {
files: grunt.moodleEnv.inComponent
? ['amd/src/*.js', 'amd/src/**/*.js']
: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
},
});
// Add the 'js' task as a startup task.
grunt.moodleEnv.startupTasks.push('js');
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('rollup.dist.files', [{expand: true, src: files, rename: babelRename}]);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
});
return {
babelRename,
};
};
-83
View File
@@ -1,83 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
// @ts-nocheck
/**
* @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
const configuration = {
compilerOptions: {
baseUrl: ".",
paths: {
},
target: "es2015",
allowSyntheticDefaultImports: false,
},
exclude: [
"node_modules",
],
include: [],
};
/**
* Generate jsconfig.json with AMD module path aliases for all components.
*
* @param {object} grunt The Grunt instance.
*/
const generateJsconfig = (grunt) => {
const jsconfigData = Object.assign({}, configuration);
const path = require('path');
const {fetchComponentData} = require(path.join(process.cwd(), '.grunt', 'components.js'));
const componentData = fetchComponentData().components;
for (const [thisPath, component] of Object.entries(componentData)) {
jsconfigData.compilerOptions.paths[`${component}/*`] = [`${thisPath}/amd/src/*`];
jsconfigData.include.push(`${thisPath}/amd/src/**/*`);
}
grunt.file.write('jsconfig.json', JSON.stringify(jsconfigData, null, " ") + "\n");
grunt.log.write('✓ Generating jsconfig.json\n');
};
/**
* Generate tsconfig.aliases.json with TypeScript path aliases for all ESM components.
*
* @returns {Promise<void>}
*/
const generateTsAliases = async() => {
const {generateAliases} = await import('../../.esbuild/generate-aliases.mjs');
generateAliases();
};
module.exports = (grunt) => {
const handler = async function() {
const done = this.async();
try {
generateJsconfig(grunt);
await generateTsAliases();
done();
} catch (err) {
grunt.log.error(err.message);
done(false);
}
};
grunt.registerTask('jsconfig', 'Generate a jsconfig configuration compatible with the LSP', handler);
};
-52
View File
@@ -1,52 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = (grunt) => {
const path = require('path');
grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
const done = this.async();
const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');
grunt.util.spawn({
cmd: 'jsdoc',
args: [
'--configure',
configuration,
]
}, function(error, result, code) {
if (result.stdout) {
grunt.log.write(result.stdout);
}
if (result.stderr) {
grunt.log.error(result.stderr);
}
if (error) {
grunt.fail.fatal(`JSDoc failed with error code ${code}`);
} else {
grunt.log.write('JSDoc completed successfully'.green);
}
done();
});
});
};
-111
View File
@@ -1,111 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
// @ts-nocheck
/**
* Grunt tasks for building React components.
*
* @copyright Meirza <meirza.arson@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Register react task — build or watch React components.
*
* Modes:
* grunt react — production build
* grunt react:dev — development build (sourcemaps, no minification)
* grunt react:watch — esbuild native watch (dev mode, incremental context)
*
* Note: react:watch uses esbuild's own context.watch() and is intentionally
* separate from grunt-contrib-watch. This keeps esbuild's incremental build
* graph alive between rebuilds rather than restarting from scratch on each change.
*/
grunt.registerTask('react', 'Build all React components', function(mode) {
const done = this.async();
const isWatch = mode === 'watch';
const isDev = isWatch || mode === 'dev';
if (isWatch) {
const path = require('path');
const {spawn} = require('child_process');
// Run ESLint on the rebuilt source files in check-only mode (no --fix)
// to avoid writing changes that would re-trigger esbuild.
const eslintBin = path.join(grunt.moodleEnv.gruntFilePath, 'node_modules', '.bin', 'eslint');
const onRebuild = (srcFiles) => {
if (srcFiles.length === 0) {
return;
}
const absSrcFiles = srcFiles.map(f => path.join(grunt.moodleEnv.gruntFilePath, f));
spawn(eslintBin, absSrcFiles, {stdio: 'inherit'})
.on('error', err => grunt.log.error(`ESLint: ${err.message}`));
};
(async() => {
try {
const {watchComponents} = await import('../../.esbuild/plugin/plugincomponents.mjs');
const { generateAliases } = await import('../../.esbuild/generate-aliases.mjs');
const { buildPluginComponents } = await import('../../.esbuild/plugin/plugincomponents.mjs');
generateAliases();
await buildPluginComponents(isDev);
const ctx = await watchComponents(true, onRebuild);
if (!ctx) {
grunt.log.warn('No React source files found. Nothing to watch.');
done();
return;
}
grunt.log.ok('esbuild is watching for React changes. Press Ctrl+C to stop.');
// Keep the process alive until the user interrupts. done() is intentionally
// not called here — grunt's async mechanism holds the process open.
process.on('SIGINT', async() => {
await ctx.dispose();
done();
});
} catch (err) {
grunt.log.error(err.message);
done(false);
}
})();
return;
}
grunt.log.writeln(`Building React components in ${isDev ? 'DEVELOPMENT' : 'PRODUCTION'} mode...`);
(async() => {
try {
const {generateAliases} = await import('../../.esbuild/generate-aliases.mjs');
const {buildPluginComponents} = await import('../../.esbuild/plugin/plugincomponents.mjs');
generateAliases();
await buildPluginComponents(isDev);
done();
} catch (err) {
grunt.log.error(err.message);
done(false);
}
})();
});
};
-43
View File
@@ -1,43 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
grunt.loadNpmTasks('grunt-sass');
grunt.config.merge({
sass: {
dist: {
files: {
"public/theme/boost/style/moodle.css": "public/theme/boost/scss/preset/default.scss",
"public/theme/classic/style/moodle.css": "public/theme/classic/scss/classicgrunt.scss"
}
},
options: {
implementation: require('sass'),
includePaths: [
"public/theme/boost/scss/",
"public/theme/classic/scss/",
]
}
},
});
};
-155
View File
@@ -1,155 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/* eslint-env node */
module.exports = grunt => {
/**
* Shifter task. Is configured with a path to a specific file or a directory,
* in the case of a specific file it will work out the right module to be built.
*
* Note that this task runs the invidiaul shifter jobs async (becase it spawns
* so be careful to to call done().
*/
const handler = function() {
const done = this.async();
const options = grunt.config('shifter.options');
const async = require('async');
const path = require('path');
// Run the shifter processes one at a time to avoid confusing output.
async.eachSeries(options.paths, function(src, filedone) {
var args = [];
args.push(path.normalize(process.cwd() + '/node_modules/shifter/bin/shifter'));
// Always ignore the node_modules directory.
args.push('--excludes', 'node_modules');
// Determine the most appropriate options to run with based upon the current location.
if (grunt.file.isMatch('**/yui/**/*.js', src)) {
// When passed a JS file, build our containing module (this happen with
// watch).
grunt.log.debug('Shifter passed a specific JS file');
src = path.dirname(path.dirname(src));
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src', src)) {
// When in a src directory --walk all modules.
grunt.log.debug('In a src directory');
args.push('--walk');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*', src)) {
// When in module, only build our module.
grunt.log.debug('In a module directory');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
// When in module src, only build our module.
grunt.log.debug('In a source directory');
src = path.dirname(src);
options.recursive = false;
}
if (grunt.option('watch')) {
grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
}
// Add the stderr option if appropriate
if (grunt.option('verbose')) {
args.push('--lint-stderr');
}
if (grunt.option('no-color')) {
args.push('--color=false');
}
var execShifter = function() {
grunt.log.ok("Running shifter on " + src);
grunt.util.spawn({
cmd: "node",
args: args,
opts: {cwd: src, stdio: 'inherit', env: process.env}
}, function(error, result, code) {
if (code) {
grunt.fail.fatal('Shifter failed with code: ' + code);
} else {
grunt.log.ok('Shifter build complete.');
filedone();
}
});
};
// Actually run shifter.
if (!options.recursive) {
execShifter();
} else {
// Check that there are yui modules otherwise shifter ends with exit code 1.
if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
args.push('--recursive');
execShifter();
} else {
grunt.log.ok('No YUI modules to build.');
filedone();
}
}
}, done);
};
// Register the shifter task.
grunt.registerTask('shifter', 'Run Shifter against the current directory', handler);
// Configure it.
grunt.config.set('shifter', {
options: {
recursive: true,
// Shifter takes a relative path.
paths: grunt.moodleEnv.files ? grunt.moodleEnv.files : [grunt.moodleEnv.runDir]
}
});
grunt.config.merge({
watch: {
yui: {
files: grunt.moodleEnv.inComponent
? ['yui/src/*.json', 'yui/src/**/*.js']
: ['**/yui/src/**/*.js'],
tasks: ['yui']
},
},
});
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('shifter.options.paths', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
return handler;
};
-49
View File
@@ -1,49 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
// Are we in a YUI directory?
if (path.basename(path.resolve(grunt.moodleEnv.cwd, '../../')) == 'yui') {
grunt.task.run('yui');
// Are we in an AMD directory?
} else if (grunt.moodleEnv.inAMD) {
grunt.task.run('amd');
// Are we in an ESM source directory?
} else if (grunt.moodleEnv.inEsm) {
grunt.task.run('react');
} else {
// Run all of the requested startup tasks.
grunt.moodleEnv.startupTasks.forEach(taskName => grunt.task.run(taskName));
}
};
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', handler);
return handler;
};
-35
View File
@@ -1,35 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
// Load the ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Style Lint tasks.
require('./stylelint')(grunt);
// Load the SASS tasks.
require('./sass')(grunt);
// Add the 'css' task as a startup task.
grunt.moodleEnv.startupTasks.push('css');
};
-187
View File
@@ -1,187 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
const getCssConfigForFiles = files => {
return {
stylelint: {
css: {
// Use a fully-qualified path.
src: files,
options: {
quietDeprecationWarnings: true,
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
}
},
},
};
};
const getScssConfigForFiles = files => {
return {
stylelint: {
scss: {
options: {
quietDeprecationWarnings: true,
customSyntax: 'postcss-scss',
},
src: files,
},
},
};
};
/**
* Register any stylelint tasks.
*
* @param {Object} grunt
* @param {Array} files
* @param {String} fullRunDir
*/
const registerStyleLintTasks = () => {
const glob = require('glob');
// The stylelinters do not handle the case where a configuration was provided but no files were included.
// Keep track of whether any files were found.
let hasCss = false;
let hasScss = false;
// The stylelint processors do not take a path argument. They always check all provided values.
// As a result we must check through each glob and determine if any files match the current directory.
const scssFiles = [];
const cssFiles = [];
const requestedFiles = grunt.moodleEnv.files;
if (requestedFiles) {
// Grunt was called with a files argument.
// Check whether each of the requested files matches either the CSS or SCSS source file list.
requestedFiles.forEach(changedFilePath => {
let matchesGlob;
// Check whether this watched path matches any watched SCSS file.
matchesGlob = grunt.moodleEnv.scssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
scssFiles.push(changedFilePath);
hasScss = true;
}
// Check whether this watched path matches any watched CSS file.
matchesGlob = grunt.moodleEnv.cssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
cssFiles.push(changedFilePath);
hasCss = true;
}
});
} else {
// Grunt was called without a list of files.
// The start directory (runDir) may be a child dir of the project.
// Check each scssSrc file to see if it's in the start directory.
// This means that we can lint just mod/*/styles.css if started in the mod directory.
grunt.moodleEnv.scssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
scssFiles.push(path);
hasScss = true;
}
});
grunt.moodleEnv.cssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
cssFiles.push(path);
hasCss = true;
}
});
}
// Register the tasks.
const scssTasks = ['sass'];
if (hasScss) {
grunt.config.merge(getScssConfigForFiles(scssFiles));
scssTasks.unshift('stylelint:scss');
}
scssTasks.unshift('ignorefiles');
const cssTasks = ['ignorefiles'];
if (hasCss) {
grunt.config.merge(getCssConfigForFiles(cssFiles));
cssTasks.push('stylelint:css');
}
// The tasks must be registered, even if empty to ensure a consistent command list.
// They jsut won't run anything.
grunt.registerTask('scss', scssTasks);
grunt.registerTask('rawcss', cssTasks);
};
// Register CSS tasks.
grunt.loadNpmTasks('grunt-stylelint');
// Register the style lint tasks.
registerStyleLintTasks();
grunt.registerTask('css', ['scss', 'rawcss']);
const getCoreThemeMatches = () => {
const scssMatch = 'scss/**/*.scss';
if (grunt.moodleEnv.inTheme) {
return [scssMatch];
}
if (grunt.moodleEnv.runDir.startsWith('theme')) {
return [`*/${scssMatch}`];
}
return [`theme/*/${scssMatch}`];
};
// Add the watch configuration for rawcss, and scss.
grunt.config.merge({
watch: {
rawcss: {
files: [
'**/*.css',
],
excludes: [
'**/moodle.css',
'**/editor.css',
'jsdoc/styles/*.css',
],
tasks: ['rawcss']
},
scss: {
files: getCoreThemeMatches(),
tasks: ['scss']
},
},
});
};
-42
View File
@@ -1,42 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2023 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate upgradable third-party libraries (utilising thirdpartylibs.xml data)
*/
grunt.registerTask('upgradablelibs', 'Generate upgradable third-party libraries', async function() {
const done = this.async();
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of third party libraries that have a newer version in their repositories.
const thirdPartyLibs = await ComponentList.getThirdPartyLibsUpgradable({progress: true});
for (let library of thirdPartyLibs) {
grunt.log.ok(JSON.stringify(Object.assign({}, library), null, 4));
}
done();
});
};
-276
View File
@@ -1,276 +0,0 @@
/**
* This is a wrapper task to handle the grunt watch command. It attempts to use
* Watchman to monitor for file changes, if it's installed, because it's much faster.
*
* If Watchman isn't installed then it falls back to the grunt-contrib-watch file
* watcher for backwards compatibility.
*/
/* eslint-env node */
module.exports = grunt => {
/**
* This is a wrapper task to handle the grunt watch command. It attempts to use
* Watchman to monitor for file changes, if it's installed, because it's much faster.
*
* If Watchman isn't installed then it falls back to the grunt-contrib-watch file
* watcher for backwards compatibility.
*/
const watchHandler = function() {
const async = require('async');
const watchTaskDone = this.async();
let watchInitialised = false;
let watchTaskQueue = {};
let processingQueue = false;
const watchman = require('fb-watchman');
const watchmanClient = new watchman.Client();
// Grab the tasks and files that have been queued up and execute them.
var processWatchTaskQueue = function() {
if (!Object.keys(watchTaskQueue).length || processingQueue) {
// If there is nothing in the queue or we're already processing then wait.
return;
}
processingQueue = true;
// Grab all tasks currently in the queue.
var queueToProcess = watchTaskQueue;
// Reset the queue.
watchTaskQueue = {};
async.forEachSeries(
Object.keys(queueToProcess),
function(task, next) {
var files = queueToProcess[task];
var filesOption = '--files=' + files.join(',');
grunt.log.ok('Running task ' + task + ' for files ' + filesOption);
// Spawn the task in a child process so that it doesn't kill this one
// if it failed.
var args = [task, filesOption];
if (grunt.option('force')) {
args.push('--force');
}
grunt.util.spawn(
{
// Spawn with the grunt bin.
grunt: true,
// Run from current working dir and inherit stdio from process.
opts: {
cwd: grunt.moodleEnv.fullRunDir,
stdio: 'inherit'
},
args: args
},
function(err, res, code) {
if (code !== 0) {
// The grunt task failed.
grunt.log.error(err);
}
// Move on to the next task.
next();
}
);
},
function() {
// No longer processing.
processingQueue = false;
// Once all of the tasks are done then recurse just in case more tasks
// were queued while we were processing.
processWatchTaskQueue();
}
);
};
const originalWatchConfig = grunt.config.get(['watch']);
const watchConfig = Object.keys(originalWatchConfig).reduce(function(carry, key) {
if (key == 'options') {
return carry;
}
const value = originalWatchConfig[key];
const taskNames = value.tasks;
const files = value.files;
let excludes = [];
if (value.excludes) {
excludes = value.excludes;
}
taskNames.forEach(function(taskName) {
carry[taskName] = {
files,
excludes,
};
});
return carry;
}, {});
watchmanClient.on('error', function(error) {
// We have to add an error handler here and parse the error string because the
// example way from the docs to check if Watchman is installed doesn't actually work!!
// See: https://github.com/facebook/watchman/issues/509
if (error.message.match('Watchman was not found')) {
// If watchman isn't installed then we should fallback to the other watch task.
grunt.log.ok('It is recommended that you install Watchman for better performance using the "watch" command.');
// Fallback to the old grunt-contrib-watch task.
grunt.renameTask('watch-grunt', 'watch');
grunt.task.run(['watch']);
// This task is finished.
watchTaskDone(0);
} else {
grunt.log.error(error);
// Fatal error.
watchTaskDone(1);
}
});
watchmanClient.on('subscription', function(resp) {
if (resp.subscription !== 'grunt-watch') {
return;
}
resp.files.forEach(function(file) {
grunt.log.ok('File changed: ' + file.name);
var fullPath = grunt.moodleEnv.fullRunDir + '/' + file.name;
Object.keys(watchConfig).forEach(function(task) {
const fileGlobs = watchConfig[task].files;
var match = fileGlobs.some(function(fileGlob) {
return grunt.file.isMatch(`**/${fileGlob}`, fullPath);
});
if (match) {
// If we are watching a subdirectory then the file.name will be relative
// to that directory. However the grunt tasks expect the file paths to be
// relative to the Gruntfile.js location so let's normalise them before
// adding them to the queue.
var relativePath = fullPath.replace(grunt.moodleEnv.gruntFilePath + '/', '');
if (task in watchTaskQueue) {
if (!watchTaskQueue[task].includes(relativePath)) {
watchTaskQueue[task] = watchTaskQueue[task].concat(relativePath);
}
} else {
watchTaskQueue[task] = [relativePath];
}
}
});
});
processWatchTaskQueue();
});
process.on('SIGINT', function() {
// Let the user know that they may need to manually stop the Watchman daemon if they
// no longer want it running.
if (watchInitialised) {
grunt.log.ok('The Watchman daemon may still be running and may need to be stopped manually.');
}
process.exit();
});
// Initiate the watch on the current directory.
watchmanClient.command(['watch-project', grunt.moodleEnv.fullRunDir], function(watchError, watchResponse) {
if (watchError) {
grunt.log.error('Error initiating watch:', watchError);
watchTaskDone(1);
return;
}
if ('warning' in watchResponse) {
grunt.log.error('warning: ', watchResponse.warning);
}
var watch = watchResponse.watch;
var relativePath = watchResponse.relative_path;
watchInitialised = true;
watchmanClient.command(['clock', watch], function(clockError, clockResponse) {
if (clockError) {
grunt.log.error('Failed to query clock:', clockError);
watchTaskDone(1);
return;
}
// Generate the expression query used by watchman.
// Documentation is limited, but see https://facebook.github.io/watchman/docs/expr/allof.html for examples.
// We generate an expression to match any value in the files list of all of our tasks, but excluding
// all value in the excludes list of that task.
//
// [anyof, [
// [allof, [
// [anyof, [
// ['match', validPath, 'wholename'],
// ['match', validPath, 'wholename'],
// ],
// [not,
// [anyof, [
// ['match', invalidPath, 'wholename'],
// ['match', invalidPath, 'wholename'],
// ],
// ],
// ],
var matchWholeName = fileGlob => ['match', fileGlob, 'wholename'];
var matches = Object.keys(watchConfig).map(function(task) {
const matchAll = [];
matchAll.push(['anyof'].concat(watchConfig[task].files.map(matchWholeName)));
if (watchConfig[task].excludes.length) {
matchAll.push(['not', ['anyof'].concat(watchConfig[task].excludes.map(matchWholeName))]);
}
return ['allof'].concat(matchAll);
});
matches = ['anyof'].concat(matches);
var sub = {
expression: matches,
// Which fields we're interested in.
fields: ["name", "size", "type"],
// Add our time constraint.
since: clockResponse.clock
};
if (relativePath) {
/* eslint-disable camelcase */
sub.relative_root = relativePath;
}
watchmanClient.command(['subscribe', watch, 'grunt-watch', sub], function(subscribeError) {
if (subscribeError) {
// Probably an error in the subscription criteria.
grunt.log.error('failed to subscribe: ', subscribeError);
watchTaskDone(1);
return;
}
grunt.log.ok('Listening for changes to files in ' + grunt.moodleEnv.fullRunDir);
});
});
});
};
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
grunt.renameTask('watch', 'watch-grunt');
// Register the new watch handler.
grunt.registerTask('watch', 'Run tasks on file changes', watchHandler);
grunt.config.merge({
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
},
});
return watchHandler;
};
-111
View File
@@ -1,111 +0,0 @@
#!/usr/bin/env node
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
import { Argument, Option, program } from 'commander';
import chalk from 'chalk';
import { getNoteNames } from './notes/src/noteTypes.mjs';
import createAction from './notes/src/create.mjs';
import generateAction from './notes/src/generate.mjs';
import generateReleaseNotesLinks from './notes/src/releasenotes.mjs';
import logger from './notes/src/logger.mjs';
console.log(`
${chalk.bold(chalk.underline(chalk.green('Moodle Upgrade Notes Generator')))}
This tool is used to generate the upgrade notes for changes you make in Moodle.
Please remember that the intended audience of these changes is
${chalk.italic('plugin developers')} who need to know how to update their plugins
for a new Moodle version.
Upgrade notes should not be used to document changes for site administrators, or
for internal API changes which are not expected to be used outside of the
relevant component.
`)
program.configureHelp({
helpWidth: 100,
});
program.on('option:verbose', () => {
logger.level = 'verbose';
});
program.addOption(
new Option(
'-v, --verbose',
'Output more information during the generation process',
)
.default(false)
);
// Define the command line options.
program
.command('create')
.summary('Generate a new upgrade note')
.addOption(
new Option('-t, --type <type>', `The type of change to document. Valid types are: ${getNoteNames().join(', ')}`)
)
.addOption(new Option('-i, --issue <issue>', 'The tracker issue number'))
.addOption(new Option('-c, --component <component>', 'The component to write a note for'))
.addOption(new Option(
'-m, --message <message>',
'The message to use for the upgrade note',
))
.action((options) => createAction(options));
program
.command('summary')
.summary('Generate a local copy of the upgrade notes summary')
.addArgument(
new Argument('[version]', 'The Moodle version to create the summary notes for')
)
.action((version) => generateAction(version));
program
.command('releasenotes')
.summary('Generate a list of upgrade notes for individual components in markdown format for the release notes')
.addArgument(
new Argument('[tag]', 'The Moodle tag')
)
.action((tag) => generateReleaseNotesLinks(tag));
program
.command('release')
.summary('Generate the markdown copies of the upgrade notes for a Moodle release')
.addArgument(
new Argument('[version]', 'The Moodle version to create the release notes for')
)
.addOption(
new Option(
'--generate-upgrade-notes',
'Generate the UPGRADING.md notes for the release. ' +
'Note: This option is intended for use by the release manager when generating the upgrade notes.',
)
.default(true)
)
.addOption(
new Option(
'-d, --delete-notes',
'Delete the notes after generating the UPGRADING.md notes for the release. ' +
'Note: This option is intended for use by the release manager when generating the upgrade notes.' +
'This option has no effect unless --generate-upgrade-notes is also set.'
)
.default(false)
)
.action((version, options) => generateAction(version, options));
program.parse();
-2
View File
@@ -1,2 +0,0 @@
**/amd/**
/*.js
-58
View File
@@ -1,58 +0,0 @@
// NOTE: We use eslint now. This file is used only by shifter. We keep the configuration
// here because shifter uses jshint after modules have been concating. Eslint can't
// currently do this.
{
"asi": false,
"bitwise": true,
"boss": false,
"browser": true,
"curly": true,
"debug": false,
"eqeqeq": false,
"eqnull": false,
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"forin": false,
"funcscope": false,
"globalstrict": false,
"immed": true,
"indent": 4,
"iterator": false,
"lastsemic": false,
"latedef": true,
"laxbreak": true,
"laxcomma": false,
"loopfunc": false,
"maxerr": 500,
"maxlen": 132,
"multistr": false,
"newcap": true,
"noarg": true,
"noempty": true,
"nomen": false,
"onecase": false,
"onevar": false,
"passfail": false,
"plusplus": false,
"predef": [
"M",
"define",
"require"
],
"proto": false,
"regexdash": false,
"regexp": false,
"scripturl": false,
"shadow": false,
"smarttabs": false,
"strict": false,
"sub": false,
"supernew": false,
"trailing": true,
"undef": true,
"unused": true,
"white": false,
"yui": true
}
-1
View File
@@ -1 +0,0 @@
lts/jod
-40
View File
@@ -1,40 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Helper file for PhpStorm, and other IDEs, to provide better code completion.
*
* @package core
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace PHPSTORM_META;
// Assume that anything returned by \core\di::get('...') is an instance of the first argument.
override(\core\di::get(0), map([
'' => '@',
]));
// Assume that anything returned by \Psr\Container\ContainerInterface::get('...') is an instance of the first argument.
override(\Psr\Container\ContainerInterface::get(0), map([
'' => '@',
]));
// Assume that anything returned by \DI\Container::get('...') is an instance of the first argument.
override(\DI\Container::get(0), map([
'' => '@',
]));
-5
View File
@@ -1,5 +0,0 @@
{
"coverage": false,
"lint": "config",
"clean": true
}
-107
View File
@@ -1,107 +0,0 @@
{
"customSyntax": "postcss-scss",
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": {
"syntaxExtensions": [
"sass"
]
},
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
],
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-no-unknown": null, # Enabled for non-scss in grunt.
"at-rule-semicolon-newline-after": "always",
"at-rule-semicolon-space-before": "never",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": ["lower", { "severity": "warning" }],
"color-hex-length": ["short", { "severity": "warning" }],
"color-no-invalid-hex": true,
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-url-scheme-disallowed-list": ["data"],
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
"length-zero-no-unit": [true, { "severity": "warning" }],
"max-empty-lines": 2,
"max-line-length": [132, { "severity": "warning" }],
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": [true, { "severity": "warning" }],
"no-invalid-double-slash-comments": true,
"no-unknown-animations": true,
"property-case": "lower",
"property-no-unknown": true,
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"selector-type-no-unknown": true,
"string-no-newline": true,
"time-min-milliseconds": 100,
"unit-disallowed-list": ["pt"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
},
"overrides": [
{
"files": ["**/yui/**/*.css"],
"rules": {
}
}
]
}
@@ -1,7 +0,0 @@
issueNumber: MDL-51152
notes:
enrol_manual:
- message: >-
The unused parameter 'roleid' has been removed from the external
function `unenrol_users()`
type: removed
@@ -1,22 +0,0 @@
issueNumber: MDL-71368
notes:
core:
- message: >
The `arg_separator.output` has been changed from a default of `amp;` to
a default of `&` in line with PHP defaults.
If you were previously relying on the legacy default when using
`http_build_query()` then you should _actively_ specify the value as the
third
parameter, for example:
```
http_build_query($formdata, '', '&amp;');
```
type: changed
@@ -1,8 +0,0 @@
issueNumber: MDL-73602
notes:
core:
- message: >-
Removed `qtype_random` from core.
`core\component::is_valid_plugin_name` has an additional check to ensure no-one can create a new plugin called qtype_random,
as this would conflict with the support for restoring old backups.
type: removed
@@ -1,8 +0,0 @@
issueNumber: MDL-75067
notes:
tool_behat:
- message: >-
The `behat_session_trait::ensure_element_[does_not_]exists(...)` methods
now accept optional `$container` parameter to define the parent node to
look within
type: improved
@@ -1,5 +0,0 @@
issueNumber: MDL-77894
notes:
core:
- message: Appending an exclamation mark to template names ignores theme overrides
type: improved
@@ -1,10 +0,0 @@
issueNumber: MDL-78325
notes:
core_grades:
- message: >-
In Moodle 4.2, the legacy Gradebook base widget from 4.1 has been removed and
replaced with a simpler class-based system due to a breaking change and
excessive complexity in the old pattern. The files `core/grades/basewidget.js` and
templates in `grade/templates/searchwidget/` have been deleted,
with minimal expected third-party impact.
type: removed
@@ -1,13 +0,0 @@
issueNumber: MDL-79182
notes:
core:
- message: >
The following AMD modules have been removed following the final
deprecation process. It is no longer possible or necessary to manually
register modal types. See MDL-78324 for further details.
- `core/modal_registry`
- `core/modal_factory`
type: removed
@@ -1,7 +0,0 @@
issueNumber: MDL-79574
notes:
core:
- message: >-
The `\core\persistent::get_records(...)` class method now returns
instances keyed by record ID
type: changed
@@ -1,13 +0,0 @@
issueNumber: MDL-81514
notes:
core_group:
- message: >
`groups_print_activity_menu()` and `groups_get_activity_group()` now
include an additional `$participationonly` parameter, which is true by
default. This can be set false when we want the user to be able to
select a non-participation group within an activity, for example if a
teacher wants to filter assignment submissions by non-participation
groups. It should never be used when the menu is displayed to students,
as this may allow them to participate using non-participation groups.
Non-participation groups are labeled as such.
type: improved
@@ -1,8 +0,0 @@
issueNumber: MDL-81608
notes:
mod_quiz:
- message: >-
The language strings `addpagebreak` and `removepagebreak` have been
deprecated and should no longer be used. These have been replaced by
the `addpagebreakafter` and `removepagebreakafter` language strings.
type: deprecated
@@ -1,12 +0,0 @@
issueNumber: MDL-81961
notes:
core_question:
- message: |
core_question:
- message: |
Final deprecation of `moodle-question-chooser` YUI module.
type: removed
- message: |
Final deprecation of `core_question/qbank_chooser` template.
type: removed
type: removed
-13
View File
@@ -1,13 +0,0 @@
issueNumber: MDL-81962
notes:
core:
- message: The `moodle-core-notification-confirm` YUI module has been removed after an extensive deprecation period. Please use the AMD `core/modal` module as a replacement.
type: removed
- message: |
The following feaetures of the `moodle-core-notification` YUI module have been removed after an extensive deprecation process.:
- method: `keyDelegation`
- property: `lightbox`
There is no direct replacement for these features, but they were not widely used and their removal should not cause significant issues. If you were using these features, you will need to implement your own solutions for key delegation and lightbox functionality.
type: removed
@@ -1,7 +0,0 @@
issueNumber: MDL-82284
notes:
core:
- message: >-
Legacy constructors have been removed. These relate to PHP 4 and
earlier.
type: removed
@@ -1,15 +0,0 @@
issueNumber: MDL-83902
notes:
core_badges:
- message: >-
The following classes and functions are now also available in the following new
locations. They will continue to work in their old locations:
| Old classname/function | New classname/function |
| --- | --- |
| `\badge_award_selector_base` | `\core_badges\award_selector_base` |
| `\badge_potential_users_selector` | `\core_badges\potential_award_selector` |
| `\badge_existing_users_selector` | `\core_badges\existing_award_selector` |
| `process_manual_award()` | `\core_badges\award_manager::process_manual_award()` |
| `process_manual_revoke()` | `\core_badges\award_manager::process_manual_revoke()` |
type: improved
@@ -1,7 +0,0 @@
issueNumber: MDL-84082
notes:
core_reportbuilder:
- message: >-
The text filter "Contains" and "Not contains" operators now support `*`
and `?` wildcard characters for better text content filtering
type: improved
@@ -1,30 +0,0 @@
issueNumber: MDL-84960
notes:
core:
- message: >-
Several core web services now include a new initials field in user data
structures. This change is backward-compatible and only adds an optional
field; no existing fields or field semantics have been changed.
Client applications should ensure they can handle the additional initials
field in web service responses, but clients that ignore unknown fields can
continue working without changes. The affected web services are:
- core_enrol_get_enrolled_users
- core_enrol_get_enrolled_users_with_capability
- core_enrol_get_potential_users
- core_enrol_search_users
- core_user_get_users_by_field
- core_user_get_users
- core_user_get_course_user_profiles
- core_grades_get_enrolled_users_for_selector
- core_grades_get_gradable_users
- gradereport_grader_get_users_in_report
- core_message_get_contact_requests
- core_message_get_conversation_members
- core_message_message_search_users
- core_message_get_user_contacts
- core_message_get_member_info
- core_message_get_conversation_messages
- mod_assign_list_participants
- mod_assign_get_participant
- mod_forum_get_forum_discussions
type: improved
@@ -1,9 +0,0 @@
issueNumber: MDL-85233
notes:
core_filters:
- message: >-
MimeTeX support has been removed from both `filter_tex` and
`filter_algebra`. These filters now depend on LaTeX tools (`latex`,
`dvips`, and `convert`/`dvisvgm`), and as a result, the `pathmimetex`
setting has been removed.
type: removed
@@ -1,8 +0,0 @@
issueNumber: MDL-85322
notes:
block_html:
- message: >-
Treat Dashboard (pagetype 'my-index') as trusted in web services so
get_content_for_external preserves embedded HTML (e.g. iframes) on user
Dashboard.
type: changed
@@ -1,8 +0,0 @@
issueNumber: MDL-85336
notes:
core:
- message: >-
Redis connection timeout settings for cachestores and sessions have been
split into connection timeout and read timeout to allow for finer
control. These settings now also accept floats.
type: improved
@@ -1,9 +0,0 @@
issueNumber: MDL-85405
notes:
core_course:
- message: >-
The external function `core_course_get_course_contents` now includes the
`candisplay` property for each returned module. If this is false, the
module should not be displayed on the course page (for example, for
question banks).
type: improved
@@ -1,5 +0,0 @@
issueNumber: MDL-85621
notes:
core_badges:
- message: The create_issued_badge generator now returns the issued badge object.
type: changed
@@ -1,11 +0,0 @@
issueNumber: MDL-85621
notes:
core_badges:
- message: >-
The class core_badges_assertion has been deprecated and replaced by
\core_badges\achievement_credential.
The method badges_get_default_issuer() has also been deprecated because
it is no longer needed.
The file badges/endorsement.php has been removed because it stopped being used
when MDL-84323 was integrated.
type: deprecated
@@ -1,17 +0,0 @@
issueNumber: MDL-85975
notes:
core:
- message: >
`restore_qtype_plugin::unset_excluded_fields` now returns the modified
questiondata structure,
in order to support structures that contain arrays.
If your qtype plugin overrides
`restore_qtype_plugin::remove_excluded_question_data` without
calling the parent method, you may need to modify your overridden method
to use the returned
value.
type: fixed
@@ -1,8 +0,0 @@
issueNumber: MDL-86332
notes:
core_completion:
- message: >-
The `completion_info::clear_criteria` method takes an optional
`$removetypecriteria` to determine whether to remove course type
criteria from other courses that refer to the current course
type: changed
@@ -1,26 +0,0 @@
issueNumber: MDL-86493
notes:
mod_quiz:
- message: >-
The quiz overrides cache implementation has been replaced with a faster alternative with a different API.
This should be a transparent change but any direct references will still need to be updated.
type: deprecated
- message: >
`mod_quiz_cm_info_dynamic()` now uses the new `quiz_overrides` cache via `override_manager`, performing a single cache fetch per quiz/user.
This significantly reduces cache calls on course pages with many quizzes and groups.
The new `mod_quiz:quiz_overrides` cache is keyed by `quizid_userid` using datasource `\mod_quiz\cache\quiz_overrides_cache`.
This cache returns all applicable overrides for a user in a quiz (the user override, if any, plus all group overrides for groups they belong to in the quiz's course).
New class `\mod_quiz\local\quiz_overrides_cache_manager` to interact with the cache:
- `get_overrides(int $quizid, int $userid): array`
- `purge_for_user(int $quizid, int $userid): void`
- `purge_for_users(int $quizid, array $userids): void`
- `purge_for_group(int $quizid, int $groupid): void`
- `purge_for_group_members(int $groupid, array $userids): void`
Hook callbacks in `db/hooks.php` to keep the cache in sync with group
membership changes:
- `\core_group\hook\after_group_membership_added`
- `\core_group\hook\after_group_membership_removed`
type: improved
@@ -1,12 +0,0 @@
issueNumber: MDL-86524
notes:
core_question:
- message: >-
During restore of a question_set_reference, mapping of IDs in the
filtercondition is now delegated to qbank plugins.
If your qbank plugin defines a filter condition that uses database
IDs, add an override of `restore_filtercondition()` to the `condition`
class, which checks the condition's data and replaces the IDs with
mapped values if required. See
`qbank_managecategories\category_condition` for an example.
type: improved
@@ -1,7 +0,0 @@
issueNumber: MDL-86607
notes:
mod_feedback:
- message: >-
The method `feedback_init_feedback_session()` has been deprecated, along
with all other direct access to `$SESSION` from the module
type: deprecated
@@ -1,7 +0,0 @@
issueNumber: MDL-86660
notes:
core_courseformat:
- message: >-
The `$cm` attribute in `activityoverviewbase` has been updated to public
visibility, allowing direct access to the course module instance
type: changed
@@ -1,8 +0,0 @@
issueNumber: MDL-86660
notes:
core_courseformat:
- message: >-
A new `available` attribute has been added to `activityname_exporter`
class. It allows the external API to return the activity's availability
status relative to the current user.
type: changed
@@ -1,9 +0,0 @@
issueNumber: MDL-86660
notes:
core_courseformat:
- message: >-
Two new public static methods have been added to the `overviewtable`
class:
- `is_cm_displayable`: Determines if a course module should be listed in the overview table.
- `is_cm_available`: Checks if a course module is accessible to the user (and should therefore be rendered as a link).
type: changed
@@ -1,19 +0,0 @@
issueNumber: MDL-86678
notes:
core_reportbuilder:
- message: >-
The base entity class now implements a default `initialise` method, that
will automatically call each of the following methods to load entity
report data:
* `get_available_columns()`
* `get_available_filters()`
* `get_available_conditions()`
This change allows for a lot of boilerplate to be removed from report
entity classes
type: improved
@@ -1,12 +0,0 @@
issueNumber: MDL-86699
notes:
core_reportbuilder:
- message: >-
There are two new entities intended for reports specific to course
module data, in order to provide a baseline in terms of module reporting
and API usage:
*
`core_course\reportbuilder\local\entities\{course_module,course_module_base}`
type: improved
@@ -1,7 +0,0 @@
issueNumber: MDL-86699
notes:
mod_forum:
- message: >-
The forum report entity `->get_context_joins()` method is deprecated,
replaced with `->get_course_modules_joins(...)`
type: deprecated
@@ -1,17 +0,0 @@
issueNumber: MDL-86798
notes:
core_question:
- message: >
In order to prevent re-use of question version numbers after a version
is deleted, the `nextversion` column was added to
`question_bank_entries`. This serves as a counter incremented each time
a version is created.
Do not query this field directly. Instead use
`core_question\versions::get_next_version()` to read the value, which
will initialise it based on the existing versions if it is not set yet.
By default, it will increment the version number automatically, unless
you pass `increment: false`. Because of this, it is advisable to call
it inside a transaction, that is only committed after the version number
is used in a `question_versions` record.
type: fixed
@@ -1,7 +0,0 @@
issueNumber: MDL-86798
notes:
core_question:
- message: >-
`get_next_version()` from questionlib.php is now deprecated. Use
`\core_question\versions::get_next_version()` instead.
type: deprecated
@@ -1,5 +0,0 @@
issueNumber: MDL-86832
notes:
core_block:
- message: Removed block_activity_modules from Moodle 5.2.
type: removed
@@ -1,10 +0,0 @@
issueNumber: MDL-86839
notes:
core:
- message: >
"grunt watch" now accepts a force flag. Run "grunt watch -f" or "grunt
watch --force" to prevent grunt from cancelling builds when errors
occur. This is especially useful during development, because js build
files will be built even if, for example, jslint errors are still
present in the files.
type: improved
@@ -1,8 +0,0 @@
issueNumber: MDL-86846
notes:
core:
- message: >-
The `core/drag_handle` template has been modified to use a native HTML
button for a more accessible experience and a consistent look with other
buttons on the page.
type: changed
@@ -1,7 +0,0 @@
issueNumber: MDL-86854
notes:
core_courseformat:
- message: >-
Add core_courseformat\cmactions::move_before that will allow to move a coursemodule to a position before another coursemodule.
Add core_courseformat\cmactions::move_end_section that will allow to move a coursemodule the end of a section.
type: improved
@@ -1,8 +0,0 @@
issueNumber: MDL-86854
notes:
core_course:
- message: >-
Deprecates moveto_module (core_course) in favor of
cmactions::move_before or cmactions::move_end_section
(core_courseformat\local\cmactions).
type: deprecated
@@ -1,11 +0,0 @@
issueNumber: MDL-86855
notes:
qbank_columnsortorder:
- message: >-
The Behat selector `column move handle` for the `qbank_columnsortorder` plugin has been removed.
When interacting with the column's move handle, please use the move handle's accessible name and type.
For example:
- `And I drag "Move Created by" "button" and I drop it in "Move T" "button"`
type: removed
@@ -1,9 +0,0 @@
issueNumber: MDL-86856
notes:
core_course:
- message: >-
The following methods have been deprecated and should no longer be used:
- `course_delete_module`
- `course_module_flag_for_async_deletion`
Please consider using the equivalent methods, delete and delete_async, in `core_courseformat\local\cmactions` instead.
type: deprecated
@@ -1,5 +0,0 @@
issueNumber: MDL-86856
notes:
core_courseformat:
- message: Add delete method to the core_courseformat\cmactions
type: improved
@@ -1,7 +0,0 @@
issueNumber: MDL-86857
notes:
core_courseformat:
- message: >-
Add set_groupmode method to the core_courseformat\cmactions (course
format actions)
type: improved
@@ -1,7 +0,0 @@
issueNumber: MDL-86857
notes:
core_course:
- message: >-
Deprecates set_coursemodule_groupmode in favor of
core_courseformat\cmactions::set_groupmode
type: deprecated
@@ -1,7 +0,0 @@
issueNumber: MDL-86858
notes:
core_courseformat:
- message: >-
Create a new core_courseformat\cmactions::duplicate aiming to replace
the course/lib.php version
type: improved

Some files were not shown because too many files have changed in this diff Show More