Compare commits

..

848 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 7413ce9896 Moodle 2.3.2 release 2012-09-09 16:23:09 +02:00
AMOS bot f84f35dda1 Merge branch 'MOODLE_23_STABLE' into install_23_STABLE 2012-09-08 00:34:44 +00:00
Eloy Lafuente (stronk7) 71e12dc963 weekly release 2.3.1+ 2012-09-07 02:38:46 +02:00
AMOS bot ba1d10c500 Automatically generated installer lang files 2012-09-07 00:35:10 +00:00
Eloy Lafuente (stronk7) 662fe4b7d6 Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-09-07 02:18:16 +02:00
Eloy Lafuente (stronk7) ce077202d0 Merge branch 'MDL-34945-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-06 20:12:09 +02:00
Eloy Lafuente (stronk7) d98c8fcb8e Merge branch 'MDL-34985_m23' of git://github.com/merrill-oakland/moodle into MOODLE_23_STABLE 2012-09-06 20:07:45 +02:00
Eloy Lafuente (stronk7) 9d2926a4e9 MDL-6424 - blocks - Add missing global vars. 2012-09-06 19:45:00 +02:00
Adrian Greeve 155fd3f64b MDL-6424 - blocks - Adding a warning screen when the user clicks the delete link.
Conflicts:
	lib/blocklib.php
2012-09-06 19:44:40 +02:00
Eloy Lafuente (stronk7) e02955dd79 Merge branch 'MDL-35034-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-06 01:18:40 +02:00
Eloy Lafuente (stronk7) 3f4e07ef3c MDL-29662 quiz overrides: use proper course value (was php notice). 2012-09-05 18:02:16 +02:00
Eloy Lafuente (stronk7) 9569ba7ed8 Merge branch 'w36_MDL-35077_m23_stats' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-05 13:13:31 +02:00
Petr Škoda e4e29fd35e MDL-35077 do not show link to system stats report if stats disabled 2012-09-05 10:02:07 +02:00
Aparup Banerjee 69a52e7c4f Merge branch 'MDL-35089_23' of git://github.com/stronk7/moodle into MOODLE_23_STABLE 2012-09-05 15:08:38 +08:00
Aparup Banerjee a334d8f967 MDL-26504 blog: fixed SQL to add explicit casting
Conflicts:

	lib/db/upgrade.php
	version.php
2012-09-05 10:31:06 +08:00
Eloy Lafuente (stronk7) 3ac8fa663a Merge branch 'MDL-34997-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-05 00:52:43 +02:00
Aparup Banerjee 4ec133b8e6 Merge branch 'wip-mdl-34537-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-09-04 17:32:51 +08:00
Frederic Massart 7c4fc5b50b MDL-34945 Repository: Creating an instance requires the user to have the permission to view it 2012-09-04 16:17:25 +08:00
Andrew Davis c62ccd747c MDL-26504 blog: added upgrade code to remove orphan external blog posts
Conflicts:
	lib/db/upgrade.php
	version.php
2012-09-04 13:56:27 +08:00
Andrew Davis fb1b0bc05e MDL-26504 blog: made it delete external blog posts when the external blog is deleted 2012-09-04 13:53:48 +08:00
Sam Hemelryk df4e81835a Merge branch 'MDL-30022_message_duplicate_23' of git://github.com/andyjdavis/moodle into MOODLE_23_STABLE 2012-09-04 16:50:23 +12:00
Tim Lock d8a640728c MDL-35092: Add proxy support to enrol/paypal IPN 2012-09-04 10:56:41 +08:00
Eloy Lafuente (stronk7) 31ae0e5984 Merge branch 'wip-mdl-34606-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-09-04 02:09:25 +02:00
Eloy Lafuente (stronk7) 3dafe46b2b Merge branch 'MDL-34633-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-04 01:54:04 +02:00
Eloy Lafuente (stronk7) 5f015b62d4 Merge branch 'MDL-29662_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-09-04 01:14:18 +02:00
Eloy Lafuente (stronk7) 2b567e3687 Merge branch 'MDL-27818_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-09-04 01:07:51 +02:00
Eloy Lafuente (stronk7) 8a716e2362 Merge branch 'MDL-33306_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-09-04 00:30:59 +02:00
Eloy Lafuente (stronk7) 20182f8670 Merge branch 'MDL-33812-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-04 00:20:17 +02:00
Eloy Lafuente (stronk7) 99e6bd4799 Merge branch 'MDL-34725-strict-standards_23' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-09-04 00:06:23 +02:00
Eloy Lafuente (stronk7) 0af2fd2e05 Merge branch 'w36_MDL-34097_m23_environment' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-04 00:00:38 +02:00
Eloy Lafuente (stronk7) 2cdf1a4650 Merge branch 'MDL-28346-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-09-03 20:02:13 +02:00
Eloy Lafuente (stronk7) 0cae56b42e Merge branch 'w36_MDL-35077_m23_stats' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-03 17:54:03 +02:00
Eloy Lafuente (stronk7) b9d24254bd Merge branch 'MDL-35133_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-09-03 17:47:50 +02:00
Eloy Lafuente (stronk7) a31d7a0ed3 Merge branch 'w36_MDL-35168_m23_yuipath' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-03 17:16:17 +02:00
Eloy Lafuente (stronk7) e815aa8e04 Merge branch 'w36_MDL-35145_m23_guestdelete' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-03 16:18:15 +02:00
Aparup Banerjee e78698c606 Merge branch 'MDL-35151_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-09-03 19:23:52 +08:00
Aparup Banerjee a2bdb0b02c Merge branch 'MDL-35180_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-09-03 17:38:07 +08:00
Aparup Banerjee 90c499dbca Merge branch 'w36_MDL-35080_m23_weirdtables' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-09-03 17:12:32 +08:00
Frederic Massart 82bf5b10b9 MDL-34633 Repository: Flickr supports small images 2012-09-03 14:19:47 +08:00
Frederic Massart 668ba1e922 MDL-35101 Repository: Public Flickr fails when the picture has no license 2012-09-03 14:18:16 +08:00
Jean-Philippe Gaudreau 3d5df93b80 MDL-34997 - Allow shortened url youtu.be and y2u.be for Youtube filter 2012-09-03 14:12:03 +08:00
Frederic Massart 3bae0b5916 MDL-28346 Backup: Backup does not fail when a file is missing 2012-09-03 14:11:37 +08:00
Frederic Massart 16ee63b4b8 MDL-28346 Backup: Restore does not fail when a file is missing 2012-09-03 14:11:37 +08:00
Frederic Massart 397afd71c3 MDL-28346 Backup: Added new status 'warning' for backup result 2012-09-03 14:11:37 +08:00
Frederic Massart c128731d19 MDL-35034 Repository: Google Docs does not fail when download is restricted 2012-09-03 14:11:12 +08:00
Frederic Massart 640f8eed6d MDL-33812 Backup: Added some upgrade information about the changes 2012-09-03 14:10:59 +08:00
Frederic Massart 2fd679c5e1 MDL-33812 Backup: Revert MDL-33521 2012-09-03 14:10:59 +08:00
Frederic Massart 905185dca4 MDL-33812 Backup: Respect of backup_auto_keep 2012-09-03 14:10:58 +08:00
Sam Hemelryk 8169e2f46b Merge branch 'MDL-35109-available-updates_23' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-09-03 12:28:18 +12:00
Sam Hemelryk 3d1cbc0df3 Merge branch 'MDL-31496_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-09-03 12:20:25 +12:00
Sam Hemelryk b739e2d71a MDL-26822 user: Minor improvements post integration 2012-09-03 11:41:24 +12:00
Sam Hemelryk bcbfd02574 Merge branch 'MDL-26882-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-09-03 11:26:07 +12:00
Sam Hemelryk f38508168f Merge branch 'wip-MDL-34318-MOODLE_23_STABLE' of git://github.com/abgreeve/moodle into MOODLE_23_STABLE 2012-09-03 10:12:37 +12:00
Sam Hemelryk 9f66e64390 Merge branch 'MDL-30020c-23' of git://github.com/srynot4sale/moodle into MOODLE_23_STABLE 2012-09-03 09:52:20 +12:00
Mary Evans 47045e82b0 MDL-35180 theme_afterburner: fixes IE9 compatibility view bug 2012-09-02 16:00:29 +01:00
Petr Škoda e235de5ef5 MDL-34097 keep current requirements for Moodle 2.4 2012-09-02 11:53:45 +02:00
AMOS bot a49ea30654 Automatically generated installer lang files 2012-09-02 00:32:45 +00:00
Mary Evans f4f8cf9a2d MDL-35151 theme_anomaly: removed CSS selectors (.forumpost .content p) from style/general.php thus allowing YUI CSS to style paragraphs as normal. 2012-09-01 23:25:40 +01:00
Petr Škoda 9817f08400 MDL-35080 skip views and weird tables in mysql structure upgrades 2012-09-01 16:23:44 +02:00
Petr Škoda 45f9c2db5f MDL-35145 add basic unit tests for delete_user() 2012-09-01 14:15:36 +02:00
Petr Škoda 3fe8ae9bb9 MDL-35145 add extra delete_user() parameter validation
We do not want to delete local admins and guest account, we need to validate the supplied parameter is valid $user record and refetch it from database.
2012-09-01 14:15:28 +02:00
Petr Škoda 58520c062d MDL-35168 fix yui combo path disclosure 2012-09-01 12:39:59 +02:00
Petr Škoda 0a898cbc46 MDL-35077 fix stats report navigation links 2012-08-31 14:17:45 +02:00
Eloy Lafuente (stronk7) 98157832bf weekly release 2.3.1+ 2012-08-31 11:35:54 +02:00
Eloy Lafuente (stronk7) 6e6f74da2f Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-08-31 11:27:25 +02:00
Eloy Lafuente (stronk7) 4c6b8659f9 MDL-35147 lesson qformat import: Dirty hack to support array questiontext structures. 2012-08-31 02:59:49 +02:00
Tim Hunt 5d22b22274 MDL-27818 question bank: multilang category names don't work. 2012-08-30 22:45:51 +01:00
Tim Hunt fd126f94aa MDL-35133 accesslib: context_module::get_context_name should format_string
Otherwise activites with multilang names are displayed badly.
2012-08-30 22:44:20 +01:00
Eloy Lafuente (stronk7) f1f174e2bf Merge branch 'MDL-35147_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-30 20:12:31 +02:00
Eloy Lafuente (stronk7) a1db53480c Merge branch 'MDL-31244_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-30 18:32:04 +02:00
Tim Hunt 5fe6d41245 MDL-35147 lesson: fix regression from MDL-25492.
I really wish someone would fix lesson to use the question bank.
2012-08-30 13:12:00 +01:00
Ankit Agarwal 4d7a664ee7 MDL-26882 profile: Applying cap check (site:viewuseridentity) to email field in user profile 2012-08-30 15:36:26 +08:00
Ankit Agarwal 74c0b55029 MDL-26882 profile: Apllying the cap check site:viewuseridentity to user profile 2012-08-30 15:36:20 +08:00
David Monllao 21415acd5a MDL-35119 tool_assignmentupgrade Changing onsubmit form for onclick button 2012-08-30 15:01:17 +08:00
Adrian Greeve edd2686c8b MDL-32108 - navigation - After logging in the user is directed to mysite instead of site home.
Thanks to lurii Kucherov for this patch.
2012-08-30 11:58:14 +08:00
Aparup Banerjee bc67dfdb9a Merge branch 'MDL-35010_23' of git://github.com/stronk7/moodle into MOODLE_23_STABLE 2012-08-30 10:43:38 +08:00
Tim Hunt c8f9a0b63a MDL-29662 quiz overrides: update dates during course reset.
Also, fix duplicate SQL clause in similar code in lib,
and fix error when saving overrides.
2012-08-29 18:43:00 +01:00
Tim Hunt 3b5245cd6b MDL-33306 qtype multichoice: fix display of right answer.
Also, fix  higlighing of last edited question in the qeustion bank, when
it co-incides with a grey row.
2012-08-29 17:46:59 +01:00
David Mudrák 160133ce24 MDL-34725 Make the signatures of process_legacy_element() method consistent
The patch fixes the missing parameter type declaration in all subclasses
of the moodle1_workshopform_handler class.
2012-08-29 15:33:22 +02:00
Eloy Lafuente (stronk7) a51eaaac45 Merge branch 'wip-mdl-30121-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-08-29 12:15:14 +02:00
Eloy Lafuente (stronk7) 3afd86559e Merge branch 'wip-MDL-34290-MOODLE_23_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_23_STABLE 2012-08-29 12:11:22 +02:00
Aparup Banerjee accaf1d277 Merge branch 'wip-mdl-31623-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-08-29 16:57:09 +08:00
Aparup Banerjee fd3e329d94 Merge branch 'MDL-31959_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-29 15:33:43 +08:00
Aparup Banerjee 913dd6d630 Merge branch 'MDL-34952_23' of git://github.com/grabs/moodle into MOODLE_23_STABLE 2012-08-29 13:27:05 +08:00
Marina Glancy 074455a6f5 MDL-34290 repository_filesystem: do not store files in moodle filepool unless images 2012-08-29 13:12:07 +08:00
Dan Poltawski 7fa4cd1617 MDL-34290 using moodleform cast to int in dropbox repository settings 2012-08-29 13:12:07 +08:00
Marina Glancy 0707372b03 MDL-34290 Added timeout to googledocs request to download a file 2012-08-29 13:12:06 +08:00
Marina Glancy 3dce698981 MDL-34290, MDL-33416 prepare to deprecate fields files.referencelastsync and referencelifetime 2012-08-29 13:12:06 +08:00
Marina Glancy 29ea4e9c56 MDL-34290 Auto synchronise newly created references when possible 2012-08-29 13:12:06 +08:00
Marina Glancy a7f53f09f3 MDL-34665 Dropbox displays thumbnails and return info about file size and date last modified 2012-08-29 13:12:05 +08:00
Marina Glancy f8dea58be9 MDL-34290 remove class cache_file as not used
in fact we have moodle filepool that can work perfectly for caching files, no need to create new class and storage
2012-08-29 13:12:05 +08:00
Marina Glancy 56e41718da MDL-34290 repository_dropbox reference handling
- When Dropbox file is inserted by reference, the shared link is created and stored
- Added a function to fix old references (containing access_key/secret) with the proper ones
- Added support for external links in Dropbox (FILE_EXTERNAL), using the shared link API
- Make sure that repository::get_link() receives reference and not source (other repositories than Dropbox have those fields identical)
- Function get_file_by_reference respects request timeouts, downloads only images (for thumbnail generation),
- Function get_file respects request timeout
- do not use cache_file class (content is cached in moodle filepool if needed)
- added parameter for maximum size of files to cache
- added 'Manage' link for Filepicker
- added user name to
- added user name (if different from current) to 'Original' field
- added/corrected phpdocs
2012-08-29 13:12:04 +08:00
Marina Glancy 1d168fbd5f MDL-34290 oauthlib_helper support for POST request 2012-08-29 13:12:04 +08:00
Marina Glancy a6b0ac5362 MDL-34290 Allow to have several requests to the same instance of oauth_helper 2012-08-29 13:12:04 +08:00
Marina Glancy 120300fb99 MDL-34290 repository_equella: do not download files when not needed
repository_equella::get_file_by_reference respects request timeouts, downloads only images (for thumbnail generation),
does not use cache_file class (content is cached in moodle filepool if needed);
also repository_equella has counter of unsuccessfull connect attempts and do not perform any more if 3 failed
(within one request)
2012-08-29 13:12:03 +08:00
Marina Glancy a5fe04b62b MDL-34290 repository_boxnet, boxlib use request timeouts
boxlib receives additional argument as request timeout
repository_boxnet::get_file_by_reference respects request timeouts and downloads file into moodle only if it is image
also some improvements to repository_boxnet source display functions;
also do not cache result of request in retrieving of listing, user is unable to see the new files he added to box.
2012-08-29 13:12:03 +08:00
Marina Glancy 9001c7242e MDL-34290 repository API: add repository function to import referenced file
it must be independed from sync_external_file because sync often does not actually download contents, it is used just to retrieve
the size of the file. Besides the timeouts for get_file and sync requests are very different.

Also add option to send_stored_file() to ignore reference and send cached contents
2012-08-29 13:12:03 +08:00
Marina Glancy 22fa5d9a7c MDL-34290 repository_filesystem add original info function and reduce ref lifetime 2012-08-29 13:12:02 +08:00
Marina Glancy e53394ba0b MDL-34290 repository API: add timeout to get_file and throw exception
- get_file should have a request timeout and throw an exception with the details (i.e. timeout reached) if download can
not be completed
- corrected phpdocs
2012-08-29 13:12:02 +08:00
Marina Glancy 56e7d14f26 MDL-34290 repository API: do not confuse source and reference
make sure that repository function get_file_source_info receives as argument the source of the file,
and get_file receives a reference;
reference is a value of DB field files_reference.reference and result of get_file_reference(source).
Fix dropbox as the only repository that have different values in those fields;
also added information about user in dropbox reference and original
2012-08-29 13:12:01 +08:00
Marina Glancy c9fa5b1c05 MDL-34290 repository API: allow get_file_by_reference return only filesize
we want to allow repositories to perform quick synchronisation, without downloading the file. In this case they return
only filesize, without the contenthash
2012-08-29 13:12:01 +08:00
Marina Glancy 3af509d6d4 MDL-34290 class oauth_helper, added API to pass options to curl (such as timeout) 2012-08-29 13:12:01 +08:00
Marina Glancy 26aaa7e835 MDL-34290 update all references after the source is changed
- When several records in {files} have the same record in {files_reference} and the synchronisation is performed, we need to update
all records in {files} so all files know if source is changed and that sync was performed;
- also when local moodle file content is changed we immediately update all files referencing to it (therefore sync of references
to the local files is unnecessary);
2012-08-29 13:12:00 +08:00
Marina Glancy 2e0b5fef48 MDL-34290 curl class: add functions to return error code and to download one file 2012-08-29 13:12:00 +08:00
Eloy Lafuente (stronk7) f3d5fb4dec Merge branch 'MDL-29598_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-08-28 23:23:50 +02:00
David Mudrák 903d13c0c2 MDL-35109 Fix available_update_checker::cron_has_fresh_fetch()
For the purpose of cron based fetching, recently fetched data are valid
for 24 hours.
2012-08-28 22:56:18 +02:00
David Mudrák b0e5b3b63b MDL-35109 Improve unittests for cron based fetching of available updates
The expected behaviour is as follows:

* If the recently fetched data is older than 48 hours, it is considered
  as outdated and the new fetch is executed
* else, if the recently fetched data is younger than 24 hours, it is
  considered as fresh enough and no fetch is executed
* else, if the current time is after 01:00 AM plus a certain offset
  (which is randomly generated for each site), the fetch is
  executed.
2012-08-28 22:52:31 +02:00
Eloy Lafuente (stronk7) 5e143a271c Merge branch 'MDL-34250_23' of github.com:stronk7/moodle into MOODLE_23_STABLE 2012-08-28 20:44:49 +02:00
Eloy Lafuente (stronk7) ffbe597ef1 MDL-34250 navigation: Always look for correct parent context.
Conflicts:
	lib/navigationlib.php
2012-08-28 20:41:21 +02:00
Eloy Lafuente (stronk7) 56c5e1db1b MDL-25492 bb6 import: bump version after big changes. 2012-08-28 20:15:18 +02:00
Eloy Lafuente (stronk7) ed29fa1274 Merge branch 'MDL-25492_23' of git://github.com/jmvedrine/moodle into MOODLE_23_STABLE 2012-08-28 20:08:19 +02:00
Eloy Lafuente (stronk7) faf4ba4774 Merge branch 'MDL-34192_23' of git://github.com/stronk7/moodle into MOODLE_23_STABLE 2012-08-28 14:44:30 +02:00
Eloy Lafuente (stronk7) d8e6e58ec5 MDL-34192 mod_assign: prevent ambiguous column use for Oracle.
Credit goes to Raymond Antonio from NetSpot.
2012-08-28 14:18:54 +02:00
Aparup Banerjee 4eb3f12797 Merge branch 'MDL-31837_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-28 17:04:19 +08:00
Aparup Banerjee 6ec3ae6f14 Merge branch 'MDL-32464_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-28 16:54:31 +08:00
Adrian Greeve 339057063c MDL-34318 - blog - Removal of blog associations from the database on delete.
Thanks to Erik Lundberg for this patch.
2012-08-28 15:54:01 +08:00
Eloy Lafuente (stronk7) b884cf2a74 MDL-35089 conditionals: detected one place missing sectioncache
Thanks to MDL-34936 and unit tests this was discovered like 2 new
places calling to get_fast_modinfo() without the sectioncache
column contents. Potential performance problem, leading to
reseting and recalculation of caches all the time.
2012-08-28 01:41:41 +02:00
Aaron Barnes f0c1bcf5a2 MDL-30020 blocks/completion: Some criteria do not display complete
Also includes a spruce up of the code
2012-08-28 11:40:37 +12:00
Eloy Lafuente (stronk7) 3860f948af Merge branch 'MDL-34406_fullname_23' of git://github.com/andyjdavis/moodle into MOODLE_23_STABLE 2012-08-27 20:03:52 +02:00
Eloy Lafuente (stronk7) 9507653269 Merge branch 'MDL-34430_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 18:51:01 +02:00
Eloy Lafuente (stronk7) 79a6a832d7 Merge branch 'MDL-34993_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 18:35:54 +02:00
Eloy Lafuente (stronk7) eec3a5d48d Merge branch 'm23_MDL-34994' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE 2012-08-27 18:20:44 +02:00
Eloy Lafuente (stronk7) e9c306f10e Merge branch 'MDL-35026_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 17:54:20 +02:00
Eloy Lafuente (stronk7) b14d76c59f Merge branch 'MDL-35003_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 17:51:24 +02:00
Eloy Lafuente (stronk7) 8f93d94ab2 Merge branch 'MDL-35023_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 16:33:39 +02:00
Eloy Lafuente (stronk7) b6cd7017c0 Merge branch 'MDL-35038_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 16:25:30 +02:00
Eloy Lafuente (stronk7) f9033600cc Merge branch 'MDL-35048_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-08-27 16:20:37 +02:00
Eloy Lafuente (stronk7) 473285edde Merge branch 'MDL-35055_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-27 16:16:46 +02:00
Aparup Banerjee 48ee721e2f Merge branch 'MDL-31633-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-08-27 17:26:41 +08:00
Rajesh Taneja acff486664 MDl-34606 Administration: id for clear button is set properly, and disabled on page load 2012-08-27 15:15:29 +08:00
Aparup Banerjee 42122854fc Merge branch 'MDL-34936-MOODLE_23_STABLE-1' of git://github.com/andrewnicols/moodle into MOODLE_23_STABLE 2012-08-27 14:20:30 +08:00
Rajesh Taneja 339c954913 MDL-34537 Enrolments: Assign alternative odd and even class to manual enrol popup 2012-08-27 14:16:06 +08:00
Aparup Banerjee 7c3fa05126 Merge branch 'MDL-34996_23' of git://github.com/grabs/moodle into MOODLE_23_STABLE 2012-08-27 13:46:50 +08:00
AMOS bot 3342bb835c Automatically generated installer lang files 2012-08-27 00:32:46 +00:00
Aaron Barnes aac67f6384 MDL-32386 completion: Fix incorrect method parameters 2012-08-27 11:19:26 +12:00
Mary Evans b710f91ed9 MDL-35048 theme_formal_white: removed p {margin:0} from style/formal_white.css which was causing a regression in some areas of theme 2012-08-26 20:49:27 +01:00
Andreas Grabs 441fa9c71d MDL-34996 - Improve help text for Feedback dependancies 2012-08-24 23:07:17 +02:00
Andreas Grabs fdc57a14bd MDL-34952 - change get_info() to public access 2012-08-24 21:55:07 +02:00
Tim Hunt a129b76cc3 MDL-32464 qformat multianswer: fix missing include.
Also, add a sample file that can be used for testing, and add a unit
test to verify this is working.
2012-08-24 16:56:52 +01:00
Andrew Robert Nicols 409eab3510 MDL-34936 Warn if the sectioncache property is missing in a get_fast_modinfo call 2012-08-24 15:40:13 +01:00
Tim Hunt 4d0a7e2b1f MDL-35055 question import: slight error with the Match grades option.
Even in the 'Error if grade not listed case', it was applying a small
tolerance. In the case of a fuzzy match, it was returning the inexact
grade from the import file, rather than the precise grade that Moodle
was expecting.

That causes problems when the editing form is displayed, because the
value from the database does not match any of the available options, so
the grade is changed to 0%.
2012-08-24 15:37:38 +01:00
Jean-Michel Vedrine cc0188c21c MDL-25492 Blackboard V6+ question import is broken. 2012-08-24 13:52:05 +02:00
Ankit Agarwal 9fc95b6558 MDL-31633 grades: Fixing incorrect redirect when trying to edit grade letters from admin settings 2012-08-24 14:59:18 +08:00
Tim Lock e24b125a3a MDL-31623 Course: Course reset bypass modules, which are removed 2012-08-24 10:59:46 +08:00
Rajesh Taneja bdbdd72cdb MDL-30121 Assignment 2.2: Draft submission files will not be included in zip, if activity is open 2012-08-24 10:54:19 +08:00
David Monllao b7da14f1c6 MDL-29598 backup Avoid possible future duplicate grade letters
More info in restore_activity_grades_structure_step->process_grade_letter() comments
2012-08-24 08:55:37 +08:00
Justin Filip 44ec173ea8 MDL-29598 backup Check whether a grade_letters record exists before trying to insert a new record 2012-08-24 08:55:37 +08:00
Tim Hunt 6009d1a32e MDL-35038 quiz reports: clarify the API changes docs.
Also re-organise the file to put the most recent changes at the top.
2012-08-23 19:15:34 +01:00
M Kassaei 99aaad063e MDL-35038 quiz reports: document the API changes in 2.3. 2012-08-23 19:15:33 +01:00
Tim Hunt 765e7564cc MDL-35026 qtype multianswer: misnamed string.
AMOS BEGIN
 MOV [questionnadded,qtype_multianswer],[questionsadded,qtype_multianswer]
AMOS END
2012-08-23 19:15:15 +01:00
Tim Hunt 07eca71195 MDL-35023 qtype calculated: fix strict syntax problem. 2012-08-23 19:14:55 +01:00
Tim Hunt 872e445a48 MDL-35003 questions: remove stray full stop after correct answer.
In a few situations, this full stop makes things a bit more grammatical,
but there are many other situations where it causes problems. So, on
balance we will remove it.
2012-08-23 19:14:38 +01:00
Tim Hunt 7f8d657531 MDL-34993 questions: convert numeric fields to float on load.
NUMBER(X,Y) typically come back from the DB as strings. If you don't
convert them to float, then when you display them, it appears as
1.0000000, which is not normally what you want.

Also, increase the size of the field on the edit form, so if you
question does have default mark 0.1234567, you can see that!
2012-08-23 19:14:19 +01:00
Tim Hunt ff43c30f0a MDL-31837 numerical tolerance: better handling of very small tolerances.
The changes between Moodle 1.9 and 2.1 made the marking of very small
answers like 10^-20 almost impossible. This change fixes it.

This fix is almost entirely due the the careful research of Pierre
Pichet, who carefully testing various proposals, and worked out that
this one seemed best.
2012-08-23 18:59:15 +01:00
Tim Hunt 35a95edba4 MDL-31244, MDL-25063 algebra filter: fix common false positives.
There are two well-known cases where the algebra filter messes up input
that is obviously not meant for the algebra filter:

1. Copy and paste of unified diffs.

2. @@PLUGINFILE@@ tokens in the HTML that are due to be replaced by the
files API.

This fix detects these two cases, and just stops the algebra filter from
replacing them.
2012-08-23 18:58:57 +01:00
Eloy Lafuente (stronk7) bac15e5782 weekly release 2.3.1+ 2012-08-23 19:25:40 +02:00
Eloy Lafuente (stronk7) 3330b54c2c Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-08-23 19:18:40 +02:00
Andrew Davis 78c2fa5cab MDL-30022 message: made the messaging history display code able to deal with multiple messages with the same timecreated value 2012-08-23 11:56:05 +08:00
AMOS bot 23bb88d28d Automatically generated installer lang files 2012-08-23 00:34:21 +00:00
Eloy Lafuente (stronk7) 4b7b1aae4d MDL-31957 Course reset: Add missing global 2012-08-23 02:12:39 +02:00
Tim Hunt 49e77191cc MDL-34430 qtype essay: upgrade from MDL-31393 needs a progress bar. 2012-08-22 22:15:36 +01:00
Jean-Michel Vedrine 9832fde1c0 MDL-34738 fix for the problem found during testing : dat files not accepted on some servers 2012-08-22 16:38:08 +02:00
Eloy Lafuente (stronk7) 364666f371 Merge branch 'MDL-34444' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-22 11:14:38 +02:00
Dan Poltawski e1269d87d4 MDL-34444 - actually display the title, just don't link it..
Don't worry, i'm going on holiday, so i'll be away from this git repo
for a while to prevent any more mess.
2012-08-22 17:10:38 +08:00
Eloy Lafuente (stronk7) a701525345 Merge branch 'MDL-34444' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-22 10:49:30 +02:00
Dan Poltawski ccce6a7e33 MDL-34444 course - don't show to 'unavaibile' sections title
Instead we just show the availability info in the index page,
this makes the navigation etc much simpler.
2012-08-22 16:40:43 +08:00
Dan Poltawski 29beeefc70 Revert "MDL-34444 course: show section availability info"
Turns out this change was just wrong, we shouldn't be allowing linking
to unaavilable sections. Just show the availability information on the
'index page'

This reverts commit 87a31bb5d8.
2012-08-22 16:37:36 +08:00
Eloy Lafuente (stronk7) 996e735693 MDL-35010 availability: fix sometimes missing fieldset 2012-08-22 09:47:44 +02:00
Eloy Lafuente (stronk7) 6c475847fb Merge branch 'MDL-34444' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-22 08:40:02 +02:00
Dan Poltawski 363b35f221 Merge branch 'w34_MDL-34864_m23_enrolcat' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-22 14:28:03 +08:00
Petr Škoda f813d99296 MDL-34864 fix role names regression 2012-08-22 08:08:24 +02:00
Dan Poltawski e03a03a4a9 Merge branch 'MDL-35000_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-22 10:32:01 +08:00
Dan Poltawski a4241511ed MDL-34870 enrol_cohort - don't need to do useless work 2012-08-22 10:03:10 +08:00
Dan Poltawski fb4e6948d0 Merge branch 'MDL-34870_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-08-22 09:52:58 +08:00
Dan Poltawski 70dc5add7d Merge branch 'MDL-34733_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-22 09:16:18 +08:00
Eloy Lafuente (stronk7) f16751f856 Merge branch 'wip-mdl-32759-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-08-22 02:34:04 +02:00
Eloy Lafuente (stronk7) 69be24a776 Merge branch 'MDL-34702_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-22 02:11:07 +02:00
Eloy Lafuente (stronk7) b74390e38b Merge branch 'MDL-34795-23' of git://github.com/srynot4sale/moodle into MOODLE_23_STABLE 2012-08-22 02:05:17 +02:00
Eloy Lafuente (stronk7) e464af4462 Merge branch 'w34_MDL-34864_m23_enrolcat' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-22 01:58:35 +02:00
Eloy Lafuente (stronk7) ea438c8d7b Merge branch 'w34_MDL-34776_m23_notinsql' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-22 01:56:06 +02:00
Eloy Lafuente (stronk7) bae745aa57 MDL-34866 whitespace fix 2012-08-22 01:50:53 +02:00
Eloy Lafuente (stronk7) 0547143fad Merge branch 'MDL-34866_23' of git://github.com/rlorenzo/moodle into MOODLE_23_STABLE 2012-08-22 01:50:19 +02:00
Dan Marsden 2b062ed6a6 MDL-34994 mod_choice: fix restore of user responses - use correct optionid 2012-08-22 09:04:35 +12:00
Eloy Lafuente (stronk7) 864ca7d700 Merge branch 'w34_MDL-34893_m23_phpunitparams' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-21 21:18:44 +02:00
Tim Hunt fa0ed51c0a MDL-35000 quiz: Complete activity report broken by bad require.
Fix the stupid error that caused this. Also, make all the other
require_once calls in the file consistent.
2012-08-21 18:03:14 +01:00
Tim Hunt d7b7aff004 MDL-34733 quiz 'secure' mode: finish review link broken in previews
Here, we use a nasty hack to fix the problem on stable branches without
an API change.
2012-08-21 12:05:52 +01:00
Juho Viitasalo 1923720566 Changed two notification to output correctly 2012-08-21 15:36:34 +08:00
Dan Poltawski 5a566ceac7 Merge branch 'MDL-34691_assign_overdue_by_23' of https://github.com/SWiT/moodle into MOODLE_23_STABLE 2012-08-21 14:37:10 +08:00
Dan Poltawski 82157094e5 Merge branch 'MDL-32705_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-21 12:37:54 +08:00
Dan Poltawski 115ad6cc9e Merge branch 'MDL-34569_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-21 12:35:14 +08:00
Dan Poltawski f6376dcbae Merge branch 'w34_MDL-34901_m23_useraccess' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-21 12:02:25 +08:00
Dan Poltawski ed22220593 Merge branch 'MDL-34742-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-21 11:59:30 +08:00
Dan Poltawski 8172f3b2d3 MDL-34808 qformat_examview - increment version 2012-08-21 11:05:58 +08:00
Dan Poltawski b02734b77d Merge branch 'MDL-34808_23' of git://github.com/jmvedrine/moodle into MOODLE_23_STABLE 2012-08-21 11:00:49 +08:00
Raymond Wijaya 8c74ab8623 MDL-34887: Add hyperlinks to names in the Assignment's grading table 2012-08-21 10:58:09 +08:00
David Monllao b16b42e9e2 MDL-31496 mod_data Replacing inline styles for CSS classes in templates and browse view 2012-08-21 10:49:03 +08:00
David Monllao d1e338c98b MDL-31496 mod_data Replacing inline styles for CSS classes in text inputs 2012-08-21 10:49:03 +08:00
David Monllao 108dd3376c MDL-31496 mod_data Replacing inline styles for CSS classes in search containers 2012-08-21 10:49:03 +08:00
David Monllao a415852d2b MDL-31496 mod_data Replacing inline styles for CSS classes in textarea elements 2012-08-21 10:49:03 +08:00
Dan Poltawski b747690361 MDL-34738 qformat_blackboard - increment version number 2012-08-21 09:55:50 +08:00
Dan Poltawski d73f22d94e Merge branch 'MDL-34738_23' of git://github.com/jmvedrine/moodle into MOODLE_23_STABLE 2012-08-21 09:42:12 +08:00
Eloy Lafuente (stronk7) 181884b480 Merge branch 'MDL-34941-MOODLE_23_STABLE' of https://github.com/mouneyrac/moodle into MOODLE_23_STABLE 2012-08-21 02:43:10 +02:00
Eloy Lafuente (stronk7) 9b7738c8fb Merge branch 'w34_MDL-34912_m23_description' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-21 02:39:58 +02:00
Eloy Lafuente (stronk7) a130109013 Merge branch 'MDL-34889_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-21 02:25:28 +02:00
Eloy Lafuente (stronk7) ac97fc2122 Merge branch 'MDL-34810_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-21 01:36:36 +02:00
Eloy Lafuente (stronk7) 9da82e9ba3 Merge branch 'MDL-29847_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-21 01:28:50 +02:00
Eloy Lafuente (stronk7) 0c6800e771 Merge branch 'MDL-31957-m23' of git://github.com/sammarshallou/moodle into MOODLE_23_STABLE 2012-08-21 01:23:05 +02:00
Eric Merrill 2d0a11ee94 MDL-34985 gradebook Fixing issue where default parent in Full View Add Category could be inconsistent.
Turns out the correct default was already computed, but was not being applied to the setting.
2012-08-20 17:13:10 -04:00
Eloy Lafuente (stronk7) 3dd2dce1cb Merge branch 'w34_MDL-34959_m23_gmapsv3' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-20 20:30:27 +02:00
Eloy Lafuente (stronk7) 1c5f24e089 Merge branch 'w34_MDL-34868_m23_gmapsv2' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-20 20:18:03 +02:00
Eloy Lafuente (stronk7) 331d346e8f Merge branch 'MDL-34756-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-20 16:35:20 +02:00
Eloy Lafuente (stronk7) 8ee474b89e Merge branch 'MDL-28531-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-20 16:28:21 +02:00
Jason Ilicic 3f7df55d1c MDL-34529: Fixed ordering of course sections when performing import/restore by adding the sort parameter. 2012-08-20 14:00:26 +02:00
Nathan Mares c6d7689621 MDL-34372: Fix query in backup_cron_helper so it works on Postgres 8.3
Amended by stronk7@moodle.org to use uppercase SQL keywords.
2012-08-20 13:28:37 +02:00
Jean-Michel Vedrine 2e941f3356 MDL-34808 load sample xml file from fixtures in tests 2012-08-20 10:47:31 +02:00
Dan Poltawski bab65024ad Merge branch 'MDL-33362-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-08-20 16:01:21 +08:00
Dan Poltawski dcf82e6079 Merge branch 'MDL-34779-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-08-20 15:59:00 +08:00
Jean-Michel Vedrine f3ad0ed27d MDL-34738 load sample dat file in tests 2012-08-20 09:52:53 +02:00
Michael de Raadt b8cc020064 MDL-34779 settings: Updating lang string corrposnding to the fullnamedisplay setting 2012-08-20 15:44:42 +08:00
Dan Poltawski fc08030d8e Merge branch 'w34_MDL-34873_m23_tagstrict' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-20 15:21:26 +08:00
Dan Poltawski 21fcca106d Merge branch 'MDL-34957_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-08-20 14:23:28 +08:00
Dan Poltawski 7bb562cdf0 Merge branch 'MDL-34937_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-20 14:19:30 +08:00
Raymond Wijaya ae21b71925 MDL-34377: Fix: assignments overview page shows a unset due date as Epoch and counts draft submissions 2012-08-20 14:11:59 +08:00
Ankit Agarwal 9ff0c0bb84 MDL-33362 book: Parse links to book modules from 1.9 backups 2012-08-20 12:59:19 +08:00
Dan Poltawski 0ec0602415 Merge branch 'MDL-34535-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-08-20 12:06:56 +08:00
Dan Poltawski e013292e25 Merge branch 'wip-MDL-31810-stable23' of git://github.com/phalacee/moodle into MOODLE_23_STABLE 2012-08-20 12:01:32 +08:00
Dan Poltawski f6aabcf0ed Merge branch 'wip-mdl-31734-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-08-20 11:57:21 +08:00
Dan Poltawski 67f0e8fe87 Merge branch 'MDL-30405-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-20 11:39:59 +08:00
Dan Poltawski 854bec4500 Merge branch 'MDL-30370_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-08-20 11:22:26 +08:00
Frederic Massart 70746c433c MDL-34756 Unit Tests: Move backup helper tests 2012-08-20 10:26:16 +08:00
Andrew Davis 39e39bd437 MDL-34406 message: removed an unnecessary string creation 2012-08-20 10:13:53 +08:00
Petr Škoda db6842cca3 MDL-34893 use standard options in Hint_ResultPrinter
This is a very nasty hack!
2012-08-19 22:10:37 +02:00
Petr Škoda 7e84ef4fea MDL-34959 add Google Maps API V3 support 2012-08-19 19:53:06 +02:00
Petr Škoda 778947cd65 MDL-34868 update deprecated Google maps API V2 key info 2012-08-19 18:21:37 +02:00
Jean-Michel Vedrine 1ff3389a54 MDL-34808 qformat examview Add phpunit tests to examview import format 2012-08-19 16:35:21 +02:00
Petr Škoda cf1cb68662 MDL-34901 fix user login times handling 2012-08-19 15:33:59 +02:00
Petr Škoda 123f7f534e MDL-34873 fix multiple E_STRICT tag related problems 2012-08-19 11:19:48 +02:00
Mary Evans c74b1ee8d9 MDL-34957 theme_base: made small change to custommenu CSS in style/core.css to fix vertical arrow overlap in menu item 2012-08-19 01:45:34 +01:00
AMOS bot 9fe39511e2 Automatically generated installer lang files 2012-08-19 00:31:36 +00:00
Petr Škoda 245197ee2d MDL-34864 bump up enrol category sync version 2012-08-18 11:48:05 +02:00
Petr Škoda 3c50224079 MDL-34864 add enrol_category unit tests for sync 2012-08-18 11:47:58 +02:00
Petr Škoda 259aecb26b MDL-34864 improve enrol_category phpdocs 2012-08-18 11:47:47 +02:00
Petr Škoda a2043a3168 MDL-34864 add verbose option to CLI enrol_category sync 2012-08-18 11:39:42 +02:00
Petr Škoda 3d7f23c5e9 MDL-34864 improve enrol_category sync performance 2012-08-18 11:39:42 +02:00
Jean-Michel Vedrine 8a8dd7d8c8 MDL-34738 qformat blackboard: blackboard format is broken 2012-08-18 10:55:26 +02:00
Petr Škoda e3a5ed9dd7 MDL-34776 improve multiple "NOT IN" enrolment and role related queries 2012-08-18 09:57:02 +02:00
Petr Škoda 71a03114e0 MDL-34912 fix invalid descriptionformat default handling 2012-08-18 09:53:03 +02:00
Tim Hunt 3e6b27698d MDL-29847 question preview: garbage collect old preview data.
This adds cron code which looks for question previews that have not been
touched for more than 24 hours, and deletes them.

We try to delete previews immediately. For example if the user clicks
start again, then we immediately delete their previous preview. However,
we can't do that if they just close the preview window. Hence we need
some cron code to clean up old preview that have got left lying around.

Normally, this code will not have much to do, so it will be very fast,
so we can afford to run it every cron.

This has been implemented in such a way that in future it will be easy
to add other cron code to the question bank.

Sadly, to make this work on MySQL, we require a horrible hack in the
already hacky delete_usage_records_for_mysql function.
2012-08-17 10:53:13 +01:00
sam marshall 40f6697f2e MDL-31957 Course reset: Does not erase activity completion data 2012-08-17 10:39:38 +01:00
Jerome Mouneyrac 7a4f9ba8e0 MDL-34941 correct timestamp range: startdate of external fct create_course PHPunit test 2012-08-17 16:15:56 +08:00
Frederic Massart d190fcd9d9 MDL-28531 Unit Tests: Fixed tests to work with core update 2012-08-17 14:45:03 +08:00
Frederic Massart 68576ef61d MDL-28531 Backup: Automated backups run when they are scheduled 2012-08-17 14:45:03 +08:00
Frederic Massart bc2289cd52 MDL-34648 Chat: No more errors when sentence begin with 'To' 2012-08-17 14:44:53 +08:00
Matt Meisberger 054bcf69f6 MDL-34742 - adding ability to move blocks into empty column 2012-08-17 14:44:23 +08:00
Rajesh Taneja a645f67aa5 MDL-31734 Course: removed unused sectiontitle string 2012-08-17 14:33:40 +08:00
Rajesh Taneja bf821575ec MDL-26492 Lesson: lesson_get_user_grades will return grade of all users if userid=0 2012-08-17 14:30:39 +08:00
Rossiani Wijaya 01dbe1fdad MDL-34569 - add label for search wiki input text 2012-08-17 11:33:40 +08:00
Rossiani Wijaya 93dbb62f45 MDL-34569 accessibility compliance for wiki module: Add label for input text and select tag 2012-08-17 11:14:03 +08:00
AMOS bot 16254fffc8 Automatically generated installer lang files 2012-08-17 00:31:50 +00:00
Tim Hunt 20d4ab97c0 MDL-34937 quiz responses reports: attempt grade not shown. 2012-08-16 21:35:44 +01:00
Tim Hunt d1755c12a0 MDL-34702 quiz DB: questiondecimalpoints has wrong default.
Thanks to the folks at UCL for tracking down this problem. It has only
hidden for 2+ years!
2012-08-16 17:35:16 +01:00
Tim Hunt 6247d0a82c MDL-34889 phpunit: progress output in util.php --drop.
It is slow for me, and it is nice to know that something is going on.
2012-08-16 17:00:25 +01:00
Tim Hunt 423030e7dc MDL-34810 question bank: user prefs for some display options
The options that are remembered persistently are
* Also show questions from sub-categories
* Also show old questions
* Show question text in the question list
* Number of questions per page
2012-08-16 16:59:59 +01:00
Eloy Lafuente (stronk7) 7033316dad weekly release 2.3.1+ 2012-08-16 17:26:25 +02:00
Eloy Lafuente (stronk7) 90231b24df Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-08-16 17:22:01 +02:00
Eric Merrill 5c57df4c9d MDL-34376 mod_assign Fixing flaw in previous commit with not defining . 2012-08-16 10:07:31 -04:00
sam marshall 1d075eadd9 MDL-34446 Fix bugs in previous commit 2012-08-16 14:48:15 +08:00
Rossiani Wijaya dc5d4f435a MDL-34563 - change string firstname to lastname and add accesshide class 2012-08-16 14:18:04 +08:00
Rossiani Wijaya 8309268b42 MDL-34563 - removed double labeling and add label for input text 2012-08-16 14:17:50 +08:00
Aparup Banerjee 19ab59bcc0 Merge branch 'MDL-34565_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-16 11:51:35 +08:00
Jason Fowler 44d24d1297 MDL-31810 - Fixing unclosed DIV tags throughout Moodle 2012-08-16 10:43:29 +08:00
Tim Hunt c4f0004a0a MDL-32705 backup ui: add select all/none JavaScript on schema screens 2012-08-15 18:10:45 +01:00
Dan Poltawski cfebb1a538 Merge branch 'MDL-34905_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-15 17:54:02 +08:00
Tim Hunt 2a077c0d1b MDL-34905 quiz: missing global $DB;
This code normally only runs when JS is disabled, which is why this was
not noticed before.
2012-08-15 10:32:56 +01:00
David Monllao 25e77f4f73 MDL-30370 mod_forum - Removing duplicate seleted field in the DB query
Credit to Iñigo Zendegi
2012-08-15 17:02:43 +08:00
Rossiani Wijaya 829f5e876a MDL-34565 - remove duplicate labeling 2012-08-15 16:24:14 +08:00
Damyon Wiese 9bdc95b702 MDL-34583: Assignment upgrade loses comments from onlinetext and offline assignment types. 2012-08-15 03:36:51 +02:00
Eloy Lafuente (stronk7) 4ee439dbc2 Merge branch 'MDL-34862_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-15 03:32:44 +02:00
Eloy Lafuente (stronk7) 91986f84c2 Merge branch 'MDL-34539' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-15 03:23:57 +02:00
Eloy Lafuente (stronk7) e154c1b6da Merge branch 'MDL-34885_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-15 03:16:39 +02:00
AMOS bot 9bf629bb64 Automatically generated installer lang files 2012-08-15 00:31:33 +00:00
Eloy Lafuente (stronk7) 833e135533 Merge branch 'MDL-25347_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-08-15 02:04:10 +02:00
Sam Hemelryk 36e6961fa4 Merge branch 'MDL-33640_23' of git://github.com/MaxThrax/moodle into MOODLE_23_STABLE 2012-08-15 11:48:27 +12:00
Sam Hemelryk a9c8c1c951 Merge branch 'MDL-33531_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-08-15 11:22:08 +12:00
Dan Poltawski 02d8fb146d MDL-29192 - clarify email_to_user call 2012-08-15 01:17:32 +02:00
Eloy Lafuente (stronk7) 6c20303ee1 Merge branch 'w33_MDL-34782_m23_mysqlunsigned' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-14 23:10:24 +02:00
Eloy Lafuente (stronk7) 12445b37fc Merge branch 'MDL-34829' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-14 22:55:56 +02:00
Eloy Lafuente (stronk7) 428b30ce5e Merge branch 'MDL-34783-MOODLE_23_STABLE-1' of git://git.luns.net.uk/moodle into MOODLE_23_STABLE 2012-08-14 22:45:34 +02:00
Rex Lorenzo 90c510cf9d MDL-34866 - Make "course display" default a site configurable option
* Moved COURSE_DISPLAY_SINGLEPAGE and COURSE_DISPLAY_MULTIPAGE constants from courselib to moodlelib.php
* Using course display constants in course default admin setting page
2012-08-14 12:12:47 -07:00
Tim Hunt ba338db5b5 MDL-34885 phpunit: better cygwin detection.
For some reason, on my computer, $_SERVER['SHELL'] was not set, so I
changed the test to also consider $_SERVER['TERM']. This now works for
me.
2012-08-14 14:12:06 +01:00
Aparup Banerjee 38ace2266f Merge branch 'wip-MDL-34748-MOODLE_23_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_23_STABLE 2012-08-14 15:30:03 +08:00
Ankit Agarwal 8e017950e9 MDL-34535 message: userto should use is_number instead of is_init 2012-08-14 14:42:11 +08:00
Aparup Banerjee 69e0f5049f Merge branch 'MDL-34563_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-14 14:34:43 +08:00
Rossiani Wijaya 1f65a01980 MDL-34563 - change plural strings and removed colon for accesshide label 2012-08-14 13:58:23 +08:00
Aparup Banerjee 37fbfb0dda Merge branch 'MDL-34565_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-14 13:53:34 +08:00
Dan Poltawski b92d962c3f Merge branch 'MDL-34728_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-14 13:33:08 +08:00
Dan Poltawski 9a77ed006f Merge branch 'MDL-34793_m23' of git://github.com/merrill-oakland/moodle into MOODLE_23_STABLE 2012-08-14 13:25:38 +08:00
Eric Merrill 2a5378d2c6 MDL-34793 mod_assign Fix rendering error that causes student view to break in some cases.
When feedback is switched on for a assignment, and the teacher enters a grade through the gradebook, the student
view would become broken, throwing a coding error. Added check that $status->grade is not empty before passing
to assign_feedback_XXX::is_empty(), as that function expects an object.
2012-08-14 00:40:55 -04:00
Adam Olley 6353a60ed3 MDL-34870: Prevent cohort enrol sync when updating course record 2012-08-14 13:58:41 +09:30
Dan Poltawski e85500a8bf Merge branch 'MDL-34807_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-14 12:08:04 +08:00
Rajesh Taneja d54294de34 MDL-32759 Assignment: Grades will not be scaled for new assignment module, and added warning message for user 2012-08-14 11:40:18 +08:00
Rajesh Taneja b5cbe52bfc MDL-32759 Assignment 2.2: Changing grade for existing assignments will show warning that grades will not be scaled 2012-08-14 11:40:18 +08:00
Dan Poltawski 894446f7fd MDL-34539 course - allow negative section numbers
This gives course format authors more flexibility.

Thanks to Itamar Tzadok for the suggestion.
2012-08-14 11:34:19 +08:00
Rex Lorenzo 5b918d0101 MDL-34866 - Make "course display" default a site configurable option 2012-08-13 16:26:01 -07:00
Aaron Barnes 25e107e5a2 MDL-34795 completion: Add course_completed event 2012-08-14 10:16:40 +12:00
Tim Hunt 94dd25e03b MDL-34862 question preview: improve preview ownership check.
Users should only be able to access their own quetion preview. In the
past, for reasons I can no longer remember, this was enforced
using the session. It is much better to set the question_usage to belong
to the user's context.
2012-08-13 17:44:17 +01:00
Tim Hunt 0a571db22b MDL-34807 question bank: navigation loses place.
The symptom is that where we are now is not shown in the settings
navigation. However, the underlying cause is that question/edit.php is
doing some crazy thing of its own to build $PAGE->url, rather than using
the one returned by question_edit_setup.

Not that this patch itentionally removes the returnurl param. It was
added as part of a big change MDL-20276, which I think just got this
detail wrong. That variable is never used.
2012-08-13 11:29:43 +01:00
Tim Hunt 3350475e36 MDL-34728 forms: woy for other JS to trigger disableIf update.
This was discovered while working on MDL-32705. If some JavaScript (for
example a select all/none link) changes the state of some form fields,
then the disabledIf state of other form elements does not automatically
update.

The existing form JS was so well encapsulated that this was impossible.
This change pokes a hole in the encapsulation, and provides an API
    M.form.updateFormState(formid);
that other bits of JS code can call when necessary.
2012-08-13 11:19:01 +01:00
Rossiani Wijaya ee53ceb3eb MDL-34563 accessibility compliance for data module: Add forform input text and select tag 2012-08-13 15:13:54 +08:00
Rossiani Wijaya 33222ed24a MDL-34565: change to plural strings 2012-08-13 15:12:00 +08:00
Rossiani Wijaya 37102468f7 MDL-34565 accessibility compliance for forum module: Add forform input text and select tag 2012-08-13 15:12:00 +08:00
Marina Glancy ff21775823 MDL-34748 repository_filesystem: Sort files by title by default 2012-08-13 11:57:55 +08:00
sam marshall c5cf1bc090 MDL-34446 Completion report: Add sideways text support to more browsers 2012-08-13 10:44:28 +08:00
Dan Poltawski 78a4cef1e7 Merge branch 'MDL-34376_m23' of git://github.com/merrill-oakland/moodle into MOODLE_23_STABLE 2012-08-13 10:33:16 +08:00
Dan Poltawski abef93f5c9 Merge branch 'MDL-34835_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-08-13 10:20:27 +08:00
Dan Poltawski a572657497 Merge branch 'MDL-34543_m23' of git://github.com/merrill-oakland/moodle into MOODLE_23_STABLE 2012-08-13 10:03:47 +08:00
AMOS bot d077d1a024 Automatically generated installer lang files 2012-08-11 00:31:30 +00:00
Mary Evans d8ceb62387 MDL-34835 theme_fusion: fixed displaced navbar by extending #region-header.inside bottom margin by 70px in style/pagelayout.css 2012-08-10 20:31:57 +01:00
Petr Škoda bd3306f5cd MDL-34782 detect code abusing integer limits in mysql database
It is allowed to store only ranges specified in install.xml, for integers it means number of digits specified in size.
2012-08-10 10:20:27 +02:00
Dan Poltawski ef38e70c41 MDL-34829 course - allow directly linked sections to work.
Even if not in single section mode.
2012-08-10 14:19:45 +08:00
David Monllao 15343304d2 MDL-25347 blog Checking association capability at course and module levels instead of system level 2012-08-10 08:48:57 +08:00
David Monllao 3de32f8558 MDL-33531 backup Added format_string to course shortname 2012-08-10 08:40:18 +08:00
David Monllao 4af5c4ebf5 MDL-33531 backup Avoiding possible Notice 2012-08-10 08:40:18 +08:00
Lorenzo Nicora 203e8d4032 MDL-33531 Fixed the regexp to find old backup files, considering backup_shortname backup option 2012-08-10 08:40:18 +08:00
AMOS bot e9a743d385 Automatically generated installer lang files 2012-08-10 00:31:47 +00:00
Eloy Lafuente (stronk7) e6aac11d94 weekly release 2.3.1+ 2012-08-09 20:51:56 +02:00
Eloy Lafuente (stronk7) 8ff9b91e9f Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-08-09 20:46:02 +02:00
Tim Hunt 4c0d64860a MDL-34590 javascript-static: nuclear option in openpopup
I think we have finally tamed Chrome on all platforms. (Crosses fingers.)
2012-08-09 17:17:36 +02:00
AMOS bot 081889f26b Automatically generated installer lang files 2012-08-09 00:31:36 +00:00
Paul Nicholls 55c91c8760 MDL-33640 - change $templatesinitialized to an array; improve naming and automate use of template
* $templatesinitialized is now an array, so that subsequent calls to initialise_filepicker which request different repositories will include those (and only those) templates which it requires but have not yet been included
* The get_template method has also been renamed to get_upload_template (and the template to "uploadform_" followed by the repository type), since it only applies to upload forms
* If a plugin provides a get_upload_template method, the template it returns will now automatically be used instead of the standard uploadform template when generating an upload form
2012-08-09 09:43:53 +12:00
Eric Merrill 383639a5ef MDL-34376 mod_assign Omit assigns with no due date from print_overview.
Modify assign_print_overview to omit assigns that have no due date set, in line with behaviour
in 2.2 and other tools.
2012-08-08 10:05:19 -04:00
Andrew Robert Nicols 55a2b03ef1 MDL-34783 Retrieve the sectioncache parameter for enrolled courses in the course_overview block
The sectioncache field is used by course_modinfo and without it, the
modinfo cache is repeatedly reset.
2012-08-08 10:54:24 +01:00
Dan Poltawski f37cd67ded Merge branch 'MDL-34575_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-08 12:33:40 +08:00
Paul Nicholls c258605a8d MDL-33640 - Add ability to use custom filepicker templates
Allow repository plugins to register a template by defining a get_template() method, coupled with the ability to request the template be used by create_upload_form() instead of the standard 'uploadform' template.  The template is automatically registered using the plugin's name, and core templates will override any which clash; this also means that a theme can override these templates in a custom renderer if it wants to.
2012-08-08 15:54:42 +12:00
Rossiani Wijaya 25f8e4f241 MDL-34575: fixed string typo and string duplication for label 2012-08-08 11:37:40 +08:00
Dan Marsden 8dc49e14c4 MDL-34656 prevent login form from being shown inside iframe - also prevent wantsurl from being set to loadsco.php which isn't a valid page for initial load. 2012-08-08 02:00:23 +02:00
Eloy Lafuente (stronk7) 7abe8c31a6 Merge branch 'MDL-34704_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-08 01:53:22 +02:00
Eloy Lafuente (stronk7) 02d6791d05 Merge branch 'wip-mdl-30792-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-08-08 01:00:54 +02:00
Charles Fulton ed10bfb2b0 MDL-32023 wiki: remove hard-coded edit string 2012-08-08 00:29:07 +02:00
Charles Fulton c86262ed73 MDL-29129 wiki: fix a hardcoded string 2012-08-07 23:59:17 +02:00
Eric Merrill 4c60068485 MDL-34543 mod_assign Fixing problem where previous feedback does not populate when you re-enter the grading view. add_plugin_grade_elements() was expecting grade object, but was being given grade string. 2012-08-07 10:21:28 -04:00
Tim Hunt 57f9291b23 MDL-34727 restore UI: use checkboxes for userdata.
It was using select menus for the convenience of the code, but the
inconvenience of users.

The way this fix is done is a bit hacky, but it works, makes users'
lives much better, but it would be good if someone would dehackify
this in the future.
2012-08-07 11:38:41 +01:00
Aparup Banerjee e203643539 Merge branch 'm23_MDL-33942' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE 2012-08-07 15:58:25 +08:00
Aparup Banerjee 5b74170932 Merge branch 'MDL-34566_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 15:07:51 +08:00
Aparup Banerjee 16daaa05b6 Merge branch 'MDL-34564_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 14:57:54 +08:00
Aparup Banerjee b21388d6db Merge branch 'MDL-34560_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 14:45:46 +08:00
Aparup Banerjee 16a8d4d4ba Merge branch 'MDL-34559_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 14:37:05 +08:00
Aparup Banerjee e83629096b Revert "Merge branch 'MDL-28531-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE"
This reverts commit 162510801f, reversing
changes made to 5af69f5282.
2012-08-07 14:27:55 +08:00
Aparup Banerjee 162510801f Merge branch 'MDL-28531-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-07 13:58:15 +08:00
Rossiani Wijaya 74b83c18fb MDL-34559: removing accesshide class 2012-08-07 13:36:43 +08:00
Aparup Banerjee 5af69f5282 Merge branch 'MDL-34715-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-07 10:42:11 +08:00
Dan Poltawski ec28569e5c Merge branch 'MDL-34562_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 10:16:50 +08:00
Dan Poltawski 1089612634 Merge branch 'MDL-34567_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-07 10:03:18 +08:00
Aparup Banerjee 04e428f9ae Merge branch 'MDL-22663-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-07 10:00:49 +08:00
Aparup Banerjee b418329b7d Merge branch 'MDL-33022' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-07 09:23:48 +08:00
Dan Poltawski 6f74e5b2f6 Merge branch 'wip-MDL-34669-MOODLE_23_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_23_STABLE 2012-08-07 08:48:38 +08:00
Dan Poltawski ebc5b65ab3 MDL-34600 upgrade.php - fix trailing whitespace 2012-08-07 08:43:07 +08:00
Petr Škoda b97532dd8e MDL-34600 fix question table to match install.xml
The oldquestiontextformat was used during previous upgrade and is not necessary any more.
Next time we should add these temporary upgrade columns to install.xml files.
2012-08-07 08:43:06 +08:00
AMOS bot d8ff3aae9f Automatically generated installer lang files 2012-08-07 00:31:55 +00:00
Tomasz Muras 9881439068 MDL-31753 Get correct course ID for Community finder search link. 2012-08-07 02:13:44 +02:00
Eloy Lafuente (stronk7) 9064a9af71 Merge branch 'w32_MDL-34601_m23_wikischema' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-06 21:16:50 +02:00
Kirill Astashov 5f2f276f82 MDL-34669: Fix editor filepicker context bt trying to use page context 2012-08-06 16:58:44 +08:00
Aparup Banerjee 1e778228a8 Merge branch 'MDL-31599-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-06 16:43:55 +08:00
Aparup Banerjee b42abe0ffc Merge branch 'MDL-34716' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-08-06 16:38:04 +08:00
Rossiani Wijaya 2ab9801b19 MDL-34562 accessibility compliance for chat module: Add <label> for input text and select tag 2012-08-06 16:26:28 +08:00
Dan Poltawski f70df26e40 Merge branch 'MDL-34561_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 15:49:12 +08:00
Rossiani Wijaya ac1bbfa1cd MDL-34561 accessibility compliance for assignment module: add accesshide class 2012-08-06 15:07:52 +08:00
Dan Poltawski 6faa04b522 Merge branch 'MDL-34707_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-06 14:42:13 +08:00
Charles Fulton cf162f9332 MDL-34629 wiki: convert default format value during restore 2012-08-06 14:19:45 +08:00
Dan Poltawski e0a555a3a3 Merge branch 'MDL-34561_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 14:08:54 +08:00
Dan Poltawski 0e5acac2d8 Merge branch 'MDL-25983_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-08-06 13:52:55 +08:00
Dan Poltawski efff50c096 Merge branch 'MDL-34259-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-06 12:21:41 +08:00
Dan Poltawski e1bc047bdb Merge branch 'MDL-34574_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 12:12:29 +08:00
Dan Poltawski ea22072a62 MDL-34575 lang/notes: reorder string to be alphabetical 2012-08-06 12:09:07 +08:00
Dan Poltawski 824dfb24bd Merge branch 'MDL-34575_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 12:06:40 +08:00
Dan Poltawski 00cb41c2ba Merge branch 'MDL-34558_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 11:54:09 +08:00
Dan Poltawski 61e520aefc Merge branch 'MDL-34557_accessibility_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-08-06 11:49:51 +08:00
Dan Poltawski f7cecf982f Merge branch 'MDL-34705_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-06 11:31:38 +08:00
Dan Poltawski a767fce382 Merge branch 'w32_MDL-34635_m23_selfwelcommultilang' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-06 11:29:30 +08:00
Dan Poltawski cfe10a4698 Merge branch 'MDL-28207-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-08-06 10:40:40 +08:00
Dan Poltawski 01672d5de5 Merge branch 'MDL-34590_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-08-06 10:11:24 +08:00
Dan Poltawski 65e06b77a8 Merge branch 'MDL-34405_m23' of git://github.com/kordan/moodle into MOODLE_23_STABLE 2012-08-06 10:06:24 +08:00
Dan Poltawski 7c4bfa5ec7 Merge branch 'w32_MDL-34585_m23_blogfiles' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-08-06 09:45:56 +08:00
Dan Poltawski d939a4dec8 MDL-28486 - tests: fix broken youtube tests 2012-08-06 09:27:55 +08:00
Sam Hemelryk f52c5f8b6a Merge branch 'MDL-34708_m23' of git://github.com/nebgor/moodle into MOODLE_23_STABLE 2012-08-06 12:05:08 +12:00
Sam Hemelryk a34c42bd5e Merge branch 'MDL-28486-MOODLE_23_STABLE-1' of git://git.luns.net.uk/moodle into MOODLE_23_STABLE 2012-08-06 11:58:45 +12:00
Sam Hemelryk 98aa996a00 Merge branch 'MDL-34658-23' of git://github.com/grabs/moodle into MOODLE_23_STABLE 2012-08-06 11:44:24 +12:00
Andreas Grabs 5f152b5c90 MDL-34670 - undefined variable in feedback templates 2012-08-06 11:36:56 +12:00
Sam Hemelryk 3d84e69328 Merge branch 'MDL-34645_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-08-06 11:04:57 +12:00
Sam Hemelryk 9d705d4901 Merge branch 'MDL-34647_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-08-06 10:58:44 +12:00
Aparup Banerjee 2018163468 MDL-34708 Forms library : Fixed incorrect calendar day displayed across timezones. Credit to Matthew Davidson and team at rose-hulman.edu. 2012-08-05 23:32:17 +08:00
Rossiani Wijaya 142b18a835 MDL-34560 accessibility compliance for message: Add label for input text and select tag 2012-08-04 17:03:39 +08:00
AMOS bot abdc9e17fa Automatically generated installer lang files 2012-08-04 00:31:59 +00:00
Tim Hunt e071bc1aa4 MDL-34704 couse, accesslib: improve $CFG->courselistshortnames
1. get_context_name should respect the $CFG->courselistshortnames
setting.

2. When $CFG->courselistshortnames is on, what to display should use a
language string, rather than string concatenation. This makes it
possible for people to configure the display. For example, they might
want 'My first course [M101]' instead of 'M101 My first course'.
2012-08-03 14:43:30 +01:00
Tim Hunt 2963abadf9 MDL-34590 javascript-static: full-screep popups for Chrome.
I have left in both:
1. the code to get the window size correct initially, becuase that seems
sensible; and
2. the subsequent resize (with the setTimeout that Chrome requires,
thanks Jeff Rader for finding that) becuase on Chrome, it gets the size
a bit too big initially, so this correction is necessary.
2012-08-03 13:21:44 +01:00
Andreas Grabs 4d8138c96a MDL-34658 - Saving failed because missing or false values 2012-08-03 12:01:21 +02:00
AMOS bot 7a0664fbb4 Automatically generated installer lang files 2012-08-03 11:45:29 +02:00
Dan Poltawski e1d2c7452b MDL-34716 outcomes: Fix admin tree location 2012-08-03 16:06:54 +08:00
Frederic Massart a602649f8f MDL-22663 Repository: WebDAV supports Digest authentication 2012-08-03 14:03:20 +08:00
Frederic Massart 85a9d23d91 MDL-22663 Repository: WebDAV supports SSL and chunked data 2012-08-03 13:55:07 +08:00
Frederic Massart 3f995bef7a MDL-22663 Repository: Fixed strict standards notices in WebDAV lib 2012-08-03 13:55:01 +08:00
Rossiani Wijaya 1445fd1337 MDL-34575 accessibility compliance for notes: Add form input text and select tag 2012-08-03 13:36:27 +08:00
Rossiani Wijaya 0f9992ca66 MDL-34574 accessibility compliance for mymobile theme: Add forform input text and select tag 2012-08-03 12:01:50 +08:00
Rossiani Wijaya 08e03a695a MDL-34566 accessibility compliance for glossary module: Add forform input text and select tag 2012-08-03 12:01:43 +08:00
Rossiani Wijaya 077e06f621 MDL-34567 accessibility compliance for lesson module: Add forform input text and select tag 2012-08-03 12:01:43 +08:00
Rossiani Wijaya d0d9c135e1 MDL-34564 accessibility compliance for feedback module: Add forform input text and select tag 2012-08-03 12:01:41 +08:00
Rossiani Wijaya 519adbc684 MDL-34561 accessibility compliance for assignment module: Add forform input text and select tag 2012-08-03 12:01:38 +08:00
Rossiani Wijaya aa15bd56d6 MDL-34559 accessibility compliance for grade: Add forform input text and select tag 2012-08-03 12:01:36 +08:00
Rossiani Wijaya f81c3a32f0 MDL-34558 accessibility compliance for filter: Add forform input text and select tag 2012-08-03 12:01:35 +08:00
Rossiani Wijaya daeee0afae MDL-34557 accessibility compliance for enrol: Add forform input text and select tag 2012-08-03 12:01:34 +08:00
Rajesh Taneja 6ecbacac00 MDL-30792 Files API: Cleaner approach to get maxbytes size in filepicker 2012-08-03 11:36:38 +08:00
Rajesh Taneja d3e1371030 MDL-30792 Files API: maxbytes will be set by get_max_upload_file_size if less then 0 or greater then max moodle limit 2012-08-03 11:36:32 +08:00
Frederic Massart e9ec895d92 MDL-28531 Backup: Automated backups run when they are scheduled 2012-08-03 09:30:27 +08:00
Frederic Massart 6ce946c561 MDL-34259 Lesson: True/false questions don't break on missing answer 2012-08-03 09:23:23 +08:00
Frederic Massart 84af4013c1 MDL-28207 Course: Showing/hiding/marking a section respect capabilities 2012-08-03 09:21:29 +08:00
Tim Hunt 7d45268bc6 MDL-34707 backup UI: only include the JS once. 2012-08-02 18:48:03 +01:00
Tim Hunt 46c770079d MDL-34705 role assignments list: should link to contexts.
This will make Admin's lives a bit easier.
2012-08-02 18:15:50 +01:00
Petr Škoda 3a933cdf10 MDL-34585 fix broken blog file access control 2012-08-02 09:58:50 +02:00
Petr Škoda 137bd7a8b5 MDL-34601 drop legacy wiki upgrade tables
Next time please keep db in sync with install.xml at all times.
2012-08-02 09:56:05 +02:00
Dan Marsden 605d6ffcf4 MDL-33942 Grading method: Marking Guide - check for $cm before using - may not exist if the course is being deleted. 2012-08-02 19:51:24 +12:00
Petr Škoda 56eda1f10a MDL-34635 support multilang in self enrol course welcome message
Includes also new help string for the custom multilang placeholders by Helen Foster.
2012-08-02 09:39:20 +02:00
David Monllao 4a5e1f9d4b MDL-25983 enrol_imsenterprise Importing the course summary when adding new courses 2012-08-02 15:34:42 +08:00
Dan Poltawski 02814bfc18 weekly release 2.3.1+ 2012-08-02 14:38:49 +08:00
Dan Poltawski 709efab527 MDL-31599 block_news - incorrect RSS feed for guest user
Was previously using the userid 0, rather than guest to use
authenticated RSS feed.

Thanks to Paul Verrall at LUNS for helping me debug this.
2012-08-02 11:11:29 +08:00
Dan Marsden c91dc553e5 MDL-33022 mod_form: set correct groupid when editing an existing post 2012-08-02 10:47:23 +08:00
Matt Switlik 8b9416de53 MDL-34691 assign: Time remaining "Assignment is overdue" was incorrectly being displayed when a student viewed a submitted assignment after the due date. 2012-08-01 17:07:02 -04:00
Petr Škoda b093fd5e5a MDL-34368 fix another validuntil condition 2012-08-01 15:06:55 +08:00
Dan Poltawski 4486aa99be MDL-34444 course: Dont display links to hidden sections
This is what happens when you dont use the navigation api
2012-08-01 10:31:46 +08:00
Dan Poltawski 87a31bb5d8 MDL-34444 course: show section availability info
When available, rather than a capability error.
2012-08-01 10:31:16 +08:00
Sam Hemelryk 90105eb95a Merge branch 'MDL-34534-MOODLE_23_STABLE' of https://github.com/micaherne/moodle into MOODLE_23_STABLE 2012-08-01 13:21:03 +12:00
Dan Poltawski 06d38548b1 MDL-34599 mod_quiz: optional $thispage & $nextpage
The previous change making the params required was a regression.
2012-08-01 09:06:54 +08:00
Charles Fulton b44ae5fb0a MDL-29909 wiki: do not show groups when no groups present 2012-08-01 12:40:02 +12:00
Dan Poltawski 633ed1edae Merge branch 'MDL-32791_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-31 17:46:20 +08:00
Dan Poltawski 07cf0887fd Merge branch 'MDL-34599_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-31 17:42:50 +08:00
Rossiani Wijaya 0fa95a3c97 MDL-34556 accessibility compliance for course: Add forform input text and select tag 2012-07-31 17:17:15 +08:00
Rossiani Wijaya 81ff28e7e6 MDL-34555 accessibility compliance for calendar: Add forform input text and select tag 2012-07-31 17:11:06 +08:00
Rossiani Wijaya 8291579200 MDL-34554 accessibility compliance for blocks: Add forform input text and select tag 2012-07-31 17:05:13 +08:00
Rossiani Wijaya 61e3665a15 MDL-34553 accessibility compliance for authentication: Add forform input text and select tag 2012-07-31 16:55:38 +08:00
Rossiani Wijaya 4233aac1e3 MDL-34552 accessibility compliance for admin: Add forform input text and select tag 2012-07-31 16:34:22 +08:00
Andrew Robert Nicols 548b7112a2 MDL-28486 Force use of SSL for all youtube and vimeo embeds
If a page is served over SSL (https), then any content loaded from non-SSL
sources (e.g. http://youtube.com/) will cause errors to show in the
browser. To prevent this, it's best to use the SSL equivelants where they
exist (e.g. https://youtube.com/).

Unfortunately, it isn't possible to accurately determine whether the
current page is loaded over an SSL connection or not in Moodle.

Since including content from an external SSL site on a non-SSL moodle page
does not lead to browser warnings, but non-SSL external content on an SSL
moodle page does, we always use SSL where available.

Note: This does not lead to any additional processing requirements for the
moodle site.
2012-07-31 09:27:00 +01:00
Aparup Banerjee 971937e7d0 MDL-34650 added MDLs to todo comment and deprecation comment.
(also triggering an amos script here for the other MDL-34650 commit)

AMOS BEGIN
  CPY [minute,form],[minute,core]
  CPY [month,form],[month,core]
  CPY [options,editor],[options,core]
  CPY [selectacourse,backup],[selectacourse,core]
AMOS END
2012-07-31 15:40:07 +08:00
Aparup Banerjee 28557dc456 MDL-34650 typo correction 2012-07-31 13:23:55 +08:00
Aparup Banerjee 4a5780ffde Merge branch 'MDL-34650_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-31 13:20:24 +08:00
Sam Hemelryk acb533009f Merge branch 'MDL-34528_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-31 16:49:31 +12:00
Sam Hemelryk 3c3cf6daac Merge branch 'MDL-32499_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-31 16:29:51 +12:00
Sam Hemelryk fe2ff1e8a0 Merge branch 'MDL-32931_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-31 16:18:50 +12:00
Sam Hemelryk dddd0d7a38 Merge branch 'MDL-32827-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-07-31 16:15:59 +12:00
Rossiani Wijaya 2a336b5ef1 MDL-34650 - accessibility compliance: Add <label> for form input text and select tag 2012-07-31 12:09:18 +08:00
Dan Poltawski 1de0c00eb6 Merge branch 'MDL-25953-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-31 12:01:56 +08:00
Ankit Agarwal 669f274735 MDL-32827 calendar: update eventtype of broken event in bulk instead of doing it one by one 2012-07-31 11:24:15 +08:00
Dan Poltawski 3fb4392ee0 Merge branch 'MDL-34624_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-31 11:10:36 +08:00
Dan Poltawski 8bf442dc73 Merge branch 'MDL-34532_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-31 10:43:10 +08:00
Dan Poltawski 472b9a46ab Merge branch 'MDL-34255_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-31 10:31:49 +08:00
Jerome Mouneyrac 1b158ee8c9 MDL-33869 user_get_user_details: add support for 'Show user identity' fields set by administrator 2012-07-31 10:26:22 +08:00
Crafton Williams 2a3a22a46d MDL-33869 user_get_user_details: allow return of idnumber 2012-07-31 10:25:21 +08:00
Dan Poltawski 89babfaefa Merge branch 'm23_MDL-34440' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE 2012-07-31 10:07:05 +08:00
Adam Olley 5aba3d6df9 MDL-34647: admintool: uploaduser enrolments now obey enrolperiod directive 2012-07-31 11:36:57 +09:30
Adam Olley 10813a0c78 MDL-34645: enrol_manual: enrolment init to pass default duration setting 2012-07-31 11:10:41 +09:30
Dan Poltawski c04ddf28f8 Merge branch 'MDL-34483_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-31 09:12:23 +08:00
Sam Hemelryk d4533f6215 Merge branch 'MDL-34494_m23' of git://github.com/kordan/moodle into MOODLE_23_STABLE 2012-07-31 12:43:32 +12:00
Sam Hemelryk eec3d1869d Merge branch 'MDL-28568_noncontact_warning_23' of git://github.com/andyjdavis/moodle into MOODLE_23_STABLE 2012-07-31 12:00:42 +12:00
Tim Hunt 0b7dfe12ed MDL-34483 qformat_examview: Commit example file.
Supplied by Rick Jerz.
2012-07-30 11:57:29 +01:00
Fred Woolard 7ae8f60489 MDL-34440 Site registration failing with mysqli 2012-07-30 20:06:22 +12:00
Dan Poltawski 46895999f0 Merge branch 'mdl34368' of https://bitbucket.org/ngmares/moodle into MOODLE_23_STABLE 2012-07-30 15:49:12 +08:00
Dan Poltawski b700c34f14 Merge branch 'MDL-34507-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-30 14:04:54 +08:00
Dan Poltawski 1ab970d492 Merge branch 'MDL-34589_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-30 13:55:50 +08:00
Nadav Kavalerchik db8e600a23 MDL-34513 - RTL Theme fixes for Moodle 2 (theme/mymobile)
+ Right align frontpage course list
+ right align activity and resource titles
+ Two Columns on/off slider fix
+ Right align content in Blocks
+ Fix checkbox question types in quiz
+ Right align titles of fields in Forms
+ minor ui tweaks
2012-07-30 13:52:58 +08:00
Dan Poltawski c5b133f790 Merge branch 'MDL-33537_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-30 13:46:33 +08:00
Dan Poltawski acbbf4157d Merge branch 'w31_MDL-34538_m23_validatefloats' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-30 12:35:10 +08:00
Dan Poltawski af433c5b52 Merge branch 'MDL-31509_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-30 12:15:49 +08:00
Andrew Robert Nicols ca4548c1c2 MDL-34433 Check for existence of e and e.target in set_form_changed
This is required for cases when code directly calls set_form_changed as
happens with the filepicker.
2012-07-30 12:09:50 +08:00
Dan Poltawski 7c52ee5027 Merge branch 'wip-mdl-34239-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-30 12:05:25 +08:00
Dan Poltawski 6fe575509e Merge branch 'MDL-34519_23_course_reset_patch' of git://github.com/rlorenzo/moodle into MOODLE_23_STABLE 2012-07-30 11:57:41 +08:00
Mary Evans f785edd9e2 MDL-34528 theme_canvas: Removed redundent exclude stylesheet configurations from CANVAS theme 2012-07-29 21:42:04 +01:00
kordan dacc63f1ae MDL-34494 theme_formal_white: replaced old style core_renderer::MAIN_CONTENT_TOKEN with $OUTPUT->main_content() 2012-07-29 16:40:29 +02:00
kordan 899fe64867 MDL-34405 theme_formal_white: added background for quiz overview 2012-07-29 15:59:54 +02:00
Mary Evans 0e3c86746f MDL-34624 theme_base: added background-color to style/admin.css for role edit default 2012-07-29 14:54:00 +01:00
Tim Hunt d1d989ce13 MDL-31509 quiz outcomes: let people associate quizzes with outcomes.
The quiz does not really support outcomes, but even so in 1.9 you could
select outcomes on the quiz edit form, and apparently this was useful to
some people, therefore we should re-enable it.
2012-07-27 18:09:49 +01:00
Petr Škoda 009933e28c MDL-34538 fix PARAM_FLOAT validation 2012-07-27 18:45:43 +02:00
Petr Škoda f2fd3f3138 MDL-34538 add float validation tests 2012-07-27 18:45:43 +02:00
Tim Hunt de53bada57 MDL-32791 quiz db: clean up garbage data that was causing problems.
Melinda Kraft reported having rows in their quiz_question_instances
table which caused various problems. These rows are meaningless, so I
have done a DB upgrade step to clean them up, which should deal with the
bad side-effets they were causing.
2012-07-27 16:45:04 +01:00
Jean-Michel Vedrine e3f79e9347 MDL-34483 qformat_examview: handle more questions.
These fixes come from testing with the example file supplied by Rick
Jerz.
2012-07-27 12:20:13 +01:00
Jean-Michel Vedrine 0940ba1f16 MDL-34483 qformat_examview: clean the code to make codechecker happy 2012-07-27 12:20:11 +01:00
Jean-Michel Vedrine 53f2f306dd MDL-34483 qformat_examview: changes required to make it basically work. 2012-07-27 12:20:10 +01:00
Tim Hunt a361ff5645 MDL-34599 quiz attempts: more robust if page number out of range.
Rather than throwing an exception, we should just show the first/last
page of the quiz if the page number is out-of-range.
2012-07-27 11:43:40 +01:00
Rajesh Taneja def687a6a2 MDL-34239 Blog: Editing blog associated with module will be keep it's association 2012-07-27 14:01:47 +08:00
Ankit Agarwal 41499f832b MDL-32827 calendar: Bumping the version 2012-07-27 11:50:37 +08:00
Ankit Agarwal 0bdf18a7c9 MDL-32827 calendar: Added logic to handle calendar events with empty eventtypes during restore 2012-07-27 11:49:20 +08:00
Ankit Agarwal fcda7dbb89 MDL-32827 calendar: Fixining calender entries with no eventtype 2012-07-27 11:47:50 +08:00
Frederic Massart df9b10e10a MDL-25953 Repository: Amazon S3 supports sub directories 2012-07-27 10:52:16 +08:00
Frederic Massart b3b35530f9 MDL-25953 Repository: Updated Amazon S3 library 2012-07-27 10:52:16 +08:00
Frederic Massart 9480023733 MDL-34507 Repository: Better support for 'any' accepted filetypes 2012-07-27 10:16:30 +08:00
David Monllao e8790310bb MDL-32931 mod_forum Polishing patch and taking into account courses without previous accesses 2012-07-27 09:23:18 +08:00
Tom Lanyon 3b6573536c MDL-32931 mod_forum Change forum overview to avoid use of (potentially large and slow ) log table. 2012-07-27 09:23:18 +08:00
David Monllao 2011579b26 MDL-32499 gradingform_rubric Avoid backup/restore of rubric fillings without an existing criteria 2012-07-27 09:22:02 +08:00
Tim Hunt 59b983a5d9 MDL-34589 quiz report graphs: PHP5.4 issue with unset($array[$float]).
Thanks to Matthew Davidson for diagnosing the problem.
2012-07-26 18:55:17 +01:00
Tim Hunt 40ae563bee MDL-34532 quiz reports: error when showing users without attempts.
We were not checking if attempt state was null before trying to convert it to a string.
2012-07-26 10:09:45 +01:00
Aparup Banerjee 6975216336 weekly release 2.3.1+ 2012-07-26 14:25:58 +08:00
Rossiani Wijaya ffdccab055 MDL-34255 group calendar events: fixed adding group calendar event for students 2012-07-26 14:23:39 +08:00
Aparup Banerjee 33405ffbd0 Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23_STABLE 2012-07-26 13:59:33 +08:00
AMOS bot 993a4b8f5c Automatically generated installer lang files 2012-07-26 00:31:43 +00:00
Michael Aherne a11b507f50 MDL-34534 Backport activity chooser default setting to 2.3 stable 2012-07-25 12:15:21 +01:00
Dan Poltawski 8d9dd85d97 Merge branch 'MDL-13629_droplow_23' of git://github.com/andyjdavis/moodle into MOODLE_23_STABLE 2012-07-25 12:29:47 +08:00
Dan Poltawski c54a83d8bd MDL-34441 dbtransfer - do not attempt migration if moodle is not installed. 2012-07-25 11:29:04 +08:00
Dan Poltawski c237be89fb MDL-34441 tool_dbtranfer - fix codechecker warnings
Since we were so close to perfection.
2012-07-25 10:51:21 +08:00
Dan Poltawski 55bf451676 Merge branch 'w30_MDL-34441_m23_dbtransfer' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-25 10:51:15 +08:00
Sam Hemelryk 5986099daa Merge branch 'w30_MDL-34475_m23_saveondefault' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-25 11:13:16 +12:00
Sam Hemelryk ea268875fb Merge branch 'MDL-27083-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-25 09:18:19 +12:00
Rex Lorenzo f1631871b8 MDL-34519 - Course reset not protected by proper capability 2012-07-24 12:03:52 -07:00
Aparup Banerjee 81fa4095f2 MDL-26969 assignment : clarified phpdoc and fixed whitespace. 2012-07-24 16:40:46 +08:00
Aparup Banerjee 34cdc31ec8 Merge branch 'MDL-26969_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-24 16:40:42 +08:00
Dan Poltawski 51609ef88a Merge branch 'MDL-34484_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-24 15:40:26 +08:00
Dan Poltawski 73a418e3c2 Merge branch 'w30_MDL-34129_m23_enrolinfo' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-24 13:41:45 +08:00
AMOS bot 2902afd555 Automatically generated installer lang files 2012-07-24 00:31:53 +00:00
Petr Škoda e2ecc7c6cc MDL-34475 add default value to xmldb_field hash calculation 2012-07-23 21:36:39 +02:00
Tim Hunt 53e2f1aad8 MDL-34484 unit tests: stop phpunit using testcase names as class names 2012-07-23 11:10:38 +01:00
Aparup Banerjee bb9b19a7fd MDL-34449 phpdoc typo correction 2012-07-23 16:40:30 +08:00
Aparup Banerjee 8e711c3af0 Merge branch 'w30_MDL-34449_m23_layoutmaddness' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-23 16:40:11 +08:00
Dan Poltawski 326bbf9ba6 Merge branch 'MDL-34379_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-23 14:14:08 +08:00
Dan Poltawski cf1479bb2f Merge branch 'MDL-34351_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-23 14:09:34 +08:00
Dan Poltawski b165e64edc Merge branch 'MDL-34251_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-23 14:02:07 +08:00
Dan Poltawski cb9fdb814d Merge branch 'MDL-34226_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-23 13:53:58 +08:00
Rajesh Taneja e4f2ea1a42 MDL-34148 Blog: Fixed variable name used for saving module name
Updated Erik's patch to match coding style
2012-07-23 13:45:54 +08:00
Erik Lundberg 5147d726b2 MDL-34148: Instead of using the module name from the filesystem, the blog menu now fetches the module name with get_string(). 2012-07-23 13:45:54 +08:00
Dan Poltawski 96647229fc Merge branch 'wip-MDL-34404-m23' of git://github.com/samhemelryk/moodle into MOODLE_23_STABLE 2012-07-23 13:26:12 +08:00
Dan Poltawski 7ccdba8821 Merge branch 'w30_MDL-34396_m23_loginhttpsspell' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-23 12:20:05 +08:00
Frederic Massart 82a0137aa5 MDL-27083 Questions: Orphaned questions are adopted on upgrade
Conflicts:

	version.php
2012-07-23 11:58:56 +08:00
Rossiani Wijaya 60a1365d28 MDL-26969 Assignment module - upload: fixed get_submission() return value to nothing when param is set to false. 2012-07-23 11:27:28 +08:00
Aparup Banerjee 3e7788eebe Merge branch 'MDL-32665_chat_popup_23' of git://github.com/andyjdavis/moodle into MOODLE_23_STABLE 2012-07-23 10:21:44 +08:00
Dan Poltawski fd59a1780b Merge branch 'MDL-34451_23' of git://github.com/merrill-oakland/moodle into MOODLE_23_STABLE 2012-07-23 09:22:48 +08:00
Sam Hemelryk 4094913d53 Merge branch 'MDL-34412_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-23 12:42:12 +12:00
Sam Hemelryk f945ffb908 Merge branch 'MDL-34370_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-23 12:39:59 +12:00
Marina Glancy e7a3fe032f MDL-34428 Private files repository should have a 'manage' link 2012-07-23 12:37:57 +12:00
Sam Hemelryk 6fcebf2424 Merge branch 'MDL-33560-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-23 12:25:20 +12:00
Sam Hemelryk 9d1594b04b Merge branch 'MDL-31516_grade_comma_decsep_moodle23' of git://github.com/StudiUM/moodle into MOODLE_23_STABLE 2012-07-23 12:19:58 +12:00
Marina Glancy 9ff506d165 MDL-34221 disabledIf support for filemanager and filepicker elements 2012-07-23 12:08:49 +12:00
Davo Smith 252bd1871b MDL-34221 Filepicker - disableIf now prevents drag and drop upload 2012-07-23 12:08:49 +12:00
Davo Smith 548f536a00 MDL-33927 Filemanager - enforce the maxfiles limit on form submission 2012-07-23 12:01:24 +12:00
Sam Hemelryk 2372ccb774 Merge branch 'MDL-29563_23' of https://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-23 11:49:39 +12:00
Sam Hemelryk 4ad0926a30 Merge branch 'MDL-34427' of git://github.com/jasonilicic/moodle into MOODLE_23_STABLE 2012-07-23 11:40:07 +12:00
Sam Hemelryk f315e3e184 Merge branch 'm23_MDL-34374' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE 2012-07-23 11:38:09 +12:00
Sam Hemelryk 93c3b29893 Merge branch 'm23_MDL-34233' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE 2012-07-23 11:26:50 +12:00
Damyon Wiese c8ac7e7938 MDL-34313: Deleting assignfeedback plugins deletes config for assignsubmission_plugin instead. 2012-07-23 11:22:36 +12:00
Damyon Wiese 943036314f MDL-34272: Assignment module displays all assignments on my moodle instead of just open ones 2012-07-23 11:20:55 +12:00
Damyon Wiese 145a300b73 MDL-34256: Grading table shows users with no submissions with "requires grading" filter
Also hide the filters completely if there are no submission plugins enabled (offline assignment).
2012-07-23 11:09:46 +12:00
Damyon Wiese 392ee02d6c MDL-2283: Display number of assignment submissions that need grading in the grading summary 2012-07-23 10:55:27 +12:00
Sam Hemelryk 28ea78bf7a Merge branch 'MDL-34265-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-07-23 10:39:45 +12:00
Andrew Robert Nicols 7fac90712b MDL-34322 Don't display empty navigation nodes which have no link 2012-07-23 09:43:27 +12:00
Sam Hemelryk 5b37ed3dda MDL-34243 completion: Fixed up call to completion_criteria::factory that was passing object 2012-07-23 09:38:57 +12:00
Aaron Barnes a6fa8a7265 MDL-34243 completion: get_criteria() incorrectly passing object 2012-07-23 09:38:57 +12:00
Mary Evans b843a44e16 MDL-34370 theme_fusion: added CSS in style/core.css to enable weeks to be moved when editing 2012-07-22 21:38:40 +01:00
Petr Škoda 38e269ead9 MDL-34441 bump up version to trigger cache purging 2012-07-22 21:02:14 +02:00
Petr Škoda de25ddd331 MDL-34441 add CLI database migration script 2012-07-22 20:57:07 +02:00
Petr Škoda 7b293e0126 MDL-34441 add maintenance mode to db migration and improve lang strings 2012-07-22 20:57:06 +02:00
Petr Škoda 56db97bb5c MDL-34441 scroll to the bottom when db migration finished 2012-07-22 20:57:06 +02:00
Petr Škoda 05e4341165 MDL-34441 rewrite log display actions after db migration 2012-07-22 20:57:05 +02:00
Petr Škoda 0dd05d20b9 MDL-34441 improve error handling when migrating databases 2012-07-22 20:57:05 +02:00
Petr Škoda 9134f9aa9c MDL-34441 prevent mysqli::close() notice after failed mysql driver connect 2012-07-22 20:57:04 +02:00
Petr Škoda c8e5d9c9eb MDL-34441 show db transfer in experimental section
DB export and import is not ready yet, sorry.
2012-07-22 20:57:04 +02:00
Petr Škoda 937777f3fe MDL-34441 fix switched lang strings 2012-07-22 20:57:03 +02:00
Petr Škoda 6b986b7b6a MDL-34441 always use proper charset in htmlspecialchars() calls 2012-07-22 20:57:03 +02:00
Petr Škoda 4b195fe9e9 MDL-34441 cleanup dtl related phpdocs and minor style improvements 2012-07-22 20:57:02 +02:00
Eric Merrill a14ef47b44 MDL-34451 quiz Fixed problem where attempt page is updated for ALL attempts, not just current. 2012-07-22 12:23:11 -04:00
Petr Škoda 1c005cbf12 MDL-34449 lazy load theme layout otpions
This should allow us to switch page layout on admin pages and elsewhere before $OUTPUT->header() call.
2012-07-22 15:34:23 +02:00
Petr Škoda 7c87df674e MDL-34129 show course info on enrolment page 2012-07-21 21:34:07 +02:00
Luke Tucker ab706cc971 MDL-34396 Ensure TinyMCE editor spell checking works on pages with $PAGE->https_required() 2012-07-21 20:29:50 +02:00
Mary Evans 8545a5cc54 MDL-34412 theme_afterburner: defined #EEE as background-color in afterburner_styles.css for filemanager and filepicker input, select, button & textarea 2012-07-20 23:52:02 +01:00
David Monllao e0cf9e280a MDL-33537 gradingform_rubric Adding the definition when retrieving grading instances
Credit to Sam Chaffee
2012-07-20 14:56:00 +08:00
Jason Ilicic 1cb637e42a MDL-34427: Corrected language string when not allowed to enter the chat room. 2012-07-20 14:45:32 +09:30
Tim Hunt 2894157f15 MDL-34351 quiz cron: one broken overdue attempt should not kill cron
It seems that sometimes trying to process an overdue quiz attempt can
throw an exception. In that case, we need to catch it and report it
nicely, and then carry on processing the rest of the attempts, rather
than just killing the whole of cron processing.

Also, there may be garbage quiz attempts where the associated quiz or
course has been deleted. Skip those too.
2012-07-19 15:24:15 +01:00
Tim Hunt 013c74d058 MDL-34379 quiz reports: timetaken 'open' for never submitted attempts 2012-07-19 12:46:49 +01:00
Tim Hunt 2d7cbf5923 MDL-34251 question engine: possible infinite loop loading usages
In the case where either a question_attempt had not steps, or a
question_usage had not question_attempts, the load_from_records methods
could get stuck in an infinite loop.

This fix ensures that does not happen, with unit tests to verify it. At
the same time, I noticed an error in the existing tests, which this
patch fixes.
2012-07-19 12:46:24 +01:00
Tim Hunt 0288eb2151 MDL-34226 multianswer qtype: basic unit test.
This verifies the previous fix, and gets rid of a rather embarassing TODO.
2012-07-19 12:46:12 +01:00
Tim Hunt 0656c0a403 MDL-34226 multichoice qtype: correct is_complete_response for multianswer
The multianswer qtype uses the multi-choice one, and the way it does its
responses array breaks an assumption that multi-choice was making.
2012-07-19 12:46:11 +01:00
Andrew Davis 36e22a820c MDL-28568 message: added a warning message when the user is about to message someone who cant reply 2012-07-19 17:07:00 +08:00
Sam Hemelryk 62145412bb MDL-33448 javascript: Added caching for the YUI instance used for debug in get_string 2012-07-19 20:22:37 +12:00
Ankit Agarwal 8119fbd7bd MDL-34265 SCORM: Removing sorting from unsortable columns 2012-07-19 15:58:36 +08:00
Dan Marsden 001ff67298 MDL-34233 SCORM backup - change to using set_source_sql to preserve order of records in backup. 2012-07-19 19:40:02 +12:00
David Monllao da2104aa0e MDL-29563 course Throwing an exception instead of a message 2012-07-19 15:35:20 +08:00
David Monllao e2bf940699 MDL-29563 course Hide duplication button in activities without backup2 support - Credit to Mark Nielsen 2012-07-19 15:35:20 +08:00
Dan Poltawski 9592f5dea8 weekly release 2.3.1+ 2012-07-19 13:45:56 +08:00
Dan Poltawski 05551bceed Merge branch 'install_23_STABLE' of git://github.com/amosbot/moodle into MOODLE_23_STABLE 2012-07-19 13:42:05 +08:00
Dan Marsden fece4fd648 MDL-34374 SCORM prevent skipview being set to always when used inside a SCORM course format. 2012-07-19 09:05:07 +12:00
Andrew Davis dec465b3e9 MDL-32665 mod_chat: disabled popup notifications in the chat windows 2012-07-18 19:08:01 +08:00
Andrew Davis cfe170e430 MDL-13629 grade: added some unit tests to clarify the handling of droplow and improved apply_limit_rules() 2012-07-18 09:14:59 +08:00
Damyon Wiese 617c624732 MDL-32948: Improved help for "Require students click submit button" setting
Describes the effect of changing this setting after students have submitted.
2012-07-18 10:20:08 +12:00
Damyon Wiese 00cfd8bc94 MDL-34217: Swap short and long text for setting in assignment module 2012-07-18 10:13:20 +12:00
Andrew Robert Nicols 8a172fa7cf MDL-33874 Don't warn about focussed form fields with the ignoredirty class 2012-07-18 09:35:12 +12:00
Frederic Massart a64fbc87b6 MDL-33767 Course: General section displays its title when required 2012-07-17 22:28:13 +08:00
Frederic Massart 483d768bc0 MDL-33767 Course: The actions on default section redirect to the correct section 2012-07-17 22:28:01 +08:00
Jean-Philippe Gaudreau 35cf43cb42 MDL-31516 Fixing grade_edit_tree::format_number 2012-07-17 09:03:17 -04:00
Nathan Mares 371d354ab3 MDL-34368: Fix broken query in so tokens are correctly checked against the linked service 2012-07-17 19:11:57 +10:00
Frederic Massart 23371805ea MDL-33560 Enrol: Enrol password can be unmasked 2012-07-17 16:49:31 +08:00
Juan Leyva 3240c7100e MDL-34083 Fixing the param type also after deleting the invalid option 2012-07-17 13:12:39 +08:00
Juan Leyva 574cc949cd MDL-34083 Deleted user_files from backup options 2012-07-17 13:12:36 +08:00
Sam Hemelryk 07cb7e3d34 Merge branch 'MDL-33575_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-17 15:50:08 +12:00
Rossiani Wijaya b6e65b5312 MDL-33575 choice module: add label to checkbox element when privacy of results is set to publish full results 2012-07-17 10:17:43 +08:00
AMOS bot b27d56ea6f Automatically generated installer lang files 2012-07-17 00:31:47 +00:00
David Monllaó e52f82253e MDL-30876 filter_mediaplugin Wrapping the style sheets access with try & catch
Conflicts:

	lib/javascript-static.js
2012-07-17 12:21:07 +12:00
Dan Poltawski 00714e72ea Merge branch 'MDL-34187_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-16 15:57:31 +08:00
Aparup Banerjee 5f3d7b1949 MDL-26587 Question : fixed restoring shortanswer where answers are missing due to data error in mbz file. 2012-07-16 15:51:11 +08:00
Dan Poltawski 4923e18d75 Merge branch 'MDL-23219_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-16 14:32:54 +08:00
Dan Poltawski e0bc694514 Merge branch 'wip-mdl-30798-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-16 14:26:08 +08:00
Rajesh Taneja 021bea1240 MDL-30798 Blog: link param for entries about this course link is fixed 2012-07-16 14:11:47 +08:00
Dan Poltawski 24527f63bb Merge branch 'MDL-31622-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-16 11:34:21 +08:00
Dan Poltawski d835681e35 Merge branch 'MDL-34211' of git://github.com/appalachianstate/moodle into MOODLE_23_STABLE 2012-07-16 11:15:55 +08:00
Dan Poltawski 4da22142bc Merge branch 'w29_MDL-34271_m23_mysqlcollation' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-16 11:00:56 +08:00
Dan Poltawski 8242298e4b Merge branch 'MDL-34164_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-16 10:05:51 +08:00
Marina Glancy ae8e49e8de MDL-34213 fixed mistype causing wrong link in some browsers 2012-07-16 09:55:05 +08:00
Sam Hemelryk 5320640ccd Merge branch 'MDL-33624-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-07-16 13:50:56 +12:00
Dan Poltawski 28fc596d03 MDL-33624 lang - remove incosistent use of placeholder 2012-07-16 09:45:11 +08:00
Davo Smith f8e493faff MDL-34214 Course dndupload - removed unneeded classes from preview element 2012-07-16 12:05:54 +12:00
Sam Hemelryk ac98ad6189 Merge branch 'MDL-26145_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-16 11:57:35 +12:00
Sam Hemelryk 8f87d57c47 Merge branch 'MDL-28155_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE 2012-07-16 11:50:23 +12:00
Sam Hemelryk 828a42c37d Merge branch 'MDL-32310-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-07-16 11:00:57 +12:00
Sam Hemelryk d479ce3bef Merge branch 'MDL-34153-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-07-16 10:44:01 +12:00
Sam Hemelryk f30998190f Merge branch 'MDL-34240-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE 2012-07-16 10:37:42 +12:00
Sam Hemelryk ff8ab720f0 Merge branch 'MDL-34072' of git://github.com/appalachianstate/moodle into MOODLE_23_STABLE 2012-07-16 10:10:54 +12:00
Damyon Wiese 66681a5192 MDL-34258: Plagiarism API now returns strings so mod_assign needs these updates 2012-07-16 09:58:06 +12:00
Charles Fulton 4b791f1d17 MDL-27563 shibboleth: set context on login page 2012-07-16 09:39:43 +12:00
Barbara Ramiro b831bcc2be MDL-33841 Min-height set to remove unnecessary scrollbar on tree and list view 2012-07-16 09:35:44 +12:00
Ashley Holman bf79f77357 MDL-34309: Fix broken postgres unix sockets in core_adodb_testcase::test_read_table 2012-07-16 09:33:01 +12:00
Andrew Robert Nicols e7bf0155f7 MDL-33874 Allow form fields to be ignored by the formchangechecker 2012-07-16 09:26:11 +12:00
Sam Hemelryk bac9070359 Merge branch 'MDL-33788b-23' of git://github.com/srynot4sale/moodle into MOODLE_23_STABLE 2012-07-16 09:18:46 +12:00
AMOS bot beae8b9888 Automatically generated installer lang files 2012-07-15 00:32:02 +00:00
Tim Hunt 04de7affb6 MDL-34164 quiz reports: only try to show graphs if GD is installed.
if (empty($CFG->gdversion)) { seems to be the common idiom for this.
I refactored the graph output into the renderer, to avoid having to
duplicate that test three times.
2012-07-14 09:21:00 +01:00
Tim Hunt e9879c02c6 MDL-34257 quiz 'secure' window: does not close automatically. 2012-07-13 18:03:51 +01:00
Tim Hunt 7bef3664b8 MDL-23219 check permissions: show relevant role-assignments.
Adding this list of role assignments should make it much easier for
admins to work out why, when the permissions shown in the check
permisisons page are now what they expect.

I thought about making the links go more directly to, for example, the
assign roles pages for each context, but because of things like
enrolments in courses that is hard. It is only two clicks to go to the
context, then click the right link in the settings block there.

I also re-orderd some of the code in check.php to try to get all the DB
code before all the output code.
2012-07-13 15:21:17 +01:00
Dan Poltawski 881118184a MDL-34240 - google plugins: switch to PARAM_RAW_TRIMMED
This ensures the client credentials which are entered are trimmed
as users are finding problems with bad pastes.
2012-07-13 10:09:39 +08:00
Frederic Massart 7397acb145 MDL-31622 Forms: Date selector supports i18n 2012-07-13 08:57:29 +08:00
AMOS bot a3db6afa39 Automatically generated installer lang files 2012-07-13 00:32:23 +00:00
Fred Woolard fd626c4109 MDL-34072: Adjust SQL for Oracle. Remove subquery alias altogether. 2012-07-12 10:54:59 -04:00
Fred Woolard eab8660e8f MDL-34211 Use the $table_name argument to check against $metatables key values 2012-07-12 10:54:10 -04:00
Petr Škoda 3eb9ebb3c8 MDL-34271 add new cli tool for mysql collation conversions 2012-07-12 14:41:28 +02:00
Petr Škoda 41e8883ea8 MDL-34271 use the same collation when adding new tables or columns 2012-07-12 14:41:28 +02:00
Petr Škoda 7ec63b27d0 MDL-34271 cleanup mysql engine hack before adding similar collation hack 2012-07-12 14:41:27 +02:00
Dan Poltawski 3b52187e25 weekly release 2.3.1+ 2012-07-12 15:57:26 +08:00
Dan Poltawski f7d874c76f Merge branch 'install_23_STABLE' of git://github.com/amosbot/moodle into MOODLE_23_STABLE 2012-07-12 15:50:04 +08:00
Sam Hemelryk 9f7f501c0a Revert "MDL-33575 choice module: add label to checkbox element when privacy of results is set to publish full results"
This reverts commit f19cd42709.
2012-07-12 18:21:00 +12:00
Dan Poltawski 476f72e9bf MDL-34153 mod_forum: create RFC-2822 compliant message-ids 2012-07-12 14:16:52 +08:00
Paul Nicholls 074236eee7 MDL-32582 - filter/multimedia: MP3 Flow Player doesn't work in Chrome if empty stylesheets are present 2012-07-12 13:40:43 +08:00
AMOS bot 294c228272 Automatically generated installer lang files 2012-07-12 00:32:25 +00:00
David Monllao c465776d28 MDL-28155 mod_assignment Using the this object instead of a string 2012-07-11 15:13:34 +08:00
Dan Poltawski 4697c46706 Merge branch 'w28_MDL-34175_m23_admin' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-11 14:51:07 +08:00
Petr Škoda df7799d989 MDL-34175 one more hardcoded /admin/ in mnet 2012-07-11 08:48:04 +02:00
AMOS bot 89375aac4c Automatically generated installer lang files 2012-07-10 20:33:18 +02:00
Petr Skoda 229aabf7c6 MDL-33712 add support for unique moodle tags in tinymce 2012-07-10 15:56:11 +08:00
Marina Glancy d6571ad763 MDL-33950 Correctly initialise repository and check access in js and non-js filepicker 2012-07-10 14:57:46 +08:00
Marina Glancy 95991122ab MDL-33473,MDL-33950,MDL-33837 Allow non-js filepicker to pick files from moodle repositories
- MDL-33473 actually make non-js filepicker to work with local repositories
- MDL-33950 validate that file is accessible
- MDL-33837 when picking a server file marked as main, do not make it main in current filearea
2012-07-10 14:57:41 +08:00
Marina Glancy db81525850 MDL-33950 check if source file is accessible in repository_ajax.php
- repository::copy_to_area() does not check access any more, and repository_recent::copy_to_area() is unnecessary
- added repository::file_is_accessible() that checks access to the picked file (regardless of accessibility of the file it is referencing to)
2012-07-10 14:57:35 +08:00
Sun Zhigang 7073fa4c4a MDL-28155 mod_assignment - Fix an ugly hack
Show download all link for any assignment types which implement
the download_submissions() method
2012-07-10 13:00:13 +08:00
Dan Poltawski b2e5a60773 MDL-34159 - add comment lost from previous commit 2012-07-10 12:58:46 +08:00
Dan Poltawski 57c7815213 Merge branch 'w28_MDL-34159_m23_wherelist' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-10 12:56:07 +08:00
Petr Škoda 95896749a5 MDL-33617 add new index to improve perf of enrol related role_assignments
Conflicts:

	version.php
2012-07-10 15:49:38 +12:00
Petr Škoda c8b7088463 MDL-33887 delay string fetching in PAGE->requires->string_for_js() till page footer
This should resolve problems with language switching such as when forcing course language.
2012-07-10 15:08:26 +12:00
Michael Aherne c82d7fc832 MDL-34156 Remove subselect from slow query 2012-07-10 10:53:40 +08:00
Dan Poltawski 1f34fa79c2 Merge branch 'w28_MDL-34147_m23_cygwin' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-10 10:31:24 +08:00
Dan Poltawski 806129b06e Merge branch 'MDL-34171_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-10 09:25:22 +08:00
Petr Škoda eb88700a56 MDL-34155 use course visibility default when creator does not have moodle/course:visibility 2012-07-10 12:49:14 +12:00
Sam Hemelryk 3ca82ed605 Merge branch 'w28_MDL-34175_m23_admin' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-10 12:43:42 +12:00
Dan Marsden 6b8399df5e MDL-34198 SCORM remove unecessary get_records call 2012-07-10 08:34:42 +08:00
Marina Glancy 68ea10b079 MDL-33444 Upload repository can specify custom label for filepicker 2012-07-10 12:31:12 +12:00
Marina Glancy 2eb66f3500 MDL-34139 filemanager select-file dialogue should update file on Enter 2012-07-10 12:24:08 +12:00
Sam Hemelryk bd75b67885 Merge branch 'MDL-29470-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-10 12:09:26 +12:00
Sam Hemelryk 3936796042 Merge branch 'MDL-32297-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-10 12:05:33 +12:00
Davo Smith b43bb8da94 MDL-34107 Upload repository - do not add a dot to files without an extension 2012-07-10 11:47:48 +12:00
Dan Poltawski 898010f1aa MDL-34061 mod_resource: filter settings weren't coming from defaults 2012-07-10 11:40:33 +12:00
Charles Fulton d563d48694 MDL-27800 admin: make front page restore link consistent 2012-07-10 11:32:31 +12:00
Dan Poltawski 0dd189d59d Merge branch 'MDL-18301-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-09 14:27:15 +08:00
Dan Poltawski d6cf442059 Merge branch 'MDL-32057_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-07-09 14:14:13 +08:00
Dan Poltawski 2bf17d606b Merge branch 'w28_MDL-34046_m23_stalefiles' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-09 13:50:16 +08:00
Dan Poltawski 1583e17c65 Merge branch 'MDL-33030_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-09 13:42:32 +08:00
Dan Poltawski d85083312c Merge branch 'wip-mdl-29969-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-09 13:39:18 +08:00
Dan Poltawski 1e838c4e30 Merge branch 'MDL-34077-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-09 13:37:34 +08:00
Gilles-Philippe Leblanc 65ab8112a3 MDL-33822 SCORM Interactions report - fix formatting of empty cells. 2012-07-09 17:24:29 +12:00
Dan Poltawski 9309b2dba8 MDL-17395 auth_email: clarify description 2012-07-09 17:19:41 +12:00
Barbara Ramiro b002b36ed3 MDL-33795 Increased file picker width and height 2012-07-09 17:14:12 +12:00
David Balch d36249d6d6 MDL-34143 Add file type information for .mdb .accdb (MS Access databases) 2012-07-09 13:05:40 +08:00
Aaron Barnes 48bdd52172 MDL-33788 completion: SQL optimisation 2012-07-09 15:36:52 +12:00
Dan Poltawski 41bb2c3a59 Merge branch 'wip-mdl-33943-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-09 11:35:02 +08:00
Ankit Agarwal 918f6d2c34 MDL-27831 calendar: Removing reduntand control icons in delete.php 2012-07-09 11:31:12 +08:00
Dan Poltawski 3a429ca204 Merge branch 'MDL-33885-23' of git://github.com/FMCorz/moodle into MOODLE_23_STABLE 2012-07-09 10:31:52 +08:00
Ruslan Kabalin d212244375 MDL-33890 Make course blocks less theme dependant
This fix checks that the empty block region is actaually the standard one, so
it can be hidden. The blocks move operating area is not resticted to page
content any more.
2012-07-09 10:02:34 +08:00
Sam Hemelryk f19cd42709 MDL-33575 choice module: add label to checkbox element when privacy of results is set to publish full results 2012-07-09 10:56:28 +12:00
Sam Hemelryk 9bf1621fbc Merge branch 'MDL-30816_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-09 10:28:45 +12:00
Dan Poltawski aacf3222df MDL-33514 - rss: also exclude suspended users feeds
Thanks Petr!
2012-07-09 10:24:41 +12:00
Dan Poltawski 6b4c491cb4 MDL-33514 - rss: only retrieve RSS feeds for valid users 2012-07-09 10:24:40 +12:00
Tim Hunt 69a600a067 MDL-34171 qformat_gift: Fix edge case with special character escaping.
We need to escape \ on export, because it is un-escaped on import.
2012-07-06 10:48:20 +01:00
David Monllao 25afd64b0f MDL-26145 mod_chat Talk feature not working correctly 2012-07-06 16:16:00 +08:00
Petr Škoda fe6d428185 MDL-34046 improve mixed files upgrade error
Credit goes to Gordon Bateson.
2012-07-06 08:01:02 +02:00
Petr Škoda 880f8e7b84 MDL-34147 use cygwin style paths in phpunit hints 2012-07-06 07:59:04 +02:00
Petr Škoda 6128bf9d25 MDL-34159 improve where_clause_list performance 2012-07-06 07:57:20 +02:00
Petr Škoda 93f3eb63d1 MDL-34175 a few more renamed admin fixes 2012-07-06 07:56:00 +02:00
Petr Škoda 79406900b5 MDL-34175 automatically fix admin JS links 2012-07-06 07:56:00 +02:00
Frederic Massart 0408a48010 MDL-33885 Blog: Added maxlength rule to subject field 2012-07-06 13:16:34 +08:00
Frederic Massart 2dd2bd7ead MDL-18301 Gradebook: Added feature for components to control grade visibility 2012-07-06 09:53:54 +08:00
Sam Hemelryk f2867a8672 Moodle 2.3.1 release 2012-07-06 11:27:47 +12:00
Sam Hemelryk 62e9e694b7 weekly release 2.3+ 2012-07-06 10:04:54 +12:00
AMOS bot b24e6ed930 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
AMOS bot 50b1caaf86 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
AMOS bot 2ddf3ffcd2 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
Eloy Lafuente (stronk7) b73a7519c4 Revert "MDL-33303 Filepicker: resized to match HTML editor and made resizable"
This reverts commit e5c2bbd0f7.
2012-07-05 23:22:05 +02:00
David Balch 2425229c88 MDL-34063 XHTML files should use the HTML icon, not the markup icon 2012-07-05 18:34:55 +02:00
Eloy Lafuente (stronk7) 353580b0e3 Merge branch 'MDL-33453-reference' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-07-05 17:07:22 +02:00
Eloy Lafuente (stronk7) 4539b33788 Revert "MDL-30912 - lib - A tidy up of the submit url jump functions for greater ease with accessability."
This reverts commit a1a00aeee7.
2012-07-05 16:10:37 +02:00
Marina Glancy 9b47ec7bb3 MDL-33746 make folder view look like filemanager tree view 2012-07-05 14:36:28 +02:00
Tim Hunt b9c20952a3 MDL-34065 questions: also fix two typos in comments.
Amended to change 2 accordin => according
2012-07-05 13:50:21 +02:00
Tim Hunt e819ff4263 MDL-34065 lib: improve two debugging messages.
If the string passed to get_string is empty, say that. Don't say that it
contains illegal characters.

When relying on the __call magic in plugin_renderer_base, when the
method cannot be found, include the right class name in the error
message.
2012-07-05 13:50:14 +02:00
Rossiani Wijaya a2af7fd407 MDL-30816 Choice module: add format_string() for choice name. 2012-07-05 12:20:20 +08:00
Rossiani Wijaya 34e0b4a71e MDL-30816 choice module: fixed accessibility for responses table and make it easier for screenreader to read it 2012-07-05 12:19:57 +08:00
Frederic Massart 8fb4b73f55 MDL-29470 Backup: fixed unexpected next automated backup date 2012-07-05 10:13:33 +08:00
Tim Hunt b20b1c32bf MDL-34145 postgres driver: fix get_tables perf on <= 9.0
The query of the information_schema view seems to be painfully slow on
older versions of postgres (2000ms instead of 20ms). Therefore, it is
worth detecting that case, and using a more postgres specific feedback.
This is particularly important for 2.3+ unit tests.

Thanks to Petr Skoda for his help with this.
2012-07-05 03:41:08 +02:00
Frederic Massart 684806305e MDL-29470 Backup: unit tests for next automated backup date 2012-07-05 09:37:21 +08:00
Sam Hemelryk 1e9130ae6e MDL-33770 webservices: Fixed error with core_group_create_groups when no enrolment key provided 2012-07-05 09:22:35 +12:00
Tim Hunt c57fa60f3d MDL-32062 question engine: fixup tests that this change broke.
The test data was wrong, and was triggering the work-around code that
MDL-32062 introduced. I fixed the test data.

Also, I fixed one of the tests, that had been broken.
2012-07-04 19:24:48 +08:00
Dan Poltawski 617d260dd7 MDL-34035 - fix typo in comment
Thanks Sam!
2012-07-04 10:39:48 +08:00
Tim Hunt b86a48c5b9 MDL-34035 help links: allow other types of URL for plugins.
For third-parth plugins, in can be helpful if the 'More help' links in
help pop-ups (the ones that come from $string['..._link'] string in the
language file) can go to other places.

This change support two other sorts of URL in addition to the standard
'course/editing' type of link that goes to MoodelDocs.

You can use absolute URLs, starting http:// or https:///

You can use a link starting %%WWWROOT%%, and that token is replaced by
$CFG->wwwroot to make the link.
2012-07-04 10:39:42 +08:00
Barbara Ramiro a2c2ab3e1a MDL-33542, MDL-33542 Select dialogue details aligned
And loading gif smaller
2012-07-04 10:25:09 +08:00
Eloy Lafuente (stronk7) bbe378a63e Merge branch 'w27_MDL-33876_m23_delenrol' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-04 04:16:05 +02:00
Marina Glancy 9d5ced06c1 MDL-34047 repository URL downloader must say that it returns only images 2012-07-04 09:51:51 +08:00
Sam Hemelryk 6019d2b2f3 Merge branch 'MDL-32614_23' of git://github.com/stronk7/moodle into MOODLE_23_STABLE 2012-07-04 13:15:03 +12:00
Eloy Lafuente (stronk7) ccef7fe8d0 MDL-32614 lti: on restore, clean any typeid to convert the tool to selfcontained.
This is known to be imperfect, awaiting for MDL-34161 to fix the whole thing. Also,
unrelated, there are some basiclti => lti replacements.
2012-07-04 02:15:02 +02:00
Chris Scribner f2b7928df7 MDL-32614: Removing code which disassociated LTI instances from their tool types upon restore. 2012-07-04 02:14:56 +02:00
Dan Poltawski 9f6f18d2c2 MDL-31692 mod_lti - ensure that various mforms are used properly
* typesettings.php and instructor_edit_tool_type.php are tided
   up properly to ensure proper use for form data
* An incorrect PARAM type is corrected for typename
2012-07-04 10:08:13 +12:00
Sam Hemelryk 848fc30a2d Merge branch 'MDL-32062_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-04 09:53:51 +12:00
sam marshall 8530aac4a8 MDL-33466: Group restriction should hide activity even with 'show availability' option
This is a modified version of fix by Luke Tucker at NetSpot - thanks.
2012-07-04 09:38:08 +12:00
Jonathan Harker 3bcca35591 MDL-27125 better manage file handles when downloading multiple files.
Based on Dongsheng Cai's branch: s11_MDL-27125_curl_file_handler_master
2012-07-04 09:33:12 +12:00
Kevin Wiliarty e3f4094ac8 MDL-33749 follow redirects for URL downloader 2012-07-04 08:34:55 +12:00
Sam Hemelryk 7df86db31d Merge branch 'wip-mdl-32787-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-04 08:26:03 +12:00
Eloy Lafuente (stronk7) b41f914927 Merge branch 'wip-MDL-33303-m23' of git://github.com/samhemelryk/moodle into MOODLE_23_STABLE 2012-07-03 16:18:41 +02:00
sam marshall a5f68fb2c2 MDL-33426 Completion: Multilang activity names wrong in alt/title 2012-07-03 16:08:57 +02:00
Rajesh Taneja 28f23328c5 MDL-32787 user: rule required for custom profile fields applies to all users editing own profile 2012-07-03 13:48:18 +08:00
Frederic Massart 3e1648723f MDL-33828 Portfolio: prevent notices while exporting to portfolios 2012-07-03 16:35:48 +12:00
sam marshall 60a72a03b2 MDL-33937 Paged course view: Allows view of sections that are not visible 2012-07-03 12:30:10 +08:00
Dan Poltawski 741543e9a7 Merge branch 'master_MDL-33938' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE
Conflicts:
	mod/scorm/db/upgrade.php
2012-07-03 12:18:29 +08:00
Adrian Greeve a1a00aeee7 MDL-30912 - lib - A tidy up of the submit url jump functions for greater ease with accessability. 2012-07-03 12:12:19 +08:00
Frederic Massart 9152878ed3 MDL-30903 Accessibility: user profile page uses table headers 2012-07-03 11:51:19 +08:00
Dan Poltawski 81b2147092 Merge branch 'MDL-34008_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-03 11:47:23 +08:00
Dan Poltawski e570ee4b63 Merge branch 'w27_MDL-34036_m23_bulkrole' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 11:40:14 +08:00
Sam Hemelryk 0afd953daf Merge branch 'w27_MDL-34115_m23_arrayofarrayssort' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 15:15:18 +12:00
Dan Poltawski f224fd9498 Merge branch 'MDL-30883_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-03 11:01:44 +08:00
Jason Fowler 69b2bab32e MDL-33957 - Installation - Fixing field lengths so they are long enough for data entry, and don't distort page rendering 2012-07-03 14:58:55 +12:00
Dan Poltawski f95e28e0ff Merge branch 'w27_MDL-34123_m23_newpasslang' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 10:39:17 +08:00
Marina Glancy f5cd2c6ef1 MDL-33837 picking file from server files should not copy 'Main file' property 2012-07-03 10:24:43 +08:00
Sam Hemelryk 10ff22d6f6 Merge branch 'MDL-33987_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-03 14:11:40 +12:00
ISHIKAWA Takayuki d0d407f0bb MDL-33757 gradebook: Adding support to sort userlist by email address 2012-07-03 09:45:26 +08:00
Damyon Wiese 8ad459ed58 MDL-33499: Display final grade on the grading form with a link to the grader report
AMOS BEGIN
 CPY [currentgrade,mod_assignment],[currentgrade,mod_assign]
AMOS END
2012-07-03 02:28:49 +02:00
Eloy Lafuente (stronk7) cf5b51af0e Merge branch 'wip-MDL-33521-m23' of git://github.com/samhemelryk/moodle into MOODLE_23_STABLE 2012-07-03 01:59:22 +02:00
Adam Olley b653107b96 MDL-32057: Fix cohort enrolment css for ie7 2012-07-03 09:23:33 +09:30
Jerome Mouneyrac 18c264790a MDL-33770 Web service: create_groups should not require enrolmentkey 2012-07-03 11:49:30 +12:00
Frederic Massart 7523da44fc MDL-33814 Output renderers: table cell objects are only created when needed 2012-07-03 11:36:43 +12:00
Frederic Massart bd9ecafba9 MDL-33796 Glossary: removed unused missing string 2012-07-03 01:05:19 +02:00
Davo Smith 5200c254a1 MDL-34029 update mod/upgrade.txt to include course drag and drop upload 2012-07-03 10:55:48 +12:00
Dan Poltawski 3d43075cfd MDL-9214 - improve comment for custom login instructions 2012-07-03 10:47:21 +12:00
Dan Poltawski 5df543a60e MDL-32286 - fix ambigious english string 2012-07-03 10:42:57 +12:00
Dan Poltawski bed1c4a943 MDL-33990 - yui2: remove 2 uncessary requirements
We no longer use yui2 logger and connection in set_user_prefs
2012-07-03 10:37:10 +12:00
Sam Hemelryk 66ff4c0a06 MDL-34014 cssoptimiser: Fixed some aweful spelling 2012-07-03 10:34:13 +12:00
Dan Poltawski 9ea8065f1c MDL-34014 lang - fix CSS optimiser spelling errors 2012-07-03 10:32:45 +12:00
Dan Poltawski eadad29dc9 MDL-34022 lang - the html editor supports all browsers we support
So remove misleading 'some browers only'
2012-07-03 10:30:38 +12:00
Dan Poltawski e068b3dbe3 MDL-34033 lang - ammend configenableajax
Now better reflects its functionality.
2012-07-03 10:27:57 +12:00
Damyon Wiese 5809f6912b MDL-33848: Prevent file listings in the assignment module having an ugly border 2012-07-03 10:21:19 +12:00
Matthew G. Switlik 815aecf6c7 MDL-28151 resource: prevent cropping of large images 2012-07-03 10:14:04 +12:00
Tim Hunt 15d8babd1a MDL-23813 glossary filter: add missing YUI dependency
Fix found by Huy Hoang. I am just making a commit.
2012-07-02 23:52:48 +02:00
Aparup Banerjee a78e4e9147 MDL-23254 Authentication : used httpswwwroot as root url during authentication procedure where $PAGE->https_required() is specified. 2012-07-03 09:42:42 +12:00
Dan Poltawski d9edd25111 MDL-34081 dml: mssql driver was using case insensitve sql 2012-07-02 21:08:18 +02:00
Eloy Lafuente (stronk7) 1a76bbe2e4 MDL-34121 bump versions to efectively get the upgrade performed.
Conflicts:
	version.php
2012-07-02 18:18:22 +02:00
Eloy Lafuente (stronk7) af63cc85df Merge branch 'w27_MDL-34121_m23_killbackupmess' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 18:16:54 +02:00
Marina Glancy dff8438e50 MDL-33948 mod_forum correctly passes files options to file_save_draft_area_files() 2012-07-02 17:44:43 +08:00
Marina Glancy ec3fe6e123 MDL-33948 file_save_draft_area_files() validates if references are allowed and allows unlimited file size 2012-07-02 17:44:38 +08:00
Andrew Robert Nicols 770cee9696 MDL-33916 Add unit tests to ensure that is_enrolled returns correctly 2012-07-02 17:36:55 +08:00
Andrew Robert Nicols 1db89f5e6a MDL-33916 Ensure that capabilities are checked for cached user enrolments 2012-07-02 17:36:51 +08:00
Dan Poltawski 5c1b768aec MDL-31802 - navigation: add a comment about session reduction 2012-07-02 17:30:21 +08:00
Dan Poltawski f2b4305c8e Merge branch 'MDL-31802_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-07-02 17:24:56 +08:00
Marina Glancy 502ecc4c9f MDL-34117 Correctly pass accepted_types to dnduploader 2012-07-02 17:10:02 +08:00
Dan Poltawski 34c10b84fb Merge branch 'w27_MDL-34120_m23_delpass' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:48:28 +08:00
Dan Poltawski f09dcd4b6d Merge branch 'w27_MDL-34125_m23_tablename' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:46:27 +08:00
Tim Hunt 2b1b2017a6 MDL-34109 quiz cron: timelimit are timeclose of 0 are special.
If the timelimit or timeclose of a quiz are 0, this means 'no
restriction', rather than '1970' or '0 seconds'. We need to handle these
special cases correctly in the code that looks for quiz attempts that
might be in the wrong state.
2012-07-02 16:44:35 +08:00
Tim Hunt 592443f4e1 MDL-34109 quiz cron: change whitespace before applying the fix.
This commit just changes the white-space, but does not change any of the
actual code. This is so that the commit I am about to make, which will
change the code, will be easier to understand.
2012-07-02 16:44:29 +08:00
Dan Poltawski dabab94b6e Merge branch 'w27_MDL-34045_m23_idnumber' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:34:17 +08:00
Dan Poltawski 039089f3aa Merge branch 'MDL-34025_m23' of https://github.com/markn86/moodle into MOODLE_23_STABLE 2012-07-02 16:28:12 +08:00
Rossiani Wijaya 41c548bb23 MDL-33030 Lesson module: fixed progress bar 2012-07-02 16:20:40 +08:00
Dan Poltawski 9cb942820c Merge branch 'MDL-33924_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-02 16:19:19 +08:00
Dan Marsden 0ba1ee1dd2 MDL-33914 SCORM show scrollbar on TOC if too long. 2012-07-02 16:14:23 +08:00
Dan Marsden 7debccbdee MDL-33835 Marking Guide - set currentfocus var to the first criteria comment to avoid JS errors. 2012-07-02 16:10:26 +08:00
Dan Poltawski 9a211c853d Merge branch 'MDL-33780_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-02 16:07:32 +08:00
Marina Glancy ed8cab855e MDL-33721 show loading icon after file has been selected in filepicker, prevent clicking select button twice 2012-07-02 16:00:21 +08:00
Dan Poltawski 6253f69246 Merge branch 'm23_MDL-33053_AICC_flattened_TOC' of git://github.com/scara/moodle into MOODLE_23_STABLE 2012-07-02 15:50:18 +08:00
Dan Poltawski 49ac5deff6 Merge branch 'MDL-32605-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-07-02 15:45:59 +08:00
Andrew Davis 6737eda426 MDL-25476 messages: switched some notification emails to come from the support contact instead of admin 2012-07-02 15:41:29 +08:00
Frederic Massart c7132d7c93 MDL-9073 Glossary: uncategorised entries are printable 2012-07-02 15:34:06 +08:00
Kanika Goyal d9b9bfd288 MDL-31203 mod_forum: advanced search posts must be newer older than date, reverts date 2012-07-02 15:24:10 +08:00
Rossiani Wijaya ec70cf6ef1 fixed the ->spacer <br> param 2012-07-02 15:20:43 +08:00
Mark Nielsen a6b0b36cdc fixed undefined variable 2012-07-02 15:20:37 +08:00
Rajesh Taneja a8380712bb MDL-33943 tool_replace: Hardcoded strings replaced with lang strings 2012-07-02 15:18:41 +08:00
Dan Poltawski 3e839bd513 Merge branch 'MDL-31987_assignment_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-02 15:12:47 +08:00
Dan Poltawski 8633142f53 Merge branch 'MDL-34019-pluginlib-notice' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-07-02 15:02:37 +08:00
Tim Hunt 564b878840 MDL-34054 quiz reports: missing context.
quiz_report_should_show_grades needs to know the context, so pass it
through.
2012-07-02 14:57:29 +08:00
Dan Poltawski c3f59e043c MDL-33995 - unit tests: fix class name collision 2012-07-02 14:52:57 +08:00
Rossiani Wijaya 4b0e6f38fa MDL-31987 Assignment module: fixed upgrade version 2012-07-02 14:51:47 +08:00
Dan Poltawski fb978df0f0 MDL-31987 Assignment module: fix sql for postgres. 2012-07-02 14:49:29 +08:00
Rossiani Wijaya 45353da409 MDL-31987 Assignment module: Assignment count submissions correctly.
For advanced upload assignment, store file count of each submission
into assignment_submissions.numfiles

When counting submissions, if the assignment is open and tracking
drafts, only submissions which has send for marking are counted.
Otherwise, submissions which has numfiles > 0 are counted.

Also change a hardcoded 'submitted' to ASSIGNMENT_STATUS_SUBMITTED.

This patch was originally written by: Sunner Sun <sunner@gmail.com>.

I made some modifation to fixed count_real_submissions() query (ref: MDL-32207) in /mod/assignment/type/upload/assignment.class.php file
2012-07-02 14:49:29 +08:00
Rajesh Taneja 419aed3539 MDL-29969 Administration: Default value for numsections is set to 1 for site frontpage 2012-07-02 14:33:37 +08:00
Jerome Mouneyrac 08641906e1 MDL-33995 Course external PHPunit test + externallib_testcase helper class 2012-07-02 14:13:44 +08:00
Jerome Mouneyrac 6b5ce20c16 MDL-33776 Web services: get_categories - subcategories should be checked against visible/theme keys 2012-07-02 14:13:38 +08:00
Dan Marsden 800fb7533e MDL-33978 SCORM activity completion - don't tiggere completion update state on creation of SCORM 2012-07-02 13:44:35 +08:00
Andrew Davis 789c8b8194 MDL-33686 Repositories: we were accessing a non-existent variable and thus never displaying the maximum number of attachments 2012-07-02 14:53:50 +12:00
Andreas Grabs e9aa190a37 MDL-33932_master - added array_unique() 2012-07-02 14:32:09 +12:00
Andreas Grabs 786ad3511c MDL-33627 - feedback block now show all feedbacks 2012-07-02 14:06:42 +12:00
Sam Hemelryk abfc9e2512 MDL-33521 css: Fixed invalid CSS in core CSS and plugin styles.css files 2012-07-02 11:34:53 +12:00
Frederic Massart e5c2bbd0f7 MDL-33303 Filepicker: resized to match HTML editor and made resizable 2012-07-02 11:34:27 +12:00
Eloy Lafuente (stronk7) 1494f20da3 weekly release 2.3+ 2012-07-02 00:54:05 +02:00
Eloy Lafuente (stronk7) 4fa4a727b4 Merge branch 'MDL-34119_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-02 00:30:28 +02:00
Sam Hemelryk 4be710795a Merge branch 'MDL-34044-23' of git://github.com/srynot4sale/moodle into MOODLE_23_STABLE 2012-07-02 08:22:35 +12:00
Eloy Lafuente (stronk7) 9ea40f27a0 Merge branch 'w27_MDL-34130_m23_recordsettests' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-01 22:01:22 +02:00
Petr Škoda 19ba134d3b MDL-34130 prevent some warning in PHPStorm 2012-07-01 21:50:56 +02:00
Petr Škoda d0812ba0e6 MDL-34130 test recordset data is static
We do not want recordset results to be affected by subsequent update or delete queries.
2012-07-01 21:40:37 +02:00
Petr Škoda a2b8856558 MDL-34130 add missing rs close
Thanks Eloy!
2012-07-01 21:40:36 +02:00
Petr Škoda a61e8c8ebe MDL-34130 test interaction of recordsets and transactions 2012-07-01 21:40:36 +02:00
Petr Škoda 1cf431a329 MDL-34130 test nested recordset iteration 2012-07-01 21:40:36 +02:00
Petr Škoda 9ee97228bd MDL-34130 fix data inserts in recordset tests 2012-07-01 21:40:36 +02:00
Petr Škoda 43fb824bd2 MDL-34125 fix regression when deleting activity modules
Credit goes to Gordon Bateson.
2012-07-01 10:05:22 +02:00
Eloy Lafuente (stronk7) 9d774c9445 Merge branch 'MDL-32249c-23' of github.com:srynot4sale/moodle into MOODLE_23_STABLE 2012-07-01 02:14:39 +02:00
Sun Zhigang 8b3d60557c MDL-31201 wiki: fix a hardcoded string 2012-06-30 22:01:08 +02:00
Petr Škoda 134affd943 MDL-34123 use user's lang when sending new emails 2012-06-30 20:46:30 +02:00
Petr Škoda 5df5bcba99 MDL-34036 fix course role user selector 2012-06-30 15:40:30 +02:00
Petr Škoda 93fd7cb10c MDL-34121 drop unused backup tables that were supposed to be dropped long ago
The backup/restore leftovers that referenced these will be dropped in 2.4
2012-06-30 14:00:52 +02:00
Mary Evans 3705a88629 MDL-34119_M23 theme_splash: Added colourswitcher.js and associated code in layout files and lib.php 2012-06-30 12:02:22 +01:00
Petr Škoda 5cb477c4a1 MDL-34120 do not try to create new passwords for incorrectly deleted users
There is still some code that ignores delete_user() and instead hacks the user table directly, skip the borked user records for now when sending new passwords.
2012-06-30 09:07:18 +02:00
Petr Škoda 4aabce216c MDL-33876 skip deleted users in enrol_database sync 2012-06-30 08:44:55 +02:00
Petr Škoda b273b20a7c MDL-34115 fix sorting in blocks admin UI
Comparison of arrays is not locale aware.
2012-06-30 08:34:02 +02:00
Petr Škoda f8e05deb35 MDL-34045 fix invalid idnumber field type in cohort form 2012-06-30 07:57:51 +02:00
Mary Evans 263e8c144c MDL-34119_M23 theme_splash: removed redundant js call in lib.php. Added lang option to config.php + amended lang output in layout files. Added some css to style langmenu + removed redundant loginicon in pagelayout.css 2012-06-30 00:50:34 +01:00
Frederic Massart 3e0b5f78a2 MDL-32297 Forms: Date Picker JS popup is not constraint to parent form 2012-06-29 14:18:59 +08:00
Aparup Banerjee b574c078a6 MDL-34096 Installation : Added 2.3 upgrade line to db upgrade scripts. 2012-06-29 11:37:01 +08:00
Frederic Massart 37817a0cd8 MDL-34077 Repositories: Flickr and Picasa can have custom names 2012-06-28 12:12:32 +08:00
Adam Olley a44c303d63 MDL-31802: Remove section summaries from navigation_cache 2012-06-28 11:03:49 +09:30
Tim Hunt e5ff0d3278 MDL-33924 quiz: incorrect foreign key definition.
Thanks to Jean-Michel Vedrine for spotting this.≈
2012-06-27 08:26:26 +01:00
Mark Nelson faca708484 MDL-34025 - quiz secure window: fix popup closing 2012-06-27 14:31:03 +08:00
Ankit Agarwal fc14c79fc9 MDL-32605 calendar: Fixing the missing parameter for get_string call 2012-06-27 13:34:39 +08:00
Aaron Barnes 2670a3a684 MDL-34044 completion: Fix regression caused by MDL-26626 2012-06-27 11:54:41 +12:00
David Mudrák d81d6ea2c3 MDL-33453 Make it clear what search_references() and search_references_count() are good for
Initially it was not clear enough that these two methods are supposed to
be used for looking for references to a stored_file only. So the docs
comments are improved and unittests added to illustrate the usage.

The patch also removes the unittest for get_references_by_storedfile()
as its usage is already covered in other test methods.
2012-06-26 16:28:30 +02:00
Tim Hunt b0cf55f145 MDL-34008 formslib: repeat_elements replace {no} for submits & buttons 2012-06-26 10:38:50 +01:00
Tim Hunt 5af6c9676e MDL-33780 question import: strip UTF8 BOM
Previously, if there was a byte-order mark at the start of the file, the
import would just break, which was silly. Much better to just strip it
off.
2012-06-26 10:34:19 +01:00
Tim Hunt 225e058685 MDL-30883 question flags: aria attributes for accessibility
Also, update code to use html_writer, and fix pointer style when not
editable.
2012-06-26 10:31:36 +01:00
Tim Hunt 3d348a3cc7 MDL-32062 question engine: fix re-grading attempts from 2.0
The code to upgrade attempts from before Moodle 2.0 to 2.1 created
attempt data that was not exactly the same as a new attempt created in
2.1+. This did not matter very much - revew and the quiz reports all
worked OK - but it broke on re-grade.

These changes detect the problem data in the re-grade code, an apply a
work-around so that the re-grade gives the correct result.
2012-06-26 10:11:37 +01:00
David Mudrák 896f9ae83b MDL-34019 Fix response item key name 2012-06-26 09:12:35 +02:00
Mary Evans 11824b0461 MDL-33987_M23 theme_anomaly: amended some css values to style dock better also removed exclude parent theme stylesheet as it refered to a none existant file in base theme. 2012-06-26 03:40:37 +01:00
Aaron Barnes 9b57d5bc38 MDL-32249 completion: Make grade criteria more consistent
Also, round course grades and remove hardcoded string.

Note: This patch also removes the ability to update the course grade
from the completion interface
2012-06-26 14:12:53 +12:00
22998 changed files with 1289597 additions and 3196487 deletions
-90
View File
@@ -1,90 +0,0 @@
# Generated by "grunt ignorefiles"
*/**/yui/src/*/meta/
*/**/build/
node_modules/
vendor/
admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js
auth/cas/CAS/
cache/stores/mongodb/MongoDB/
enrol/lti/ims-blti/
filter/algebra/AlgParser.pm
filter/tex/mimetex.*
lib/editor/atto/plugins/html/yui/src/codemirror/
lib/editor/atto/plugins/html/yui/src/beautify/
lib/editor/atto/yui/src/rangy/js/*.*
lib/editor/tinymce/plugins/pdw/tinymce/
lib/editor/tinymce/plugins/spellchecker/rpc.php
lib/editor/tinymce/tiny_mce/
lib/mlbackend/php/phpml/
lib/adodb/
lib/bennu/
lib/evalmath/
lib/phpspreadsheet/
lib/google/
lib/htmlpurifier/
lib/jabber/
lib/minify/matthiasmullie-minify/
lib/minify/matthiasmullie-pathconverter/
lib/pear/HTML/Common.php
lib/pear/HTML/QuickForm.php
lib/pear/HTML/QuickForm/
lib/pear/PEAR.php
lib/phpmailer/
lib/simplepie/
lib/tcpdf/
lib/typo3/
lib/yuilib/
lib/yuilib/gallery/
lib/jquery/
lib/html2text/
lib/markdown/
lib/xhprof/
lib/horde/
lib/requirejs/
lib/amd/src/loglevel.js
lib/mustache/
lib/amd/src/mustache.js
lib/graphlib.php
lib/php-css-parser/
lib/rtlcss/
lib/scssphp/
lib/spout/
lib/amd/src/chartjs-lazy.js
lib/maxmind/GeoIp2/
lib/maxmind/MaxMind/
lib/ltiprovider/
lib/amd/src/truncate.js
lib/fonts/
lib/amd/src/adapter.js
lib/validateurlsyntax.php
lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/mdn-polyfills/
lib/emoji-data/
lib/h5p/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
media/player/videojs/amd/src/videojs-flash-lazy.js
media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/index.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/sanitizer.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/toast.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
-249
View File
@@ -1,249 +0,0 @@
{
'plugins': [
'babel',
'promise',
],
'env': {
'browser': true,
'amd': true
},
'globals': {
'M': true,
'Y': true
},
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'warn',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': 'off',
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'off',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'warn',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'use-isnan': 'error',
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
'valid-typeof': 'error',
// === 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-case-declarations': 'error',
'no-div-regex': 'error',
'no-empty-pattern': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-fallthrough': 'error',
'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': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
'no-with': 'error',
'wrap-iife': ['error', 'any'],
// === Variables ===
'no-delete-var': 'error',
'no-undef': 'error',
'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-after-var': 'off',
'newline-before-return': 'off',
'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-mixed-spaces-and-tabs': 'error',
'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',
'require-jsdoc': 'warn',
'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 ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
'promise/no-native': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
'message': 'Use AMD module "core/str" or M.util.get_string()'
}],
},
overrides: [
{
files: ["**/yui/src/**/*.js"],
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off'
}
},
{
files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile*.js", "babel-plugin-add-module-to-define.js"],
// We support es6 now. Woot!
env: {
es6: true
},
// We're using babel transpiling so use their parser
// for linting.
parser: 'babel-eslint',
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'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',
// This is off in the original style int.
'babel/quotes': 'off',
'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'
},
parserOptions: {
'ecmaVersion': 9,
'sourceType': 'module'
}
}
]
}
-20
View File
@@ -1,20 +0,0 @@
{
"indentation": ["on",{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"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-unamed-features": "on",
"no-unamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on"
}
-3
View File
@@ -1,3 +0,0 @@
**/yui/build/** -diff
**/amd/build/** -diff
lib/dml/oci_native_moodle_package.sql text eol=lf
-71
View File
@@ -1,71 +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 | E_STRICT); // 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_';
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');
-103
View File
@@ -1,103 +0,0 @@
name: Core
on: [push]
env:
php: 7.4
jobs:
Grunt:
runs-on: ubuntu-18.04
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Configuring node & npm
shell: bash -l {0}
run: nvm install
- 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
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
php: 7.1
db: mysqli
- os: ubuntu-18.04
php: 7.4
db: pgsql
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: johanmeiring/mysql-action@tmpfs-patch
with:
collation server: utf8mb4_bin
mysql version: 5.7
mysql database: test
mysql user: test
mysql password: test
use tmpfs: true
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 9.6
postgresql db: test
postgresql user: test
postgresql password: test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v3.x
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v2
- 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 admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
run: vendor/bin/phpunit -v
+3 -21
View File
@@ -9,18 +9,10 @@
#
# 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
/lib/editor/tinymce/extra/tools/temp/
*~
*.swp
/tags
/TAGS
/cscope.*
@@ -33,14 +25,4 @@ CVS
/.project
/.buildpath
/.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
/lib/yuilib/*/build/*/*-coverage.js
# lib/yuilib/version/module/module-coverage.js
/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
/node_modules/
phpunit.xml
-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 @@
v14.15.0
-5
View File
@@ -1,5 +0,0 @@
{
"coverage": false,
"lint": "config",
"clean": true
}
-91
View File
@@ -1,91 +0,0 @@
# Generated by "grunt ignorefiles"
**/yui/build/*
theme/boost/style/moodle.css
theme/classic/style/moodle.css
node_modules/
vendor/
admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js
auth/cas/CAS/
cache/stores/mongodb/MongoDB/
enrol/lti/ims-blti/
filter/algebra/AlgParser.pm
filter/tex/mimetex.*
lib/editor/atto/plugins/html/yui/src/codemirror/
lib/editor/atto/plugins/html/yui/src/beautify/
lib/editor/atto/yui/src/rangy/js/*.*
lib/editor/tinymce/plugins/pdw/tinymce/
lib/editor/tinymce/plugins/spellchecker/rpc.php
lib/editor/tinymce/tiny_mce/
lib/mlbackend/php/phpml/
lib/adodb/
lib/bennu/
lib/evalmath/
lib/phpspreadsheet/
lib/google/
lib/htmlpurifier/
lib/jabber/
lib/minify/matthiasmullie-minify/
lib/minify/matthiasmullie-pathconverter/
lib/pear/HTML/Common.php
lib/pear/HTML/QuickForm.php
lib/pear/HTML/QuickForm/
lib/pear/PEAR.php
lib/phpmailer/
lib/simplepie/
lib/tcpdf/
lib/typo3/
lib/yuilib/
lib/yuilib/gallery/
lib/jquery/
lib/html2text/
lib/markdown/
lib/xhprof/
lib/horde/
lib/requirejs/
lib/amd/src/loglevel.js
lib/mustache/
lib/amd/src/mustache.js
lib/graphlib.php
lib/php-css-parser/
lib/rtlcss/
lib/scssphp/
lib/spout/
lib/amd/src/chartjs-lazy.js
lib/maxmind/GeoIp2/
lib/maxmind/MaxMind/
lib/ltiprovider/
lib/amd/src/truncate.js
lib/fonts/
lib/amd/src/adapter.js
lib/validateurlsyntax.php
lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/mdn-polyfills/
lib/emoji-data/
lib/h5p/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
media/player/videojs/amd/src/videojs-flash-lazy.js
media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/index.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/sanitizer.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/toast.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
-95
View File
@@ -1,95 +0,0 @@
{
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true,
"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-blacklist": ["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-blacklist": ["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",
}
}
-260
View File
@@ -1,260 +0,0 @@
# PLEASE NOTE: Travis is not currently utilised by the Moodle core integration
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
notifications:
email:
if: env(MOODLE_EMAIL) != no
language: php
os: linux
dist: xenial
services:
- mysql
- docker
addons:
postgresql: "9.6"
jobs:
# Enable fast finish.
# This will fail the build if a single job fails (except those in allow_failures).
# It will not stop the jobs from running.
fast_finish: true
include:
# First all the lowest php ones (7.1.30)
# Make this sticky because current default version (7.1.11) has a bug with redis-extension output (MDL-66062)
- php: 7.1.30
env: DB=none TASK=CITEST
- php: 7.1.30
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
- if: env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present
php: 7.1.30
env: DB=pgsql TASK=PHPUNIT
- if: env(MOODLE_DATABASE) = "mysqli" OR env(MOODLE_DATABASE) = "all"
php: 7.1.30
env: DB=mysqli TASK=PHPUNIT
# Then, conditionally, all the highest php ones (7.4)
- if: env(MOODLE_PHP) = "all"
php: 7.4
env: DB=none TASK=CITEST
- if: env(MOODLE_PHP) = "all"
php: 7.4
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present)
php: 7.4
env: DB=pgsql TASK=PHPUNIT
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "mysqli" OR env(MOODLE_DATABASE) = "all")
php: 7.4
env: DB=mysqli TASK=PHPUNIT
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
before_install:
- docker run -d -p 127.0.0.1:8080:80 --name exttests moodlehq/moodle-exttests
# Avoid IPv6 default binding as service (causes redis not to start).
- sudo service redis-server start --bind 127.0.0.1
install:
- >
if [ "$DB" = 'mysqli' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo service mysql stop
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo service mysql restart
fi
- >
if [ "$DB" = 'pgsql' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo service postgresql stop
sudo mv /var/lib/postgresql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
sudo service postgresql start 9.6
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
if [ -n "$GITHUB_APITOKEN" ]; then
composer config github-oauth.github.com $GITHUB_APITOKEN;
echo 'auth.json' >> .git/info/exclude
fi
echo 'extension="redis.so"' > /tmp/redis.ini
phpenv config-add /tmp/redis.ini
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
travis_retry composer install --prefer-dist --no-interaction;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
nvm install $NVM_VERSION ;
nvm use $NVM_VERSION ;
fi
before_script:
- phpenv config-rm xdebug.ini
- >
if [ "$TASK" = 'PHPUNIT' ];
then
# Copy generic configuration in place.
cp config-dist.php config.php ;
# Create the moodledata directory.
mkdir -p "$HOME"/roots/base
# The database name and password.
sed -i \
-e "s%= 'moodle'%= 'travis_ci_test'%" \
-e "s%= 'password'%= ''%" \
config.php ;
# The wwwroot and dataroot.
sed -i \
-e "s%http://example.com/moodle%https://localhost%" \
-e "s%/home/example/moodledata%/home/travis/roots/base%" \
config.php ;
if [ "$DB" = 'pgsql' ];
then
# Postgres-specific setup.
sed -i \
-e "s%= 'username'%= 'postgres'%" \
config.php ;
psql -c 'CREATE DATABASE travis_ci_test;' -U postgres;
fi
if [ "$DB" = 'mysqli' ];
then
# MySQL-specific setup.
sed -i \
-e "s%= 'pgsql'%= 'mysqli'%" \
-e "s%= 'username'%= 'travis'%" \
-e "s%=> 'utf8mb4_unicode_ci'%=> 'utf8mb4_bin'%" \
config.php;
mysql -u root -e 'SET GLOBAL innodb_file_format=barracuda;' ;
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
mysql -u root -e 'SET GLOBAL innodb_large_prefix=ON;' ;
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;' ;
fi
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Enable test external resources
sed -i \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://127.0.0.1:8080');" \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://127.0.0.1:8080');" \
config.php ;
# Redis cache store tests
sed -i \
-e "/require_once/i \\define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');" \
config.php ;
# Redis session tests, but not for PHP 7.2 and up. See MDL-60978 for more info.
redissession="define('TEST_SESSION_REDIS_HOST', '127.0.0.1');"
sed -i \
-e "/require_once/i \\${redissession}" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
npm install --no-spin;
npm install --no-spin -g grunt ;
fi
########################################################################
# CI Tests
########################################################################
- >
if [ "$TASK" = 'CITEST' ];
then
# Note - this is deliberately placed in the script section as we
# should not add any code until after phpunit has run.
# The following repositories are required.
# The local_ci repository does the actual checking.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci
# We need the official upstream for comparison
git remote add upstream https://github.com/moodle/moodle.git;
git fetch upstream MOODLE_38_STABLE;
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
export GIT_COMMIT="$TRAVIS_COMMIT";
export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD`
# Variables required by our linter.
export gitcmd=`which git`;
export gitdir="$TRAVIS_BUILD_DIR";
export phpcmd=`which php`;
fi
script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit --fail-on-risky --disallow-test-output --verbose;
fi
- >
if [ "$TASK" = 'CITEST' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
grunt ;
# 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.
git add . ;
git reset -- npm-shrinkwrap.json ;
git diff --cached --exit-code ;
fi
after_script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
EXTTESTS_HITS=$(docker logs exttests 2>&1 | grep -Fv -e 'AH00558' -e '[pid 1]' | wc -l)
echo -e "\nTest local resources number of hits: ${EXTTESTS_HITS}.\n"
fi
-56
View File
@@ -1,56 +0,0 @@
CONTRIBUTING TO MOODLE
======================
Moodle is made by people like you. We are members of a big worldwide community
of developers, designers, teachers, testers, translators and other users. We
work in universities, schools, companies and other places. You are very welcome
to join us and contribute to the project.
See <https://docs.moodle.org/dev/Contributing_to_Moodle> for the many ways you
can help, not only with coding.
Moodle is open to community contributions to core, though all code must go
through peer-review, automated behaviour testing, continuous integration and
human post-integration checks.
Pull requests
-------------
Please do not open pull requests via Github. The repository there is just a
mirror of the official repository at <https://git.moodle.org>. Issues are
reported and patches provided via <https://tracker.moodle.org>. See below for
more information.
Moodle core bug fixes and new features
--------------------------------------
During the years of intensive development, a mature process of including
submitted patches has evolved.
* Every bug fix or new feature must have a tracker issue.
* You publish the branch implementing the fix or new feature in your public
clone of the moodle.git repository (typically on Github).
* Your patch is peer-reviewed, discussed, integrated, tested and then released
as a part of moodle.git.
* New features are developed on the master branch. Bug fixes are also
backported to currently supported maintenance (stable) branches.
For further details, see <https://docs.moodle.org/dev/Process>.
Moodle plugins
--------------
Moodle has a framework for additional plugins to extend its functionality. We
have a Moodle plugins directory <https://moodle.org/plugins/> where you can
register and maintain your plugin. Plugins hosted in the plugins directory can
be easily installed and updated via the Moodle administration interface.
* You are expected to have a public source code repository with your plugin
code.
* After registering your plugin in the plugins directory it is reviewed before
being published.
* You are expected to continuously release updated versions of the plugin via
the plugins directory. We do not pull from your code repository; you must do
it explicitly.
For further details, see <https://docs.moodle.org/dev/Plugin_contribution>.
-661
View File
@@ -1,661 +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 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Grunt configuration
*/
/* eslint-env node */
module.exports = function(grunt) {
var path = require('path'),
tasks = {},
cwd = process.env.PWD || process.cwd(),
async = require('async'),
DOMParser = require('xmldom').DOMParser,
xpath = require('xpath'),
semver = require('semver'),
watchman = require('fb-watchman'),
watchmanClient = new watchman.Client(),
gruntFilePath = process.cwd();
// Verify the node version is new enough.
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
var actual = semver.valid(process.version);
if (!semver.satisfies(actual, expected)) {
grunt.fail.fatal('Node version not satisfied. Require ' + expected + ', version installed: ' + actual);
}
// Windows users can't run grunt in a subdirectory, so allow them to set
// the root by passing --root=path/to/dir.
if (grunt.option('root')) {
var root = grunt.option('root');
if (grunt.file.exists(__dirname, root)) {
cwd = path.join(__dirname, root);
grunt.log.ok('Setting root to ' + cwd);
} else {
grunt.fail.fatal('Setting root to ' + root + ' failed - path does not exist');
}
}
var files = null;
if (grunt.option('files')) {
// Accept a comma separated list of files to process.
files = grunt.option('files').split(',');
}
var inAMD = path.basename(cwd) == 'amd';
// Globbing pattern for matching all AMD JS source files.
var amdSrc = [];
if (inAMD) {
amdSrc.push(cwd + "/src/*.js");
amdSrc.push(cwd + "/src/**/*.js");
} else {
amdSrc.push("**/amd/src/*.js");
amdSrc.push("**/amd/src/**/*.js");
}
/**
* Function to generate the destination for the uglify 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.
*/
var babelRename = function(destPath, srcPath) {
destPath = srcPath.replace('src', 'build');
destPath = destPath.replace('.js', '.min.js');
return destPath;
};
/**
* Find thirdpartylibs.xml and generate an array of paths contained within
* them (used to generate ignore files and so on).
*
* @return {array} The list of thirdparty paths.
*/
var getThirdPartyPathsFromXML = function() {
var thirdpartyfiles = grunt.file.expand('*/**/thirdpartylibs.xml');
var libs = ['node_modules/', 'vendor/'];
thirdpartyfiles.forEach(function(file) {
var dirname = path.dirname(file);
var doc = new DOMParser().parseFromString(grunt.file.read(file));
var nodes = xpath.select("/libraries/library/location/text()", doc);
nodes.forEach(function(node) {
var lib = path.join(dirname, node.toString());
if (grunt.file.isDir(lib)) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
});
});
return libs;
};
// Project configuration.
grunt.initConfig({
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)
},
amd: {src: files ? files : amdSrc},
// Check YUI module source files.
yui: {src: files ? files : ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
},
babel: {
options: {
sourceMaps: true,
comments: 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('babel-plugin-add-module-to-define.js'),
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', {'loose': false}],
'@babel/plugin-proposal-json-strings'
],
presets: [
['minify', {
// This minification plugin needs to be disabled because it breaks the
// source map generation and causes invalid source maps to be output.
simplify: false,
builtIns: false
}],
['@babel/preset-env', {
targets: {
browsers: [
">0.25%",
"last 2 versions",
"not ie <= 10",
"not op_mini all",
"not Opera > 0",
"not dead"
]
},
modules: false,
useBuiltIns: false
}]
]
},
dist: {
files: [{
expand: true,
src: files ? files : amdSrc,
rename: babelRename
}]
}
},
sass: {
dist: {
files: {
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss",
"theme/classic/style/moodle.css": "theme/classic/scss/classicgrunt.scss"
}
},
options: {
includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
}
},
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
amd: {
files: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
boost: {
files: ['**/theme/boost/scss/**/*.scss'],
tasks: ['scss']
},
rawcss: {
files: ['**/*.css', '**/theme/**/!(moodle.css|editor.css)'],
tasks: ['rawcss']
},
yui: {
files: ['**/yui/src/**/*.js'],
tasks: ['yui']
},
gherkinlint: {
files: ['**/tests/behat/*.feature'],
tasks: ['gherkinlint']
}
},
shifter: {
options: {
recursive: true,
paths: files ? files : [cwd]
}
},
gherkinlint: {
options: {
files: files ? files : ['**/tests/behat/*.feature'],
}
},
stylelint: {
scss: {
options: {syntax: 'scss'},
src: files ? files : ['*/**/*.scss']
},
css: {
src: files ? files : ['*/**/*.css'],
options: {
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
}
}
}
});
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
tasks.ignorefiles = function() {
// An array of paths to third party directories.
var thirdPartyPaths = getThirdPartyPathsFromXML();
// Generate .eslintignore.
var eslintIgnores = ['# Generated by "grunt ignorefiles"', '*/**/yui/src/*/meta/', '*/**/build/'].concat(thirdPartyPaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n'));
// Generate .stylelintignore.
var stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'**/yui/build/*',
'theme/boost/style/moodle.css',
'theme/classic/style/moodle.css',
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n'));
};
/**
* 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().
*/
tasks.shifter = function() {
var done = this.async(),
options = grunt.config('shifter.options');
// 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(__dirname + '/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);
};
tasks.gherkinlint = function() {
const done = this.async();
const options = grunt.config('gherkinlint.options');
// Grab the gherkin-lint linter and required scaffolding.
const linter = require('gherkin-lint/src/linter.js');
const featureFinder = require('gherkin-lint/src/feature-finder.js');
const configParser = require('gherkin-lint/src/config-parser.js');
const formatter = require('gherkin-lint/src/formatters/stylish.js');
// Run the linter.
const results = linter.lint(
featureFinder.getFeatureFiles(grunt.file.expand(options.files)),
configParser.getConfiguration(configParser.defaultConfigFileName)
);
// Print the results out uncondtionally.
formatter.printResults(results);
// Report on the results.
// The done function takes a bool whereby a falsey statement causes the task to fail.
done(results.every(result => result.errors.length === 0));
};
tasks.startup = function() {
// Are we in a YUI directory?
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
grunt.task.run('yui');
// Are we in an AMD directory?
} else if (inAMD) {
grunt.task.run('amd');
} else {
// Run them all!.
grunt.task.run('css');
grunt.task.run('js');
grunt.task.run('gherkinlint');
}
};
/**
* 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.
*/
tasks.watch = function() {
var watchTaskDone = this.async();
var watchInitialised = false;
var watchTaskQueue = {};
var processingQueue = false;
// 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.
grunt.util.spawn(
{
// Spawn with the grunt bin.
grunt: true,
// Run from current working dir and inherit stdio from process.
opts: {
cwd: cwd,
stdio: 'inherit'
},
args: [task, filesOption]
},
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();
}
);
};
var watchConfig = grunt.config.get(['watch']);
watchConfig = Object.keys(watchConfig).reduce(function(carry, key) {
if (key == 'options') {
return carry;
}
var value = watchConfig[key];
var fileGlobs = value.files;
var taskNames = value.tasks;
taskNames.forEach(function(taskName) {
carry[taskName] = fileGlobs;
});
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 = cwd + '/' + file.name;
Object.keys(watchConfig).forEach(function(task) {
var fileGlobs = watchConfig[task];
var match = fileGlobs.every(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(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', cwd], 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;
}
// Use the matching patterns specified in the watch config.
var matches = Object.keys(watchConfig).map(function(task) {
var fileGlobs = watchConfig[task];
var fileGlobMatches = fileGlobs.map(function(fileGlob) {
return ['match', fileGlob, 'wholename'];
});
return ['allof'].concat(fileGlobMatches);
});
var sub = {
expression: ["anyof"].concat(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 ' + cwd);
});
});
});
};
// 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).
var changedFiles = Object.create(null);
var onChange = grunt.util._.debounce(function() {
var files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
grunt.config('shifter.options.paths', files);
grunt.config('gherkinlint.options.files', files);
grunt.config('babel.dist.files', [{expand: true, src: files, rename: babelRename}]);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
});
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-stylelint');
grunt.loadNpmTasks('grunt-babel');
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
grunt.renameTask('watch', 'watch-grunt');
// Register JS tasks.
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', tasks.gherkinlint);
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
grunt.registerTask('watch', 'Run tasks on file changes', tasks.watch);
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['eslint:amd', 'babel']);
grunt.registerTask('js', ['amd', 'yui']);
// Register CSS taks.
grunt.registerTask('css', ['stylelint:scss', 'sass', 'stylelint:css']);
grunt.registerTask('scss', ['stylelint:scss', 'sass']);
grunt.registerTask('rawcss', ['stylelint:css']);
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
// Register the default task.
grunt.registerTask('default', ['startup']);
};
-20
View File
@@ -1,20 +0,0 @@
MOODLE INSTALLATION
===================
Here is a short summary of the installation process (which can take just a few
minutes):
1. Move the Moodle files into your web directory.
2. Create a single database for Moodle to store all its tables in (or choose an
existing database).
3. Visit your Moodle site with a browser. You should be taken to the
install.php script, which will lead you through creating a config.php file
and then setting up Moodle, creating an admin account etc.
4. Set up a cron task to call the file admin/cron.php every minute.
For more information, see <https://docs.moodle.org/en/Installing_Moodle>.
Good luck and have fun!
-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.txt guidelines for how to contribute patches for Moodle. Thank you.
--
+22 -21
View File
@@ -1,28 +1,29 @@
.-..-.
_____ | || |
/____/-.---_ .---. .---. .-.| || | .---.
| | _ _ |/ _ \/ _ \/ _ || |/ __ \
* | | | | | || |_| || |_| || |_| || || |___/
|_| |_| |_|\_____/\_____/\_____||_|\_____)
QUICK INSTALL
=============
Moodle - the world's open source learning platform
For the impatient, here is a basic outline of the
installation process, which normally takes me only
a few minutes:
Moodle <https://moodle.org> is a learning platform designed to provide
educators, administrators and learners with a single robust, secure and
integrated system to create personalised learning environments.
1) Move the Moodle files into your web directory.
You can download Moodle <https://download.moodle.org> and run it on your own
web server, ask one of our Moodle Partners <https://moodle.com/partners/> to
assist you, or have a MoodleCloud site <https://moodle.com/cloud/> set up for
you.
2) Create a single database for Moodle to store all
it's tables in (or choose an existing database).
Moodle is widely used around the world by universities, schools, companies and
all manner of organisations and individuals.
3) Visit your Moodle site with a browser, you should
be taken to the install.php script, which will lead
you through creating a config.php file and then
setting up Moodle, creating an admin account etc.
Moodle is provided freely as open source software, under the GNU General Public
License <https://docs.moodle.org/dev/License>.
4) Set up a cron task to call the file admin/cron.php
every five minutes or so.
Moodle is written in PHP and JavaScript and uses an SQL database for storing
the data.
See <https://docs.moodle.org> for details of Moodle's many features.
For more information, see the INSTALL DOCUMENTATION:
http://docs.moodle.org/en/Installing_Moodle
Good luck and have fun!
Martin Dougiamas, Lead Developer
+28 -42
View File
@@ -1,48 +1,34 @@
MOODLE TRADEMARKS POLICY
========================
------------------------
Moodle Trademark License
------------------------
The word "Moodle" is trademarked in many countries around the world. The word
was originally an acronym: Modular Object-Oriented Dynamic Learning
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
of Moodle.
The name Moodle is a registered trademark of the Moodle Trust.
The law obligates trademark owners to police their marks and prevent the use of
confusingly similar names by third parties. Through this policy wed like to
make it clear how Moodle-related projects, organisations, and people can use
the Moodle trademark. Wed also like to be clear about how use of the word is
restricted when used to promote commercial Moodle services. We do this to
protect the very business model that allows us to continue developing Moodle
for you.
A key part of the business model that allows us to produce and
distribute Moodle as completely Free open source software is that
we restrict the commercial use of the Moodle trademark to those
who have contracted to support Moodle development (Moodle Partners).
Allowed uses
------------
If you are intending to use the name (and/or logo) to advertise
generic Moodle™ services (eg Moodle Hosting, Moodle Support,
Moodle Certification, Moodle Training, Moodle Consulting,
Moodle Customisation, Moodle Courseware Development, Moodle
Theme design, Moodle Integrations, Moodle Installations, etc)
or as the name of a software package, then you must seek
direct permission in writing from the Moodle Trust via the
moodle.com helpdesk, in accordance with normal trademark
restrictions.
The following uses dont require any permission at all:
There are no restrictions on how you use the name in other
contexts (for example, if you use Moodle just to provide
courses then you can use the name freely to refer to it.)
* Referring to the software or the Moodle project.
* Describing your own Moodle implementation (including within corporate
settings).
* Describing a Moodle-based community hub.
* Describing some software youve made that integrates with Moodle
(eg a Moodle integration feature on another system).
If you aren't sure of a particular case, please ask us via
http://moodle.com/helpdesk: we'll be happy to either provide
you with official permission in writing or help you fix
your wording.
Restricted uses
---------------
The following uses are generally prohibited without explicit and direct
permission being granted to you by Moodle Pty Ltd. We do this to protect the
Moodle project from software and sites which could confuse people. Please
contact us to ask for permission in writing.
* You cant use "Moodle" in the name of your software (including Mobile apps)
* You cant use "Moodle" in your company name
* You cant use "Moodle" in your domain name
* You cant use "Moodle" in advertising-related keywords (such as Adsense)
* You cant use "Moodle" to describe services around Moodle (such as hosting,
training, support, consulting, course creation services, theme development,
customisation, installation, integration and certification). This applies
even if you do not charge for the services. Note that usually only Moodle
Partners have this permission.
For information about the Moodle Partner Certification Mark as well as for how
to contact us, please see <https://moodle.com/trademarks/>.
Martin Dougiamas
Executive Director
Moodle Trust
http://moodle.com
-48
View File
@@ -1,48 +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/>.
/**
* Admin settings search form
*
* @package admin
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once $CFG->libdir.'/formslib.php';
/**
* Admin settings search form
*
* @package admin
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_settings_search_form extends moodleform {
function definition () {
$mform = $this->_form;
//$mform->addElement('header', 'settingsheader', get_string('search', 'admin'));
$elements = [];
$elements[] = $mform->createElement('text', 'query', get_string('query', 'admin'));
$elements[] = $mform->createElement('submit', 'search', get_string('search'));
$mform->addGroup($elements);
$mform->setType('query', PARAM_RAW);
$mform->setDefault('query', optional_param('query', '', PARAM_RAW));
}
}
-105
View File
@@ -1,105 +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/>.
/**
* Allows admin to configure antiviruses.
*
* @package core_antivirus
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$antivirus = required_param('antivirus', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/antiviruses.php', array('action' => $action, 'antivirus' => $antivirus));
$PAGE->set_context(context_system::instance());
require_admin();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageantiviruses";
// Get currently installed and enabled antivirus plugins.
$availableantiviruses = \core\antivirus\manager::get_available();
if (!empty($antivirus) and empty($availableantiviruses[$antivirus])) {
redirect ($returnurl);
}
$activeantiviruses = explode(',', $CFG->antiviruses);
foreach ($activeantiviruses as $key => $active) {
if (empty($availableantiviruses[$active])) {
unset($activeantiviruses[$key]);
}
}
if (!confirm_sesskey()) {
redirect($returnurl);
}
switch ($action) {
case 'disable':
// Remove from enabled list.
$key = array_search($antivirus, $activeantiviruses);
unset($activeantiviruses[$key]);
break;
case 'enable':
// Add to enabled list.
if (!in_array($antivirus, $activeantiviruses)) {
$activeantiviruses[] = $antivirus;
$activeantiviruses = array_unique($activeantiviruses);
}
break;
case 'down':
$key = array_search($antivirus, $activeantiviruses);
// Check auth plugin is valid.
if ($key !== false) {
// Move down the list.
if ($key < (count($activeantiviruses) - 1)) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key + 1];
$activeantiviruses[$key + 1] = $fsave;
}
}
break;
case 'up':
$key = array_search($antivirus, $activeantiviruses);
// Check auth is valid.
if ($key !== false) {
// Move up the list.
if ($key >= 1) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key - 1];
$activeantiviruses[$key - 1] = $fsave;
}
}
break;
default:
break;
}
set_config('antiviruses', implode(',', $activeantiviruses));
core_plugin_manager::reset_caches();
redirect ($returnurl);
+5 -6
View File
@@ -11,13 +11,14 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_admin();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
$PAGE->set_url($returnurl);
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_PLUGIN);
get_enabled_auth_plugins(true); // fix the list of enabled auths
@@ -50,8 +51,7 @@ switch ($action) {
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
session_gc(); // remove stale sessions
break;
case 'enable':
@@ -61,8 +61,7 @@ switch ($action) {
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
session_gc(); // remove stale sessions
break;
case 'down':
+17 -50
View File
@@ -16,9 +16,6 @@ $err = array();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
debugging("Use of config.html files in authentication plugins have been deprecated. " .
" Please migrate your plugin to use the admin settings API", DEBUG_DEVELOPER);
// save configuration changes
if ($frm = data_submitted() and confirm_sesskey()) {
@@ -81,36 +78,17 @@ echo '<p style="text-align: center"><input type="submit" value="' . get_string("
echo "</div>\n";
echo "</form>\n";
$PAGE->requires->string_for_js('unmaskpassword', 'core_form');
$PAGE->requires->yui_module('moodle-auth-passwordunmask', 'M.auth.passwordunmask');
echo $OUTPUT->footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
/**
* auth field locking
* Good enough for most auth plugins
* but some may want a custom one if they are offering
* other options
* Note: lockconfig_ fields have special handling.
*
* @param string $auth authentication plugin shortname
* @param array $user_fields user profile fields
* @param string $helptext help text to be displayed at top of form
* @param boolean $retrieveopts Map fields or lock only.
* @param boolean $updateopts Allow remote updates
* @param array $customfields list of custom profile fields
* @deprecated since Moodle 3.3
*/
function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts, $updateopts, $customfields = array()) {
global $DB, $OUTPUT;
debugging("The function 'print_auth_lock_options' has been deprecated, " .
"Please migrate your code to use the admin settings API and use the function 'display_auth_lock_options' instead. ",
DEBUG_DEVELOPER);
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: lockconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
global $OUTPUT;
echo '<tr><td colspan="3">';
if ($retrieveopts) {
echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
@@ -129,21 +107,14 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
$pluginconfig = get_config("auth/$auth");
// Helptext is on a field with rowspan.
// helptext is on a field with rowspan
if (empty($helptext)) {
$helptext = '&nbsp;';
$helptext = '&nbsp;';
}
// If we have custom fields then merge them with user fields.
if (!empty($customfields)) {
$user_fields = array_merge($user_fields, $customfields);
}
if (!empty($customfields)) {
$customfieldname = $DB->get_records('user_info_field', null, '', 'shortname, name');
}
foreach ($user_fields as $field) {
// Define some vars we'll work with.
// Define some vars we'll work with
if (!isset($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
@@ -157,20 +128,12 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
$pluginconfig->{"field_lock_$field"} = '';
}
// Define the fieldname we display to the user.
// define the fieldname we display to the user
$fieldname = $field;
if ($fieldname === 'lang') {
$fieldname = get_string('language');
} elseif (!empty($customfields) && in_array($field, $customfields)) {
// If custom field then pick name from database.
$fieldshortname = str_replace('profile_field_', '', $fieldname);
$fieldname = $customfieldname[$fieldshortname]->name;
if (core_text::strlen($fieldshortname) > 67) {
// If custom profile field name is longer than 67 characters we will not be able to store the setting
// such as 'field_updateremote_profile_field_NOTSOSHORTSHORTNAME' in the database because the character
// limit for the setting name is 100.
continue;
}
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {
@@ -192,6 +155,8 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
echo html_writer::select($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, false);
echo '<br />';
}
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
@@ -210,3 +175,5 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
echo '</tr>';
}
}
+76
View File
@@ -0,0 +1,76 @@
<?php
// block.php - allows admin to edit all local configuration variables for a block
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$blockid = required_param('block', PARAM_INT);
if(!$blockrecord = blocks_get_record($blockid)) {
print_error('blockdoesnotexist', 'error');
}
admin_externalpage_setup('blocksetting'.$blockrecord->name);
$block = block_instance($blockrecord->name);
if($block === false) {
print_error('blockcannotinistantiate', 'error');
}
// Define the data we're going to silently include in the instance config form here,
// so we can strip them from the submitted data BEFORE handling it.
$hiddendata = array(
'block' => $blockid,
'sesskey' => sesskey()
);
/// If data submitted, then process and store.
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
if(!$block->has_config()) {
print_error('blockcannotconfig', 'error');
}
$remove = array_keys($hiddendata);
foreach($remove as $item) {
unset($config->$item);
}
$block->config_save($config);
redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1);
exit;
}
/// Otherwise print the form.
$strmanageblocks = get_string('manageblocks');
$strblockname = $block->get_title();
echo $OUTPUT->header();
echo $OUTPUT->heading($strblockname);
echo $OUTPUT->notification('This block still uses an old-style config_global.html file. ' .
'It must be updated by a developer to use a settings.php file.');
echo $OUTPUT->box(get_string('configwarning', 'admin'), 'generalbox boxwidthnormal boxaligncenter');
echo '<br />';
echo '<form method="post" action="block.php">';
echo '<p>';
foreach($hiddendata as $name => $val) {
echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
}
echo '</p>';
echo $OUTPUT->box_start();
include($CFG->dirroot.'/blocks/'. $block->name() .'/config_global.html');
echo $OUTPUT->box_end();
echo '</form>';
echo $OUTPUT->footer();
+77 -49
View File
@@ -1,10 +1,9 @@
<?php
// Allows the admin to configure blocks (hide/show, uninstall and configure)
// Allows the admin to configure blocks (hide/show, delete and configure)
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('manageblocks');
@@ -12,13 +11,14 @@
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_INT);
$unprotect = optional_param('unprotect', 0, PARAM_INT);
$protect = optional_param('protect', 0, PARAM_INT);
/// Print headings
$strmanageblocks = get_string('manageblocks');
$struninstall = get_string('uninstallplugin', 'core_admin');
$strdelete = get_string('delete');
$strversion = get_string('version');
$strhide = get_string('hide');
$strshow = get_string('show');
@@ -37,8 +37,6 @@
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
add_to_config_log('block_visibility', $block->visible, '0', $block->name);
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
@@ -47,22 +45,67 @@
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
add_to_config_log('block_visibility', $block->visible, '1', $block->name);
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
if (!isset($CFG->undeletableblocktypes) || (!is_array($CFG->undeletableblocktypes) && !is_string($CFG->undeletableblocktypes))) {
$undeletableblocktypes = array('navigation', 'settings');
} else if (is_string($CFG->undeletableblocktypes)) {
$undeletableblocktypes = explode(',', $CFG->undeletableblocktypes);
} else {
$undeletableblocktypes = $CFG->undeletableblocktypes;
}
if (!empty($protect) && confirm_sesskey()) {
block_manager::protect_block((int)$protect);
if (!$block = $DB->get_record('block', array('id'=>$protect))) {
print_error('blockdoesnotexist', 'error');
}
if (!in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes[] = $block->name;
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
}
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($unprotect) && confirm_sesskey()) {
block_manager::unprotect_block((int)$unprotect);
if (!$block = $DB->get_record('block', array('id'=>$unprotect))) {
print_error('blockdoesnotexist', 'error');
}
if (in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
}
admin_get_root(true, false); // settings not required - only pages
}
$undeletableblocktypes = block_manager::get_undeletable_block_types();
if (!empty($delete) && confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
if (!$block = blocks_get_record($delete)) {
print_error('blockdoesnotexist', 'error');
}
if (get_string_manager()->string_exists('pluginname', "block_$block->name")) {
$strblockname = get_string('pluginname', "block_$block->name");
} else {
$strblockname = $block->name;
}
if (!$confirm) {
echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1', 'blocks.php');
echo $OUTPUT->footer();
exit;
} else {
uninstall_plugin('block', $block->name);
$a = new stdClass();
$a->block = $strblockname;
$a->directory = $CFG->dirroot.'/blocks/'.$block->name;
notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
@@ -81,11 +124,10 @@
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'settings', 'uninstall'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strsettings, $struninstall));
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'delete', 'settings'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
$table->set_attribute('id', 'compatibleblockstable');
$table->set_attribute('class', 'compatibleblockstable blockstable generaltable');
$table->setup();
$tablerows = array();
@@ -99,18 +141,17 @@
$blocknames[$blockid] = $blockname;
}
}
core_collator::asort($blocknames);
collatorlib::asort($blocknames);
foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
$blockname = $block->name;
$dbversion = get_config('block_'.$block->name, 'version');
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$strblockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
$plugin->version = $dbversion;
$plugin->version = $block->version;
} else {
$plugin = new stdClass();
@@ -125,11 +166,7 @@
}
}
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$blockname, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
} else {
$uninstall = '';
}
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>';
$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
@@ -139,12 +176,8 @@
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
} else if ($blocksettings instanceof admin_settingpage) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else if (!file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
// If the block's settings node was not found, we check that the block really provides the settings.php file.
// Note that blocks can inject their settings to other nodes in the admin tree without using the default locations.
// This can be done by assigning null to $setting in settings.php and it is a valid case.
debugging('Warning: block_'.$block->name.' returns true in has_config() but does not provide a settings.php file',
DEBUG_DEVELOPER);
} else {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
}
}
@@ -168,17 +201,17 @@
$visible = '';
} else if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strhide.'">'.
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
'<img src="'.$OUTPUT->pix_url('i/hide') . '" class="icon" alt="'.$strhide.'" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
$class = 'dimmed_text';
'<img src="'.$OUTPUT->pix_url('i/show') . '" class="icon" alt="'.$strshow.'" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($dbversion == $plugin->version) {
$version = $dbversion;
if ($block->version == $plugin->version) {
$version = $block->version;
} else {
$version = "$dbversion ($plugin->version)";
$version = "$block->version ($plugin->version)";
}
if (!$blockobject) {
@@ -186,22 +219,22 @@
$undeletable = '';
} else if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strunprotect.'">'.
$OUTPUT->pix_icon('t/unlock', $strunprotect) . '</a>';
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="icon" alt="'.$strunprotect.'" /></a>';
} else {
$undeletable = '<a href="blocks.php?protect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strprotect.'">'.
$OUTPUT->pix_icon('t/lock', $strprotect) . '</a>';
'<img src="'.$OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="'.$strprotect.'" /></a>';
}
$row = array(
$strblockname,
'<span'.$class.'>'.$strblockname.'</span>',
$blocklist,
$version,
'<span'.$class.'>'.$version.'</span>',
$visible,
$undeletable,
$settings,
$uninstall,
$delete,
$settings
);
$table->add_data($row, $class);
$table->add_data($row);
}
$table->print_html();
@@ -211,8 +244,8 @@
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'uninstall'));
$table->define_headers(array($strname, $struninstall));
$table->define_columns(array('block', 'delete'));
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
@@ -220,14 +253,9 @@
$table->setup();
foreach ($incompatible as $block) {
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$block->name, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
} else {
$uninstall = '';
}
$table->add_data(array(
$block->name,
$uninstall,
'<a href="blocks.php?delete='.$block->id.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>',
));
}
$table->print_html();
+35 -36
View File
@@ -17,7 +17,7 @@
/**
* This file is used to display a categories sub categories, external pages, and settings.
*
* @since Moodle 2.3
* @since 2.3
* @package admin
* @copyright 2011 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -30,8 +30,9 @@ $category = required_param('category', PARAM_SAFEDIR);
$return = optional_param('return','', PARAM_ALPHA);
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
/// no guest autologin
require_login(0, false);
$PAGE->set_context(context_system::instance());
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
$PAGE->set_url('/admin/category.php', array('category' => $category));
$PAGE->set_pagetype('admin-setting-' . $category);
$PAGE->set_pagelayout('admin');
@@ -53,28 +54,27 @@ $statusmsg = '';
$errormsg = '';
if ($data = data_submitted() and confirm_sesskey()) {
$count = admin_write_settings($data);
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
}
if (empty($adminroot->errors)) {
// No errors. Did we change any setting? If so, then indicate success.
if ($count) {
$statusmsg = get_string('changessaved');
} else {
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
} else {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
}
$adminroot = admin_get_root(true); //reload tree
$settingspage = $adminroot->locate($category, true);
}
if ($PAGE->user_allowed_editing() && $adminediting != -1) {
$USER->editing = $adminediting;
}
$buttons = null;
if ($PAGE->user_allowed_editing()) {
$url = clone($PAGE->url);
if ($PAGE->user_is_editing()) {
@@ -90,47 +90,46 @@ if ($PAGE->user_allowed_editing()) {
$savebutton = false;
$outputhtml = '';
foreach ($settingspage->children as $childpage) {
if ($childpage->is_hidden() || !$childpage->check_access()) {
if ($childpage->is_hidden()) {
continue;
}
if ($childpage instanceof admin_externalpage) {
$outputhtml .= $OUTPUT->heading(html_writer::link($childpage->url, $childpage->visiblename), 3);
} else if ($childpage instanceof admin_settingpage) {
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/settings.php', array('section' => $childpage->name)), $childpage->visiblename), 3);
// If its a settings page and has settings lets display them.
if (!empty($childpage->settings)) {
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
foreach ($childpage->settings as $setting) {
if (empty($setting->nosave)) {
$savebutton = true;
}
$fullname = $setting->get_full_name();
if (array_key_exists($fullname, $adminroot->errors)) {
$data = $adminroot->errors[$fullname]->data;
} else {
$data = $setting->get_setting();
}
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
$outputhtml .= $setting->output_html($data);
}
$outputhtml .= html_writer::end_tag('fieldset');
}
} else if ($childpage instanceof admin_category) {
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/category.php', array('category' => $childpage->name)), get_string('admincategory', 'admin', $childpage->visiblename)), 3);
} else {
continue;
}
if (!empty($childpage->settings)) {
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
foreach ($childpage->settings as $setting) {
if (empty($setting->nosave)) {
$savebutton = true;
}
$fullname = $setting->get_full_name();
if (array_key_exists($fullname, $adminroot->errors)) {
$data = $adminroot->errors[$fullname]->data;
} else {
$data = $setting->get_setting();
}
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
$outputhtml .= $setting->output_html($data);
}
$outputhtml .= html_writer::end_tag('fieldset');
}
}
if ($savebutton) {
$outputhtml .= html_writer::start_tag('div', array('class' => 'form-buttons'));
$outputhtml .= html_writer::empty_tag('input', array('class' => 'btn btn-primary form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
$outputhtml .= html_writer::empty_tag('input', array('class' => 'form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
$outputhtml .= html_writer::end_tag('div');
}
$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($buttons) {
$PAGE->set_button($buttons);
}
$PAGE->set_button($buttons);
echo $OUTPUT->header();
@@ -158,4 +157,4 @@ echo $outputhtml;
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
echo $OUTPUT->footer();
echo $OUTPUT->footer();
-76
View File
@@ -1,76 +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/>.
/**
* Form for selective purging of caches.
*
* @package core
* @copyright 2018 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\form;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Form for selecting which caches to purge on admin/purgecaches.php
*
* @package core
* @copyright 2018 The Open University
* @author Mark Johnson <mark.johnson@open.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class purge_caches extends \moodleform {
/**
* Define a "Purge all caches" button, and a fieldset with checkboxes for selectively purging separate caches.
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('hidden', 'returnurl', $this->_customdata['returnurl']);
$mform->setType('returnurl', PARAM_LOCALURL);
$mform->addElement('submit', 'all', get_string('purgecaches', 'admin'));
$mform->addElement('header', 'purgecacheheader', get_string('purgeselectedcaches', 'admin'));
$checkboxes = [
$mform->createElement('advcheckbox', 'theme', '', get_string('purgethemecache', 'admin')),
$mform->createElement('advcheckbox', 'lang', '', get_string('purgelangcache', 'admin')),
$mform->createElement('advcheckbox', 'js', '', get_string('purgejscache', 'admin')),
$mform->createElement('advcheckbox', 'template', '', get_string('purgetemplates', 'admin')),
$mform->createElement('advcheckbox', 'filter', '', get_string('purgefiltercache', 'admin')),
$mform->createElement('advcheckbox', 'muc', '', get_string('purgemuc', 'admin')),
$mform->createElement('advcheckbox', 'other', '', get_string('purgeothercaches', 'admin'))
];
$mform->addGroup($checkboxes, 'purgeselectedoptions');
$mform->addElement('submit', 'purgeselectedcaches', get_string('purgeselectedcaches', 'admin'));
}
/**
* If the "Purge selected caches" button was pressed, ensure at least one cache was selected.
*
* @param array $data
* @param array $files
* @return array Error messages
*/
public function validation($data, $files) {
$errors = [];
if (isset($data['purgeselectedcaches']) && empty(array_filter($data['purgeselectedoptions']))) {
$errors['purgeselectedoptions'] = get_string('purgecachesnoneselected', 'admin');
}
return $errors;
}
}
@@ -1,59 +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/>.
/**
* Testing outgoing mail configuration form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\form;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Test mail form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testoutgoingmailconf_form extends \moodleform {
/**
* Add elements to form
*/
public function definition() {
$mform = $this->_form;
// Recipient.
$options = ['maxlength' => '100', 'size' => '25'];
$mform->addElement('text', 'recipient', get_string('testoutgoingmailconf_toemail', 'admin'), $options);
$mform->setType('recipient', PARAM_EMAIL);
$mform->addRule('recipient', get_string('required'), 'required');
$buttonarray = array();
$buttonarray[] = $mform->createElement('submit', 'send', get_string('testoutgoingmailconf_sendtest', 'admin'));
$buttonarray[] = $mform->createElement('cancel');
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$mform->closeHeaderBefore('buttonar');
}
}
-195
View File
@@ -1,195 +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/>.
/**
* File size admin setting.
*
* @package core_admin
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/adminlib.php');
/**
* An admin setting to support entering and displaying of file sizes in Bytes, KB, MB or GB.
*
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class filesize extends \admin_setting {
/** @var int The byte unit. Number of bytes in a byte */
const UNIT_B = 1;
/** @var int The kilobyte unit (number of bytes in a kilobyte) */
const UNIT_KB = 1024;
/** @var int The megabyte unit (number of bytes in a megabyte) */
const UNIT_MB = 1048576;
/** @var int The gigabyte unit (number of bytes in a gigabyte) */
const UNIT_GB = 1073741824;
/** @var int default size unit */
protected $defaultunit;
/**
* Constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings that in config,
* or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised name
* @param string $description localised long description
* @param int|null $defaultvalue Value of the settings in bytes
* @param int|null $defaultunit GB, MB, etc. (in bytes)
*/
public function __construct(string $name, string $visiblename, string $description,
int $defaultvalue = null, int $defaultunit = null) {
$defaultsetting = self::parse_bytes($defaultvalue);
if ($defaultunit && array_key_exists($defaultunit, self::get_units())) {
$this->defaultunit = $defaultunit;
} else {
$this->defaultunit = self::UNIT_MB;
}
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
/**
* Returns selectable units.
*
* @return array
*/
protected static function get_units(): array {
return [
self::UNIT_GB => get_string('sizegb'),
self::UNIT_MB => get_string('sizemb'),
self::UNIT_KB => get_string('sizekb'),
self::UNIT_B => get_string('sizeb'),
];
}
/**
* Converts bytes to some more user friendly string.
*
* @param int $bytes The number of bytes we want to convert from
* @return string
*/
protected static function get_size_text(int $bytes): string {
if (empty($bytes)) {
return get_string('none');
}
return display_size($bytes);
}
/**
* Finds suitable units for given file size.
*
* @param int $bytes The number of bytes
* @return array Parsed file size in the format of ['v' => value, 'u' => unit]
*/
protected static function parse_bytes(int $bytes): array {
foreach (self::get_units() as $unit => $unused) {
if ($bytes % $unit === 0) {
return ['v' => (int)($bytes / $unit), 'u' => $unit];
}
}
return ['v' => (int)$bytes, 'u' => self::UNIT_B];
}
/**
* Get the selected file size as array.
*
* @return array|null An array containing 'v' => xx, 'u' => xx, or null if not set
*/
public function get_setting(): ?array {
$bytes = $this->config_read($this->name);
if (is_null($bytes)) {
return null;
}
return self::parse_bytes($bytes);
}
/**
* Store the file size as bytes.
*
* @param array $data Must be form 'h' => xx, 'm' => xx
* @return string The error string if any
*/
public function write_setting($data): string {
if (!is_array($data)) {
return '';
}
if (!is_numeric($data['v']) || $data['v'] < 0) {
return get_string('errorsetting', 'admin');
}
$bytes = $data['v'] * $data['u'];
$result = $this->config_write($this->name, $bytes);
return ($result ? '' : get_string('errorsetting', 'admin'));
}
/**
* Returns file size text+select fields.
*
* @param array $data The current setting value. Must be form 'v' => xx, 'u' => xx.
* @param string $query Admin search query to be highlighted.
* @return string File size text+select fields and wrapping div(s).
*/
public function output_html($data, $query = ''): string {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_number($default)) {
$defaultinfo = self::get_size_text($default);
} else if (is_array($default)) {
$defaultinfo = self::get_size_text($default['v'] * $default['u']);
} else {
$defaultinfo = null;
}
$inputid = $this->get_id() . 'v';
$units = self::get_units();
$defaultunit = $this->defaultunit;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'value' => $data['v'],
'readonly' => $this->is_readonly(),
'options' => array_map(function($unit, $title) use ($data, $defaultunit) {
return [
'value' => $unit,
'name' => $title,
'selected' => ($data['v'] == 0 && $unit == $defaultunit) || $unit == $data['u']
];
}, array_keys($units), $units)
];
$element = $OUTPUT->render_from_template('core_admin/setting_configfilesize', $context);
return format_admin_setting($this, $this->visiblename, $element, $this->description, $inputid, '', $defaultinfo, $query);
}
}
-41
View File
@@ -1,41 +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/>.
/**
* Privacy Subsystem implementation for core_admin.
*
* @package core_admin
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for core_admin implementing null_provider.
*
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}
-289
View File
@@ -1,289 +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/>.
/**
* Task log table.
*
* @package core_admin
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/tablelib.php');
/**
* Table to display list of task logs.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_log_table extends \table_sql {
/**
* Constructor for the task_log table.
*
* @param string $filter
* @param int $resultfilter
*/
public function __construct(string $filter = '', int $resultfilter = null) {
global $DB;
if (-1 === $resultfilter) {
$resultfilter = null;
}
parent::__construct('tasklogs');
$columnheaders = [
'classname' => get_string('name'),
'type' => get_string('tasktype', 'admin'),
'userid' => get_string('user', 'admin'),
'timestart' => get_string('task_starttime', 'admin'),
'duration' => get_string('task_duration', 'admin'),
'db' => get_string('task_dbstats', 'admin'),
'result' => get_string('task_result', 'admin'),
'actions' => '',
];
$this->define_columns(array_keys($columnheaders));
$this->define_headers(array_values($columnheaders));
// The name column is a header.
$this->define_header_column('classname');
// This table is not collapsible.
$this->collapsible(false);
// The actions class should not wrap. Use the BS text utility class.
$this->column_class('actions', 'text-nowrap');
// Allow pagination.
$this->pageable(true);
// Allow sorting. Default to sort by timestarted DESC.
$this->sortable(true, 'timestart', SORT_DESC);
// Add filtering.
$where = [];
$params = [];
if (!empty($filter)) {
$orwhere = [];
$filter = str_replace('\\', '\\\\', $filter);
// Check the class name.
$orwhere[] = $DB->sql_like('classname', ':classfilter', false, false);
$params['classfilter'] = '%' . $DB->sql_like_escape($filter) . '%';
$orwhere[] = $DB->sql_like('output', ':outputfilter', false, false);
$params['outputfilter'] = '%' . $DB->sql_like_escape($filter) . '%';
$where[] = "(" . implode(' OR ', $orwhere) . ")";
}
if (null !== $resultfilter) {
$where[] = 'tl.result = :result';
$params['result'] = $resultfilter;
}
$where = implode(' AND ', $where);
$this->set_sql('', '', $where, $params);
}
/**
* Query the db. Store results in the table object for use by build_table.
*
* @param int $pagesize size of page for paginated displayed table.
* @param bool $useinitialsbar do you want to use the initials bar. Bar
* will only be used if there is a fullname column defined for the table.
*/
public function query_db($pagesize, $useinitialsbar = true) {
global $DB;
// Fetch the attempts.
$sort = $this->get_sql_sort();
if ($sort) {
$sort = "ORDER BY $sort";
}
$extrafields = get_extra_user_fields(\context_system::instance());
$userfields = \user_picture::fields('u', $extrafields, 'userid2', 'user');
$where = '';
if (!empty($this->sql->where)) {
$where = "WHERE {$this->sql->where}";
}
$sql = "SELECT
tl.id, tl.type, tl.component, tl.classname, tl.userid, tl.timestart, tl.timeend,
tl.dbreads, tl.dbwrites, tl.result,
tl.dbreads + tl.dbwrites AS db,
tl.timeend - tl.timestart AS duration,
{$userfields}
FROM {task_log} tl
LEFT JOIN {user} u ON u.id = tl.userid
{$where}
{$sort}";
$this->pagesize($pagesize, $DB->count_records_sql("SELECT COUNT('x') FROM {task_log} tl {$where}", $this->sql->params));
if (!$this->is_downloading()) {
$this->rawdata = $DB->get_records_sql($sql, $this->sql->params, $this->get_page_start(), $this->get_page_size());
} else {
$this->rawdata = $DB->get_records_sql($sql, $this->sql->params);
}
}
/**
* Format the name cell.
*
* @param \stdClass $row
* @return string
*/
public function col_classname($row) : string {
$output = '';
if (class_exists($row->classname)) {
$task = new $row->classname;
if ($task instanceof \core\task\scheduled_task) {
$output = $task->get_name();
}
}
$output .= \html_writer::tag('div', "\\{$row->classname}", [
'class' => 'task-class',
]);
return $output;
}
/**
* Format the type cell.
*
* @param \stdClass $row
* @return string
*/
public function col_type($row) : string {
if (\core\task\database_logger::TYPE_SCHEDULED == $row->type) {
return get_string('task_type:scheduled', 'admin');
} else {
return get_string('task_type:adhoc', 'admin');
}
}
/**
* Format the timestart cell.
*
* @param \stdClass $row
* @return string
*/
public function col_result($row) : string {
if ($row->result) {
return get_string('task_result:failed', 'admin');
} else {
return get_string('success');
}
}
/**
* Format the timestart cell.
*
* @param \stdClass $row
* @return string
*/
public function col_timestart($row) : string {
return userdate($row->timestart, get_string('strftimedatetimeshort', 'langconfig'));
}
/**
* Format the duration cell.
*
* @param \stdClass $row
* @return string
*/
public function col_duration($row) : string {
$duration = round($row->timeend - $row->timestart, 2);
if (empty($duration)) {
// The format_time function returns 'now' when the difference is exactly 0.
// Note: format_time performs concatenation in exactly this fashion so we should do this for consistency.
return '0 ' . get_string('secs', 'moodle');
}
return format_time($duration);
}
/**
* Format the DB details cell.
*
* @param \stdClass $row
* @return string
*/
public function col_db($row) : string {
$output = '';
$output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
$output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));
return $output;
}
/**
* Format the actions cell.
*
* @param \stdClass $row
* @return string
*/
public function col_actions($row) : string {
global $OUTPUT;
$actions = [];
$url = new \moodle_url('/admin/tasklogs.php', ['logid' => $row->id]);
// Quick view.
$actions[] = $OUTPUT->action_icon(
$url,
new \pix_icon('e/search', get_string('view')),
new \popup_action('click', $url)
);
// Download.
$actions[] = $OUTPUT->action_icon(
new \moodle_url($url, ['download' => true]),
new \pix_icon('t/download', get_string('download'))
);
return implode('&nbsp;', $actions);
}
/**
* Format the user cell.
*
* @param \stdClass $row
* @return string
*/
public function col_userid($row) : string {
if (empty($row->userid)) {
return '';
}
$user = (object) [];
username_load_fields_from_object($user, $row, 'user');
return fullname($user);
}
}
-111
View File
@@ -1,111 +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/>.
/**
* This hack is intended for clustered sites that do not want
* to use shared cachedir for component cache.
*
* This file needs to be called after any change in PHP files in dataroot,
* that is before upgrade and install.
*
* @package core
* @copyright 2013 Petr Skoda (skodak) {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
define('ABORT_AFTER_CONFIG', true); // We need just the values from config.php.
define('CACHE_DISABLE_ALL', true); // This prevents reading of existing caches.
define('IGNORE_COMPONENT_CACHE', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(
array(
'file' => false,
'rebuild' => false,
'print' => false,
'help' => false
),
array(
'h' => 'help'
)
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if (!$options['rebuild'] and !$options['file'] and !$options['print']) {
$help =
"Create alternative component cache file
Options:
-h, --help Print out this help
--rebuild Rebuild \$CFG->alternative_component_cache file
--file=filepath Save component cache to file
--print Print component cache file content
Example:
\$ php admin/cli/rebuild_alternative_component_cache.php --rebuild
";
echo $help;
exit(0);
}
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$content = core_component::get_cache_content();
if ($options['print']) {
echo $content;
exit(0);
}
if ($options['rebuild']) {
if (empty($CFG->alternative_component_cache)) {
fwrite(STDERR, 'config.php does not contain $CFG->alternative_component_cache setting');
fwrite(STDERR, "\n");
exit(2);
}
$target = $CFG->alternative_component_cache;
} else {
$target = $options['file'];
}
if (!$target) {
fwrite(STDERR, "Invalid target file $target");
fwrite(STDERR, "\n");
exit(1);
}
$bytes = file_put_contents($target, $content);
if (!$bytes) {
fwrite(STDERR, "Error writing to $target");
fwrite(STDERR, "\n");
exit(1);
}
// Success.
echo "File $target was updated\n";
exit(0);
+3 -2
View File
@@ -28,7 +28,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
@@ -75,7 +75,8 @@ if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
$CFG->debug = DEBUG_DEVELOPER;
$CFG->debugdisplay = true;
}
$starttime = microtime();
-119
View File
@@ -1,119 +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/>.
/**
* This script allows to do backup.
*
* @package core
* @subpackage cli
* @copyright 2013 Lancaster University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', 1);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array(
'courseid' => false,
'courseshortname' => '',
'destination' => '',
'help' => false,
), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || !($options['courseid'] || $options['courseshortname'])) {
$help = <<<EOL
Perform backup of the given course.
Options:
--courseid=INTEGER Course ID for backup.
--courseshortname=STRING Course shortname for backup.
--destination=STRING Path where to store backup file. If not set the backup
will be stored within the course backup file area.
-h, --help Print out this help.
Example:
\$sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/moodle/backup/\n
EOL;
echo $help;
die;
}
$admin = get_admin();
if (!$admin) {
mtrace("Error: No admin account was found");
die;
}
// Do we need to store backup somewhere else?
$dir = rtrim($options['destination'], '/');
if (!empty($dir)) {
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
mtrace("Destination directory does not exists or not writable.");
die;
}
}
// Check that the course exists.
if ($options['courseid']) {
$course = $DB->get_record('course', array('id' => $options['courseid']), '*', MUST_EXIST);
} else if ($options['courseshortname']) {
$course = $DB->get_record('course', array('shortname' => $options['courseshortname']), '*', MUST_EXIST);
}
cli_heading('Performing backup...');
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $admin->id);
// Set the default filename.
$format = $bc->get_format();
$type = $bc->get_type();
$id = $bc->get_id();
$users = $bc->get_plan()->get_setting('users')->get_value();
$anonymised = $bc->get_plan()->get_setting('anonymize')->get_value();
$filename = backup_plan_dbops::get_default_backup_filename($format, $type, $id, $users, $anonymised);
$bc->get_plan()->get_setting('filename')->set_value($filename);
// Execution.
$bc->finish_ui();
$bc->execute_plan();
$results = $bc->get_results();
$file = $results['backup_destination']; // May be empty if file already moved to target location.
// Do we need to store backup somewhere else?
if (!empty($dir)) {
if ($file) {
mtrace("Writing " . $dir.'/'.$filename);
if ($file->copy_content_to($dir.'/'.$filename)) {
$file->delete();
mtrace("Backup completed.");
} else {
mtrace("Destination directory does not exist or is not writable. Leaving the backup in the course backup file area.");
}
}
} else {
mtrace("Backup completed, the new file is listed in the backup area of the given course");
}
$bc->destroy();
exit(0);
-119
View File
@@ -1,119 +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/>.
/**
* Build and store theme CSS.
*
* @package core
* @subpackage cli
* @copyright 2017 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/csslib.php");
require_once("$CFG->libdir/outputlib.php");
$longparams = [
'themes' => null,
'direction' => null,
'help' => false,
'verbose' => false
];
$shortmappings = [
't' => 'themes',
'd' => 'direction',
'h' => 'help',
'v' => 'verbose'
];
// Get CLI params.
list($options, $unrecognized) = cli_get_params($longparams, $shortmappings);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
echo
"Compile the CSS for one or more installed themes.
Existing CSS caches will replaced.
By default all themes will be recompiled unless otherwise specified.
Options:
-t, --themes A comma separated list of themes to be compiled
-d, --direction Only compile a single direction (either ltr or rtl)
-v, --verbose Print info comments to stdout
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/build_theme_css.php --themes=boost --direction=ltr
";
die;
}
if (empty($options['verbose'])) {
$trace = new null_progress_trace();
} else {
$trace = new text_progress_trace();
}
cli_heading('Build theme css');
// Determine which themes we need to build.
$themenames = [];
if (is_null($options['themes'])) {
$trace->output('No themes specified. Finding all installed themes.');
$themenames = array_keys(core_component::get_plugin_list('theme'));
} else {
if (is_string($options['themes'])) {
$themenames = explode(',', $options['themes']);
} else {
cli_error('--themes must be a comma separated list of theme names');
}
}
$trace->output('Checking that each theme is correctly installed...');
$themeconfigs = [];
foreach ($themenames as $themename) {
if (is_null(theme_get_config_file_path($themename))) {
cli_error("Unable to find theme config for {$themename}");
}
// Load the config for the theme.
$themeconfigs[] = theme_config::load($themename);
}
$directions = ['ltr', 'rtl'];
if (!is_null($options['direction'])) {
if (!in_array($options['direction'], $directions)) {
cli_error("--direction must be either ltr or rtl");
}
$directions = [$options['direction']];
}
$trace->output('Building CSS for themes: ' . implode(', ', $themenames));
theme_build_css_for_themes($themeconfigs, $directions);
exit(0);
-173
View File
@@ -1,173 +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/>.
/**
* CLI script allowing to get and set config values.
*
* This is technically just a thin wrapper for {@link get_config()} and
* {@link set_config()} functions.
*
* @package core
* @subpackage cli
* @copyright 2017 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
$usage = "Displays the current value of the given site setting. Allows to set it to the given value, too.
Usage:
# php cfg.php [--component=<componentname>] [--json] [--shell-arg]
# php cfg.php --name=<configname> [--component=<componentname>] [--shell-arg] [--no-eol]
# php cfg.php --name=<configname> [--component=<componentname>] --set=<value>
# php cfg.php --name=<configname> [--component=<componentname>] --unset
# php cfg.php [--help|-h]
Options:
-h --help Print this help.
--component=<frankenstyle> Name of the component the variable is part of. Defaults to core.
--name=<configname> Name of the configuration variable to get/set. If missing, print all
configuration variables of the given component.
--set=<value> Set the given variable to this value.
--unset Unset the given variable.
--shell-arg Escape output values so that they can be directly used as shell script arguments.
--json Encode output list of values using JSON notation.
--no-eol Do not include the trailing new line character when printing the value.
The list of all variables of the given component can be printed as
tab-separated list (default) or JSON object (--json). Particular values are
printed as raw text values, optionally escaped so that they can be directly
used as shell script arguments (--shell-arg). Single values are displayed with
trailing new line by default, unless explicitly disabled (--no-eol).
In the read mode, the script exits with success status 0 if the requested value
is found. If the requested variable is not set, the script exits with status 3.
When listing all variables of the component, the exit status is always 0 even
if no variables for the given component are found. When setting/unsetting a
value, the exit status is 0. When attempting to set/unset a value that has
already been hard-set in config.php, the script exits with error status 4. In
case of unexpected error, the script exits with error status 1.
Examples:
# php cfg.php
Prints tab-separated list of all core configuration variables and their values.
# php cfg.php --json
Prints list of all core configuration variables and their values as a JSON object.
# php cfg.php --name=release
Prints the given configuration variable - e.g. \$CFG->release in this case.
# php cfg.php --component=tool_recyclebin
# Prints tab-separated list of the plugin's configuration variables.
# export DATAROOT=\$(php cfg.php --name=dataroot --shell-arg --no-eol)
Stores the given configuration variable in the shell variable, escaped
so that it can be safely used as a shell argument.
# php cfg.php --name=theme --set=classic
Sets the given configuration variable to the given value.
# php cfg.php --name=noemailever --unset
Unsets the previously configured variable.
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'component' => null,
'name' => null,
'set' => null,
'unset' => false,
'shell-arg' => false,
'json' => false,
'no-eol' => false,
], [
'h' => 'help'
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($usage);
exit(2);
}
if ($options['unset'] || $options['set'] !== null) {
// Unset the variable or set it to the given value.
if (empty($options['name'])) {
cli_error('Missing configuration variable name', 2);
}
// Check that the variable is not hard-set in the main config.php already.
if (array_key_exists($options['name'], $CFG->config_php_settings)) {
cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4);
}
set_config($options['name'], $options['set'], $options['component']);
exit(0);
}
if ($options['name'] === null) {
// List all variables provided by the component (defaults to core).
$got = get_config($options['component']);
if ($options['json']) {
cli_writeln(json_encode($got));
} else {
foreach ($got as $name => $value) {
if ($options['shell-arg']) {
$value = escapeshellarg($value);
}
cli_writeln($name."\t".$value);
}
}
exit(0);
} else {
// Display the value of a single variable.
$got = get_config($options['component'], $options['name']);
if ($got === false) {
cli_error('No such configuration variable found.', 3);
}
if ($options['shell-arg']) {
$got = escapeshellarg($got);
}
if ($options['json']) {
$got = json_encode($got);
}
if ($options['no-eol']) {
cli_write($got);
} else {
cli_writeln($got);
}
exit(0);
}
-76
View File
@@ -1,76 +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/>.
/**
* Validate that the current db structure matches the install.xml files.
*
* @package core
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Petr Skoda <petr.skoda@totaralms.com>
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/clilib.php');
$help = "Validate database structure
Options:
-h, --help Print out this help.
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/check_database_schema.php
";
list($options, $unrecognized) = cli_get_params(
array(
'help' => false,
),
array(
'h' => 'help',
)
);
if ($options['help']) {
echo $help;
exit(0);
}
if (empty($CFG->version)) {
echo "Database is not yet installed.\n";
exit(2);
}
$dbmanager = $DB->get_manager();
$schema = $dbmanager->get_install_xml_schema();
if (!$errors = $dbmanager->check_database_schema($schema)) {
echo "Database structure is ok.\n";
exit(0);
}
foreach ($errors as $table => $items) {
cli_separator();
echo "$table\n";
foreach ($items as $item) {
echo " * $item\n";
}
}
cli_separator();
exit(1);
+1 -1
View File
@@ -30,7 +30,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
-125
View File
@@ -1,125 +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/>.
/**
* This script fixed incorrectly deleted users.
*
* @package core
* @subpackage cli
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
// Get cli options.
list($options, $unrecognized) = cli_get_params(
array(
'courses' => false,
'fix' => false,
'help' => false
),
array(
'h' => 'help',
'c' => 'courses',
'f' => 'fix'
)
);
if ($options['help'] || empty($options['courses'])) {
$help =
"Checks and fixes that course modules and sections reference each other correctly.
Compares DB fields course_sections.sequence and course_modules.section
checking that:
- course_sections.sequence contains each module id not more than once in the course
- for each moduleid from course_sections.sequence the field course_modules.section
refers to the same section id (this means course_sections.sequence is more
important if they are different)
- each module in the course is present in one of course_sections.sequence
- section sequences do not contain non-existing course modules
If there are any mismatches, the message is displayed. If --fix is specified,
the records in DB are corrected.
This script may run for a long time on big systems if called for all courses.
Avoid executing the script when another user may simultaneously edit any of the
courses being checked (recommended to run in mainenance mode).
Options:
-c, --courses List courses that need to be checked (comma-separated
values or * for all). Required
-f, --fix Fix the mismatches in DB. If not specified check only and
report problems to STDERR
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/fix_course_sequence.php --courses=*
\$sudo -u www-data /usr/bin/php admin/cli/fix_course_sequence.php --courses=2,3,4 --fix
";
echo $help;
die;
}
$courseslist = preg_split('/\s*,\s*/', $options['courses'], -1, PREG_SPLIT_NO_EMPTY);
if (in_array('*', $courseslist)) {
$where = '';
$params = array();
} else {
list($sql, $params) = $DB->get_in_or_equal($courseslist, SQL_PARAMS_NAMED, 'id');
$where = 'WHERE id '. $sql;
}
$coursescount = $DB->get_field_sql('SELECT count(id) FROM {course} '. $where, $params);
if (!$coursescount) {
cli_error('No courses found');
}
echo "Checking $coursescount courses...\n\n";
require_once($CFG->dirroot. '/course/lib.php');
$problems = array();
$courses = $DB->get_fieldset_sql('SELECT id FROM {course} '. $where, $params);
foreach ($courses as $courseid) {
$errors = course_integrity_check($courseid, null, null, true, empty($options['fix']));
if ($errors) {
if (!empty($options['fix'])) {
// Reset the course cache to make sure cache is recalculated next time the course is viewed.
rebuild_course_cache($courseid, true);
}
foreach ($errors as $error) {
cli_problem($error);
}
$problems[] = $courseid;
} else {
echo "Course [$courseid] is OK\n";
}
}
if (!count($problems)) {
echo "\n...All courses are OK\n";
} else {
if (!empty($options['fix'])) {
echo "\n...Found and fixed ".count($problems)." courses with problems". "\n";
} else {
echo "\n...Found ".count($problems)." courses with problems. To fix run:\n";
echo "\$sudo -u www-data /usr/bin/php admin/cli/fix_course_sequence.php --courses=".join(',', $problems)." --fix". "\n";
}
}
-92
View File
@@ -1,92 +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/>.
/**
* This script fixed incorrectly deleted users.
*
* @package core
* @subpackage cli
* @copyright 2013 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Fix incorrectly deleted users.
This scripts detects users that are marked as deleted instead
of calling delete_user().
Deleted users do not have original username, idnumber or email,
we must also delete all roles, enrolments, group memberships, etc.
Please note this script does not delete any public information
such as forum posts.
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/fix_deleted_users.php
";
echo $help;
die;
}
cli_heading('Looking for sloppy user deletes');
// Look for sloppy deleted users where somebody only flipped the deleted flag.
$sql = "SELECT *
FROM {user}
WHERE deleted = 1 AND email LIKE '%@%' AND username NOT LIKE '%@%'";
$rs = $DB->get_recordset_sql($sql);
foreach ($rs as $user) {
echo "Redeleting user $user->id: $user->username ($user->email)\n";
delete_user($user);
}
$rs->close();
cli_heading('Deleting all leftovers');
$DB->set_field('user', 'idnumber', '', array('deleted'=>1));
$DB->delete_records_select('role_assignments', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('cohort_members', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('groups_members', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('user_enrolments', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('user_preferences', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('user_info_data', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('user_lastaccess', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('external_tokens', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
$DB->delete_records_select('external_services_users', "userid IN (SELECT id FROM {user} WHERE deleted = 1)");
exit(0);
@@ -1,103 +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/>.
/**
* This script fixes orphaned question categories.
*
* Orphaned question categories have had their associated context deleted
* but the category itself remains in the database with an invalid context.
*
* @package core
* @subpackage cli
* @copyright 2013 Tyler Bannister (tyler.bannister@remote-learner.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/questionlib.php');
$long = array('fix' => false, 'help' => false);
$short = array('f' => 'fix', 'h' => 'help');
// Now get cli options.
list($options, $unrecognized) = cli_get_params($long, $short);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Fix orphaned question categories.
This scripts detects question categories that have had their
context deleted, thus severing them from their original purpose.
This script will find the orphaned categories and delete the unused
questions in each category found. Used questions will not be
deleted, instead they will be moved to a rescue question category.
Options:
-h, --help Print out this help
-f, --fix Fix the orphaned question categories in the DB.
If not specified only check and report problems to STDERR.
Example:
\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php
\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php -f
";
echo $help;
die;
}
cli_heading('Checking for orphaned categories');
$sql = 'SELECT qc.id, qc.contextid, qc.name
FROM {question_categories} qc
LEFT JOIN {context} c ON qc.contextid = c.id
WHERE c.id IS NULL';
$categories = $DB->get_recordset_sql($sql);
$i = 0;
foreach ($categories as $category) {
$i += 1;
echo "Found orphaned category: {$category->name}\n";
if (!empty($options['fix'])) {
echo "Cleaning...";
// One transaction per category.
$transaction = $DB->start_delegated_transaction();
question_category_delete_safe($category);
$transaction->allow_commit();
echo " Done!\n";
}
}
if (($i > 0) && !empty($options['fix'])) {
echo "Found and removed {$i} orphaned question categories\n";
} else if ($i > 0) {
echo "Found {$i} orphaned question categories. To fix, run:\n";
echo "\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php --fix\n";
} else {
echo "No orphaned question categories found.\n";
}
$categories->close();
+179 -323
View File
@@ -36,12 +36,6 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
exit(1);
}
// Force OPcache reset if used, we do not want any stale caches
// when preparing test environment.
if (function_exists('opcache_reset')) {
opcache_reset();
}
$help =
"Command line Moodle installer, creates config.php and initializes database.
Please note you must execute this script with the same uid as apache
@@ -64,24 +58,19 @@ Options:
--dbname=NAME Database name. Default is moodle
--dbuser=USERNAME Database user. Default is root
--dbpass=PASSWORD Database password. Default is blank
--dbport=NUMBER Use database port.
--dbsocket=PATH Use database socket, 1 means default. Available for some databases only.
--dbsocket Use database sockets. Available for some databases only.
--prefix=STRING Table prefix for above database tables. Default is mdl_
--fullname=STRING The fullname of the site
--shortname=STRING The shortname of the site
--summary=STRING The summary to be displayed on the front page
--adminuser=USERNAME Username for the moodle admin account. Default is admin
--adminpass=PASSWORD Password for the moodle admin account,
required in non-interactive mode.
--adminemail=STRING Email address for the moodle admin account.
--upgradekey=STRING The upgrade key to be set in the config.php, leave empty to not set it.
--non-interactive No interactive questions, installation fails if any
problem encountered.
--agree-license Indicates agreement with software license,
required in non-interactive mode.
--allow-unstable Install even if the version is not marked as stable yet,
required in non-interactive mode.
--skip-database Stop the installation before installing the database.
-h, --help Print out this help
Example:
@@ -90,7 +79,7 @@ Example:
// distro specific customisation
$distrolibfile = __DIR__.'/../../install/distrolib.php';
$distrolibfile = dirname(dirname(dirname(__FILE__))).'/install/distrolib.php';
$distro = null;
if (file_exists($distrolibfile)) {
require_once($distrolibfile);
@@ -100,7 +89,7 @@ if (file_exists($distrolibfile)) {
}
// Nothing to do if config.php exists
$configfile = __DIR__.'/../../config.php';
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (file_exists($configfile)) {
require($configfile);
require_once($CFG->libdir.'/clilib.php');
@@ -124,11 +113,10 @@ $olddir = getcwd();
chdir(dirname($_SERVER['argv'][0]));
// Servers should define a default timezone in php.ini, but if they don't then make sure something is defined.
if (!function_exists('date_default_timezone_set') or !function_exists('date_default_timezone_get')) {
fwrite(STDERR, "Timezone functions are not available.\n");
exit(1);
// This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this.
if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) {
@date_default_timezone_set(@date_default_timezone_get());
}
date_default_timezone_set(@date_default_timezone_get());
// make sure PHP errors are displayed - helps with diagnosing of problems
@error_reporting(E_ALL);
@@ -139,86 +127,53 @@ date_default_timezone_set(@date_default_timezone_get());
/** Used by library scripts to check they are being called by Moodle */
define('MOODLE_INTERNAL', true);
// Disables all caching.
define('CACHE_DISABLE_ALL', true);
define('PHPUNIT_TEST', false);
define('IGNORE_COMPONENT_CACHE', true);
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.3.2") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}
// set up configuration
global $CFG;
$CFG = new stdClass();
$CFG->lang = 'en';
$CFG->dirroot = dirname(dirname(__DIR__));
$CFG->dirroot = dirname(dirname(dirname(__FILE__)));
$CFG->libdir = "$CFG->dirroot/lib";
$CFG->wwwroot = "http://localhost";
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->docroot = 'http://docs.moodle.org';
$CFG->running_installer = true;
$CFG->early_install_lang = true;
$CFG->ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX';
$CFG->dboptions = array();
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = true;
$CFG->debugdeveloper = true;
$parts = explode('/', str_replace('\\', '/', dirname(__DIR__)));
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
$CFG->admin = array_pop($parts);
//point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
//the problem is that we need specific version of quickforms and hacked excel files :-(
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
require_once($CFG->libdir.'/classes/component.php');
require_once($CFG->libdir.'/classes/text.php');
require_once($CFG->libdir.'/classes/string_manager.php');
require_once($CFG->libdir.'/classes/string_manager_install.php');
require_once($CFG->libdir.'/classes/string_manager_standard.php');
require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/setuplib.php');
require_once($CFG->libdir.'/textlib.class.php');
require_once($CFG->libdir.'/weblib.php');
require_once($CFG->libdir.'/dmllib.php');
require_once($CFG->libdir.'/moodlelib.php');
require_once($CFG->libdir.'/deprecatedlib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
require_once($CFG->dirroot.'/cache/lib.php');
// Register our classloader, in theory somebody might want to replace it to load other hacked core classes.
// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes.
if (defined('COMPONENT_CLASSLOADER')) {
spl_autoload_register(COMPONENT_CLASSLOADER);
} else {
spl_autoload_register('core_component::classloader');
}
require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;
\core\session\manager::init_empty_session();
global $SESSION;
global $USER;
global $COURSE;
$COURSE = new stdClass();
$COURSE->id = 1;
global $SITE;
$SITE = $COURSE;
define('SITEID', 1);
//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
'oci' => moodle_database::get_driver_instance('oci', 'native'),
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
'mssql' => moodle_database::get_driver_instance('mssql', 'native'), // FreeTDS driver
);
foreach ($databases as $type=>$database) {
if ($database->driver_installed() !== true) {
@@ -238,26 +193,21 @@ list($options, $unrecognized) = cli_get_params(
'chmod' => isset($distro->directorypermissions) ? sprintf('%04o',$distro->directorypermissions) : '2777', // let distros set dir permissions
'lang' => $CFG->lang,
'wwwroot' => '',
'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(__DIR__))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro
'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro
'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, // let distro skip dbtype selection
'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, // let distros set dbhost
'dbname' => 'moodle',
'dbuser' => empty($distro->dbuser) ? 'root' : $distro->dbuser, // let distros set dbuser
'dbpass' => '',
'dbport' => '',
'dbsocket' => '',
'dbsocket' => false,
'prefix' => 'mdl_',
'fullname' => '',
'shortname' => '',
'summary' => '',
'adminuser' => 'admin',
'adminpass' => '',
'adminemail' => '',
'upgradekey' => '',
'non-interactive' => false,
'agree-license' => false,
'allow-unstable' => false,
'skip-database' => false,
'help' => false
),
array(
@@ -266,12 +216,10 @@ list($options, $unrecognized) = cli_get_params(
);
$interactive = empty($options['non-interactive']);
$skipdatabase = $options['skip-database'];
// set up language
$lang = clean_param($options['lang'], PARAM_SAFEDIR);
$languages = get_string_manager()->get_list_of_translations();
if (array_key_exists($lang, $languages)) {
if (file_exists($CFG->dirroot.'/install/lang/'.$lang)) {
$CFG->lang = $lang;
}
@@ -286,41 +234,38 @@ if ($options['help']) {
}
//Print header
cli_logo();
echo PHP_EOL;
echo get_string('cliinstallheader', 'install', $CFG->target_release)."\n";
//Fist select language
if ($interactive) {
cli_separator();
// Do not put the langs into columns because it is not compatible with RTL.
$languages = get_string_manager()->get_list_of_translations();
// format the langs nicely - 3 per line
$c = 0;
$langlist = '';
foreach ($languages as $key=>$lang) {
$c++;
$length = iconv_strlen($lang, 'UTF-8');
$padded = $lang.str_repeat(' ', 38-$length);
$langlist .= $padded;
if ($c % 3 == 0) {
$langlist .= "\n";
}
}
$default = $CFG->lang;
cli_heading(get_string('chooselanguagehead', 'install'));
if (array_key_exists($default, $languages)) {
echo $default.' - '.$languages[$default]."\n";
}
if ($default !== 'en') {
echo 'en - English (en)'."\n";
}
echo '? - '.get_string('availablelangs', 'install')."\n";
cli_heading(get_string('availablelangs', 'install'));
echo $langlist."\n";
$prompt = get_string('clitypevaluedefault', 'admin', $CFG->lang);
$error = '';
do {
echo $error;
$input = cli_input($prompt, $default);
$input = clean_param($input, PARAM_SAFEDIR);
if ($input === '?') {
echo implode("\n", $languages)."\n";
$error = "\n";
if (!file_exists($CFG->dirroot.'/install/lang/'.$input)) {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else {
$input = clean_param($input, PARAM_SAFEDIR);
if (!array_key_exists($input, $languages)) {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else {
$error = '';
}
$error = '';
}
} while ($error !== '');
$CFG->lang = $input;
@@ -354,8 +299,6 @@ if ($interactive) {
}
}
$CFG->directorypermissions = $chmod;
$CFG->filepermissions = ($CFG->directorypermissions & 0666);
$CFG->umaskpermissions = (($CFG->directorypermissions & 0777) ^ 0777);
//We need wwwroot before we test dataroot
$wwwroot = clean_param($options['wwwroot'], PARAM_URL);
@@ -392,6 +335,7 @@ if ($interactive) {
$CFG->wwwroot = $wwwroot;
$CFG->httpswwwroot = $CFG->wwwroot;
//We need dataroot before lang download
$CFG->dataroot = $options['dataroot'];
if ($interactive) {
@@ -441,10 +385,8 @@ if ($interactive) {
cli_error(get_string('pathserrcreatedataroot', 'install', $a));
}
}
$CFG->tempdir = $CFG->dataroot.'/temp';
$CFG->backuptempdir = $CFG->tempdir.'/backup';
$CFG->cachedir = $CFG->dataroot.'/cache';
$CFG->localcachedir = $CFG->dataroot.'/localcache';
$CFG->tempdir = $CFG->dataroot.'/temp';
$CFG->cachedir = $CFG->dataroot.'/cache';
// download required lang packs
if ($CFG->lang !== 'en') {
@@ -514,105 +456,72 @@ if ($interactive) {
$database = $databases[$CFG->dbtype];
// We cannot do any validation until all DB connection data is provided.
$hintdatabase = '';
do {
echo $hintdatabase;
// Ask for db host.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasehost', 'install'));
if ($options['dbhost'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbhost']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbhost = cli_input($prompt, $options['dbhost']);
// ask for db host
if ($interactive) {
cli_separator();
cli_heading(get_string('databasehost', 'install'));
if ($options['dbhost'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbhost']);
} else {
$CFG->dbhost = $options['dbhost'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbhost = cli_input($prompt, $options['dbhost']);
// Ask for db name.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasename', 'install'));
if ($options['dbname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbname = cli_input($prompt, $options['dbname']);
} else {
$CFG->dbhost = $options['dbhost'];
}
// ask for db name
if ($interactive) {
cli_separator();
cli_heading(get_string('databasename', 'install'));
if ($options['dbname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbname']);
} else {
$CFG->dbname = $options['dbname'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbname = cli_input($prompt, $options['dbname']);
// Ask for db prefix.
if ($interactive) {
cli_separator();
cli_heading(get_string('dbprefix', 'install'));
//TODO: solve somehow the prefix trouble for oci.
if ($options['prefix'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->prefix = cli_input($prompt, $options['prefix']);
} else {
$CFG->dbname = $options['dbname'];
}
// ask for db prefix
if ($interactive) {
cli_separator();
cli_heading(get_string('dbprefix', 'install'));
//TODO: solve somehow the prefix trouble for oci
if ($options['prefix'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
} else {
$CFG->prefix = $options['prefix'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->prefix = cli_input($prompt, $options['prefix']);
// Ask for db port.
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseport', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbport']);
$CFG->dboptions['dbport'] = (int) cli_input($prompt, $options['dbport']);
} else {
$CFG->prefix = $options['prefix'];
}
// ask for db user
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseuser', 'install'));
if ($options['dbuser'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbuser']);
} else {
$CFG->dboptions['dbport'] = (int) $options['dbport'];
}
if ($CFG->dboptions['dbport'] <= 0) {
$CFG->dboptions['dbport'] = '';
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbuser = cli_input($prompt, $options['dbuser']);
// Ask for db socket.
if ($CFG->ostype === 'WINDOWS') {
$CFG->dboptions['dbsocket'] = '';
} else if ($interactive and empty($CFG->dboptions['dbport'])) {
cli_separator();
cli_heading(get_string('databasesocket', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbsocket']);
$CFG->dboptions['dbsocket'] = cli_input($prompt, $options['dbsocket']);
} else {
$CFG->dboptions['dbsocket'] = $options['dbsocket'];
}
// Ask for db user.
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseuser', 'install'));
if ($options['dbuser'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbuser = cli_input($prompt, $options['dbuser']);
} else {
$CFG->dbuser = $options['dbuser'];
}
// Ask for db password.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasepass', 'install'));
} else {
$CFG->dbuser = $options['dbuser'];
}
// ask for db password
if ($interactive) {
cli_separator();
cli_heading(get_string('databasepass', 'install'));
do {
if ($options['dbpass'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbpass']);
} else {
@@ -620,157 +529,113 @@ do {
}
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation.
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']),
$distro);
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']), $distro);
}
$hintdatabase = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']));
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
} while ($hint_database !== '');
} else {
$CFG->dbpass = $options['dbpass'];
$hintdatabase = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']));
if ($hintdatabase !== '') {
cli_error(get_string('dbconnectionerror', 'install'));
}
} else {
$CFG->dbpass = $options['dbpass'];
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
if ($hint_database !== '') {
cli_error(get_string('dbconnectionerror', 'install'));
}
} while ($hintdatabase !== '');
}
// If --skip-database option is provided, we do not need to ask for site fullname, shortname, adminuser, adminpass, adminemail.
// These fields will be requested during the database install part.
if (!$skipdatabase) {
// Ask for fullname.
if ($interactive) {
cli_separator();
cli_heading(get_string('fullsitename', 'moodle'));
// ask for fullname
if ($interactive) {
cli_separator();
cli_heading(get_string('fullsitename', 'moodle'));
if ($options['fullname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['fullname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['fullname'] = cli_input($prompt, $options['fullname']);
} while (empty($options['fullname']));
if ($options['fullname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['fullname']);
} else {
if (empty($options['fullname'])) {
$a = (object)['option' => 'fullname', 'value' => $options['fullname']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for shortname.
if ($interactive) {
cli_separator();
cli_heading(get_string('shortsitename', 'moodle'));
if ($options['shortname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['shortname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['shortname'] = cli_input($prompt, $options['shortname']);
} while (empty($options['shortname']));
} else {
if (empty($options['shortname'])) {
$a = (object)['option' => 'shortname', 'value' => $options['shortname']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for admin user name.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminusername', 'install'));
if (!empty($options['adminuser'])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['adminuser'] = cli_input($prompt, $options['adminuser']);
} while (empty($options['adminuser']) or $options['adminuser'] === 'guest');
} else {
if ((empty($options['adminuser']) || $options['adminuser'] === 'guest')) {
$a = (object)['option' => 'adminuser', 'value' => $options['adminuser']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for admin user password.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminpassword', 'install'));
$prompt = get_string('clitypevalue', 'admin');
do {
$options['adminpass'] = cli_input($prompt);
} while (empty($options['adminpass']) or $options['adminpass'] === 'admin');
} else {
if ((empty($options['adminpass']) or $options['adminpass'] === 'admin')) {
$a = (object)['option' => 'adminpass', 'value' => $options['adminpass']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for the admin email address.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminemail', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminemail']);
$options['adminemail'] = cli_input($prompt, $options['adminemail']);
}
// Validate that the address provided was an e-mail address.
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
$a = (object)['option' => 'adminemail', 'value' => $options['adminemail']];
do {
$options['fullname'] = cli_input($prompt, $options['fullname']);
} while (empty($options['fullname']));
} else {
if (empty($options['fullname'])) {
$a = (object)array('option'=>'fullname', 'value'=>$options['fullname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for the upgrade key.
// ask for shortname
if ($interactive) {
cli_separator();
cli_heading(get_string('upgradekeyset', 'admin'));
if ($options['upgradekey'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['upgradekey']);
$options['upgradekey'] = cli_input($prompt, $options['upgradekey']);
cli_heading(get_string('shortsitename', 'moodle'));
if ($options['shortname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['shortname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
$options['upgradekey'] = cli_input($prompt);
}
do {
$options['shortname'] = cli_input($prompt, $options['shortname']);
} while (empty($options['shortname']));
} else {
if (empty($options['shortname'])) {
$a = (object)array('option'=>'shortname', 'value'=>$options['shortname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Set the upgrade key if it was provided.
if ($options['upgradekey'] !== '') {
$CFG->upgradekey = $options['upgradekey'];
// ask for admin user name
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminusername', 'install'));
if (!empty($options['adminuser'])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['adminuser'] = cli_input($prompt, $options['adminuser']);
} while (empty($options['adminuser']) or $options['adminuser'] === 'guest');
} else {
if (empty($options['adminuser']) or $options['adminuser'] === 'guest') {
$a = (object)array('option'=>'adminuser', 'value'=>$options['adminuser']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// The user does not also need to pass agree-license when --skip-database is provided as the user will need to accept
// the license again in the database install part.
if (!$skipdatabase) {
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
cli_heading(get_string('copyrightnotice'));
echo "Moodle - Modular Object-Oriented Dynamic Learning Environment\n";
echo get_string('gpl3')."\n\n";
echo get_string('doyouagree')."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license'] && !$skipdatabase) {
cli_error(get_string('climustagreelicense', 'install'));
// ask for admin user password
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminpassword', 'install'));
$prompt = get_string('clitypevalue', 'admin');
do {
$options['adminpass'] = cli_input($prompt);
} while (empty($options['adminpass']) or $options['adminpass'] === 'admin');
} else {
if (empty($options['adminpass']) or $options['adminpass'] === 'admin') {
$a = (object)array('option'=>'adminpass', 'value'=>$options['adminpass']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
cli_heading(get_string('copyrightnotice'));
echo "Moodle - Modular Object-Oriented Dynamic Learning Environment\n";
echo get_string('gpl3')."\n\n";
echo get_string('doyouagree')."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license']) {
cli_error(get_string('climustagreelicense', 'install'));
}
}
// Finally we have all info needed for config.php
@@ -812,23 +677,14 @@ if (!$envstatus) {
}
// Test plugin dependencies.
require_once($CFG->libdir . '/pluginlib.php');
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
cli_error(get_string('pluginschecktodo', 'admin'));
}
if (!$skipdatabase) {
install_cli_database($options, $interactive);
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
require_once($CFG->libdir.'/upgradelib.php');
upgrade_themes();
} else {
echo get_string('cliskipdatabase', 'install')."\n";
}
install_cli_database($options, $interactive);
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success
+17 -33
View File
@@ -29,19 +29,12 @@
*/
define('CLI_SCRIPT', true);
define('CACHE_DISABLE_ALL', true);
// extra execution prevention - we can not just require config.php here
if (isset($_SERVER['REMOTE_ADDR'])) {
exit(1);
}
// Force OPcache reset if used, we do not want any stale caches
// when preparing test environment.
if (function_exists('opcache_reset')) {
opcache_reset();
}
$help =
"Advanced command line Moodle database installer.
Please note you must execute this script with the same uid as apache.
@@ -52,7 +45,6 @@ Options:
--lang=CODE Installation and default site language. Default is en.
--adminuser=USERNAME Username for the moodle admin account. Default is admin.
--adminpass=PASSWORD Password for the moodle admin account.
--adminemail=STRING Email address for the moodle admin account.
--agree-license Indicates agreement with software license.
--fullname=STRING Name of the site
--shortname=STRING Name of the site
@@ -62,12 +54,17 @@ Example:
\$sudo -u www-data /usr/bin/php admin/cli/install_database.php --lang=cs --adminpass=soMePass123 --agree-license
";
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.3.2") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}
// Nothing to do if config.php does not exist
$configfile = __DIR__.'/../../config.php';
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (!file_exists($configfile)) {
fwrite(STDERR, 'config.php does not exist, can not continue'); // do not localize
fwrite(STDERR, "\n");
@@ -82,6 +79,11 @@ require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
// make sure no tables are installed yet
if ($DB->get_tables() ) {
cli_error(get_string('clitablesexist', 'install'));
}
$CFG->early_install_lang = true;
get_string_manager(true);
@@ -93,7 +95,6 @@ list($options, $unrecognized) = cli_get_params(
'lang' => 'en',
'adminuser' => 'admin',
'adminpass' => '',
'adminemail' => '',
'fullname' => '',
'shortname' => '',
'agree-license' => false,
@@ -104,17 +105,12 @@ list($options, $unrecognized) = cli_get_params(
)
);
// We show help text even if tables are installed.
if ($options['help']) {
echo $help;
die;
}
// Make sure no tables are installed yet.
if ($DB->get_tables() ) {
cli_error(get_string('clitablesexist', 'install'));
}
if (!$options['agree-license']) {
cli_error('You have to agree to the license. --help prints out the help'); // TODO: localize
}
@@ -123,12 +119,6 @@ if ($options['adminpass'] === true or $options['adminpass'] === '') {
cli_error('You have to specify admin password. --help prints out the help'); // TODO: localize
}
// Validate that the address provided was an e-mail address.
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
$a = (object) array('option' => 'adminemail', 'value' => $options['adminemail']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
$options['lang'] = 'en';
@@ -170,20 +160,14 @@ if (!$envstatus) {
}
// Test plugin dependencies.
require_once($CFG->libdir . '/pluginlib.php');
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
cli_error(get_string('pluginschecktodo', 'admin'));
}
install_cli_database($options, true);
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
require_once($CFG->libdir.'/upgradelib.php');
upgrade_themes();
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success
-55
View File
@@ -1,55 +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/>.
/**
* CLI script to kill all user sessions without asking for confirmation.
*
* @package core
* @subpackage cli
* @copyright 2017 Alexander Bias <alexander.bias@uni-ulm.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if ($options['help']) {
$help =
"Kill all Moodle sessions
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/kill_all_sessions.php
";
echo $help;
exit(0);
}
\core\session\manager::kill_all_sessions();
exit(0);
+10 -46
View File
@@ -1,4 +1,5 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Enable or disable maintenance mode.
* Enable or disable maintenance mode
*
* @package core
* @subpackage cli
@@ -25,13 +26,12 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/adminlib.php");
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('enable'=>false, 'enablelater'=>0, 'enableold'=>false, 'disable'=>false, 'help'=>false),
// now get cli options
list($options, $unrecognized) = cli_get_params(array('enable'=>false, 'disable'=>false, 'help'=>false),
array('h'=>'help'));
if ($unrecognized) {
@@ -45,14 +45,12 @@ if ($options['help']) {
Current status displayed if not option specified.
Options:
--enable Enable CLI maintenance mode
--enablelater=MINUTES Number of minutes before entering CLI maintenance mode
--enableold Enable legacy half-maintenance mode
--enable Enable maintenance mode
--disable Disable maintenance mode
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/maintenance.php
\$sudo -u www-data /usr/bin/php admin/cli/maintenance.php
"; //TODO: localize - to be translated later when everything is finished
echo $help;
@@ -61,52 +59,18 @@ Example:
cli_heading(get_string('sitemaintenancemode', 'admin')." ($CFG->wwwroot)");
if ($options['enablelater']) {
if (file_exists("$CFG->dataroot/climaintenance.html")) {
// Already enabled, sorry.
echo get_string('clistatusenabled', 'admin')."\n";
return 1;
}
$time = time() + ($options['enablelater']*60);
set_config('maintenance_later', $time);
echo get_string('clistatusenabledlater', 'admin', userdate($time))."\n";
return 0;
} else if ($options['enable']) {
if (file_exists("$CFG->dataroot/climaintenance.html")) {
// The maintenance is already enabled, nothing to do.
} else {
enable_cli_maintenance_mode();
}
set_config('maintenance_enabled', 0);
unset_config('maintenance_later');
echo get_string('sitemaintenanceoncli', 'admin')."\n";
exit(0);
} else if ($options['enableold']) {
if ($options['enable']) {
set_config('maintenance_enabled', 1);
unset_config('maintenance_later');
echo get_string('sitemaintenanceon', 'admin')."\n";
exit(0);
} else if ($options['disable']) {
set_config('maintenance_enabled', 0);
unset_config('maintenance_later');
if (file_exists("$CFG->dataroot/climaintenance.html")) {
unlink("$CFG->dataroot/climaintenance.html");
}
echo get_string('sitemaintenanceoff', 'admin')."\n";
exit(0);
}
if (!empty($CFG->maintenance_enabled) or file_exists("$CFG->dataroot/climaintenance.html")) {
if (!empty($CFG->maintenance_enabled)) {
echo get_string('clistatusenabled', 'admin')."\n";
} else if (isset($CFG->maintenance_later)) {
echo get_string('clistatusenabledlater', 'admin', userdate($CFG->maintenance_later))."\n";
} else {
echo get_string('clistatusdisabled', 'admin')."\n";
}
+10 -127
View File
@@ -24,7 +24,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
if ($DB->get_dbfamily() !== 'mysql') {
@@ -53,7 +53,7 @@ Options:
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
";
if (!empty($options['collation'])) {
@@ -64,71 +64,6 @@ if (!empty($options['collation'])) {
cli_error("Error: collation '$collation' is not available on this server!");
}
$collationinfo = explode('_', $collation);
$charset = reset($collationinfo);
$engine = strtolower($DB->get_dbengine());
// Do checks for utf8mb4.
if (strpos($collation, 'utf8mb4') === 0) {
// Do we have the right engine?
if ($engine !== 'innodb' && $engine !== 'xtradb') {
cli_error("Error: '$collation' requires InnoDB or XtraDB set as the engine.");
}
// Are we using Barracuda?
if ($DB->get_row_format() != 'Barracuda') {
// Try setting it here.
try {
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
} catch (dml_exception $e) {
cli_error("Error: '$collation' requires the file format to be set to Barracuda.
An attempt was made to change the format, but it failed. Please try doing this manually.");
}
echo "GLOBAL SETTING: innodb_file_format changed to Barracuda\n";
}
// Is one file per table being used?
if (!$DB->is_file_per_table_enabled()) {
try {
$DB->execute("SET GLOBAL innodb_file_per_table=1");
} catch (dml_exception $e) {
cli_error("Error: '$collation' requires the setting 'innodb_file_per_table' be set to 'ON'.
An attempt was made to change the format, but it failed. Please try doing this manually.");
}
echo "GLOBAL SETTING: innodb_file_per_table changed to 1\n";
}
// Is large prefix set?
if (!$DB->is_large_prefix_enabled()) {
try {
$DB->execute("SET GLOBAL innodb_large_prefix=1");
} catch (dml_exception $e) {
cli_error("Error: '$collation' requires the setting 'innodb_large_prefix' be set to 'ON'.
An attempt was made to change the format, but it failed. Please try doing this manually.");
}
echo "GLOBAL SETTING: innodb_large_prefix changed to 1\n";
}
}
$sql = "SHOW VARIABLES LIKE 'collation_database'";
if (!$dbcollation = $DB->get_record_sql($sql)) {
cli_error("Error: Could not access collation information on the database.");
}
$sql = "SHOW VARIABLES LIKE 'character_set_database'";
if (!$dbcharset = $DB->get_record_sql($sql)) {
cli_error("Error: Could not access character set information on the database.");
}
if ($dbcollation->value !== $collation || $dbcharset->value !== $charset) {
// Try to convert the DB.
echo "Converting database to '$collation' for $CFG->wwwroot:\n";
$sql = "ALTER DATABASE $CFG->dbname DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
try {
$DB->change_database_structure($sql);
} catch (exception $e) {
cli_error("Error: Tried to alter the database with no success. Please try manually changing the database
to the new collation and character set and then run this script again.");
}
echo "DATABASE CONVERTED\n";
}
echo "Converting tables and columns to '$collation' for $CFG->wwwroot:\n";
$prefix = $DB->get_prefix();
$prefix = str_replace('_', '\\_', $prefix);
@@ -145,22 +80,9 @@ if (!empty($options['collation'])) {
$skipped++;
} else {
try {
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
echo "CONVERTED\n";
$converted++;
} catch (ddl_exception $e) {
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
if ($result) {
echo "CONVERTED\n";
$converted++;
} else {
// We don't know what the problem is. Stop the conversion.
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
table and try again.");
die();
}
}
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT COLLATE = $collation");
echo "CONVERTED\n";
$converted++;
}
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
@@ -174,36 +96,22 @@ if (!empty($options['collation'])) {
continue;
}
// Check for utf8mb4 collation.
$rowformat = $DB->get_row_format_sql($engine, $collation);
if ($column->type === 'tinytext' or $column->type === 'mediumtext' or $column->type === 'text' or $column->type === 'longtext') {
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
$default = (!is_null($column->default) and $column->default !== '') ? "DEFAULT '$column->default'" : '';
// primary, unique and inc are not supported for texts
$sql = "ALTER TABLE $table->name
MODIFY COLUMN $column->field $column->type
CHARACTER SET $charset
COLLATE $collation $notnull $default";
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
$DB->change_database_structure($sql);
} else if (strpos($column->type, 'varchar') === 0) {
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
$default = !is_null($column->default) ? "DEFAULT '$column->default'" : '';
if ($rowformat != '') {
$sql = "ALTER TABLE $table->name $rowformat";
$DB->change_database_structure($sql);
}
$sql = "ALTER TABLE $table->name
MODIFY COLUMN $column->field $column->type
CHARACTER SET $charset
COLLATE $collation $notnull $default";
// primary, unique and inc are not supported for texts
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
$DB->change_database_structure($sql);
} else {
echo "ERROR (unknown column type: $column->type)\n";
$errors++;
$error++;
continue;
}
echo "CONVERTED\n";
@@ -272,9 +180,7 @@ function mysql_get_collations() {
global $DB;
$collations = array();
$sql = "SHOW COLLATION
WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'
OR Collation LIKE 'utf8mb4\_%' AND Charset = 'utf8mb4'";
$sql = "SHOW COLLATION WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'";
$rs = $DB->get_recordset_sql($sql);
foreach ($rs as $collation) {
$collations[$collation->collation] = $collation->collation;
@@ -303,26 +209,3 @@ function mysql_get_column_collations($tablename) {
$rs->close();
return $collations;
}
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
global $DB;
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND table_name = ?";
$rs = $DB->get_record_sql($sql, array($tablename));
if ($rs) {
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
$rowformat = $DB->get_row_format_sql($engine, $collation);
// Try to convert to compressed format and then try updating the collation again.
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
} else {
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
return false;
}
} else {
return false;
}
return true;
}
-202
View File
@@ -1,202 +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/>.
/**
* MySQL table row compression tool tool.
*
* @package core
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Petr Skoda <petr.skoda@totaralms.com>
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir . '/clilib.php');
if ($DB->get_dbfamily() !== 'mysql') {
cli_error('This script is used for MySQL databases only.');
}
$engine = strtolower($DB->get_dbengine());
if ($engine !== 'innodb' and $engine !== 'xtradb') {
cli_error('This script is for MySQL servers using InnoDB or XtraDB engines only.');
}
list($options, $unrecognized) = cli_get_params(
array('help' => false, 'info' => false, 'list' => false, 'fix' => false, 'showsql' => false),
array('h' => 'help', 'i' => 'info', 'l' => 'list', 'f' => 'fix', 's' => 'showsql')
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$help =
"Script for detection of row size problems in MySQL InnoDB tables.
By default InnoDB storage table is using legacy Antelope file format
which has major restriction on database row size.
Use this script to detect and fix database tables with potential data
overflow problems.
Options:
-i, --info Show database information
-l, --list List problematic tables
-f, --fix Attempt to fix all tables (requires SUPER privilege)
-s, --showsql Print SQL statements for fixing of tables
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_compressed_rows.php -l
";
/** @var mysql_sql_generator $generator */
$generator = $DB->get_manager()->generator;
$info = $DB->get_server_info();
$filepertable = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_per_table'");
$filepertable = $filepertable ? $filepertable->value : '';
$fileformat = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_format'");
$fileformat = $fileformat ? $fileformat->value : '';
$prefix = $DB->get_prefix();
$database = $CFG->dbname;
if (!empty($options['info'])) {
echo "Database version: " . $info['description'] . "\n";
echo "Database name: $database\n";
echo "Database engine: " . $DB->get_dbengine() . "\n";
echo "innodb_file_per_table: $filepertable\n";
echo "innodb_file_format: $fileformat\n";
exit(0);
} else if (!empty($options['list'])) {
$problem = false;
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antelope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT);
echo str_pad($format, 11, ' ', STR_PAD_RIGHT);
if ($format === 'Compact' or $format === 'Redundant') {
$problem = true;
echo " (needs fixing)\n";
} else if ($format !== 'Compressed' and $format !== 'Dynamic') {
echo " (unknown)\n";
} else {
echo "\n";
}
}
if ($problem) {
exit(1);
}
exit(0);
} else if (!empty($options['fix'])) {
$fixtables = array();
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antelope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
if ($format === 'Compact' or $format === 'Redundant') {
$fixtables[$table] = $table;
}
}
if (!$fixtables) {
echo "No changes necessary\n";
exit(0);
}
if ($filepertable !== 'ON') {
try {
$DB->execute("SET GLOBAL innodb_file_per_table=1");
} catch (dml_exception $e) {
echo "Cannot enable GLOBAL innodb_file_per_table setting, use --showsql option and execute the statements manually.";
throw $e;
}
}
if ($fileformat !== 'Barracuda') {
try {
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
} catch (dml_exception $e) {
echo "Cannot change GLOBAL innodb_file_format setting, use --showsql option and execute the statements manually.";
throw $e;
}
}
if (!$DB->is_compressed_row_format_supported(false)) {
echo "MySQL server is not compatible with compressed row format.";
exit(1);
}
foreach ($fixtables as $table) {
$DB->change_database_structure("ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed");
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT) . " ... Compressed\n";
}
exit(0);
} else if (!empty($options['showsql'])) {
$fixtables = array();
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antelope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
if ($format === 'Compact' or $format === 'Redundant') {
$fixtables[$table] = $table;
}
}
if (!$fixtables) {
echo "No changes necessary\n";
exit(0);
}
echo "Copy the following SQL statements and execute them using account with SUPER privilege:\n\n";
echo "USE $database;\n";
echo "SET SESSION sql_mode=STRICT_ALL_TABLES;\n";
echo "SET GLOBAL innodb_file_per_table=1;\n";
echo "SET GLOBAL innodb_file_format=Barracuda;\n";
foreach ($fixtables as $table) {
echo "ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed;\n";
}
echo "\n";
exit(0);
} else {
echo $help;
die;
}
+1 -1
View File
@@ -26,7 +26,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
if ($DB->get_dbfamily() !== 'mysql') {
+8 -31
View File
@@ -15,8 +15,6 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* CLI script to purge caches without asking for confirmation.
*
* @package core
* @subpackage cli
* @copyright 2011 David Mudrak <david@moodle.com>
@@ -25,19 +23,10 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php');
$longoptions = [
'help' => false,
'muc' => false,
'theme' => false,
'lang' => false,
'js' => false,
'filter' => false,
'other' => false
];
list($options, $unrecognized) = cli_get_params($longoptions, ['h' => 'help']);
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -45,32 +34,20 @@ if ($unrecognized) {
}
if ($options['help']) {
// The indentation of this string is "wrong" but this is to avoid a extra whitespace in console output.
$help = <<<EOF
Invalidates Moodle internal caches
Specific caches can be defined (alone or in combination) using arguments. If none are specified,
all caches will be purged.
$help =
"Invalidates all Moodle internal caches
Options:
-h, --help Print out this help
--muc Purge all MUC caches (includes lang cache)
--theme Purge theme cache
--lang Purge language string cache
--js Purge JavaScript cache
--filter Purge text filter cache
--other Purge all file caches and other miscellaneous caches (may include MUC
if using cachestore_file).
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/purge_caches.php
EOF;
\$sudo -u www-data /usr/bin/php admin/cli/purge_caches.php
";
echo $help;
exit(0);
}
purge_caches(array_filter($options));
purge_all_caches();
exit(0);
exit(0);
+13 -40
View File
@@ -26,26 +26,13 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
// Define the input options.
$longparams = array(
'help' => false,
'username' => '',
'password' => '',
'ignore-password-policy' => false
);
$shortparams = array(
'h' => 'help',
'u' => 'username',
'p' => 'password',
'i' => 'ignore-password-policy'
);
// now get cli options
list($options, $unrecognized) = cli_get_params($longparams, $shortparams);
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -60,43 +47,29 @@ There are no security checks here because anybody who is able to
execute this file may execute any PHP too.
Options:
-h, --help Print out this help
-u, --username=username Specify username to change
-p, --password=newpassword Specify new password
--ignore-password-policy Ignore password policy when setting password
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php --username=rosaura --password=jiu3jiu --ignore-password-policy
";
"; //TODO: localize - to be translated later when everything is finished
echo $help;
die;
}
if ($options['username'] == '' ) {
cli_heading('Password reset');
$prompt = "Enter username (manual authentication only)";
$username = cli_input($prompt);
} else {
$username = $options['username'];
}
cli_heading('Password reset'); // TODO: localize
$prompt = "enter username (manual authentication only)"; // TODO: localize
$username = cli_input($prompt);
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
cli_error("Can not find user '$username'");
}
if ($options['password'] == '' ) {
$prompt = "Enter new password";
$password = cli_input($prompt);
} else {
$password = $options['password'];
}
$prompt = "Enter new password"; // TODO: localize
$password = cli_input($prompt);
$errmsg = '';//prevent eclipse warning
if (!$options['ignore-password-policy'] ) {
if (!check_password_policy($password, $errmsg, $user)) {
cli_error(html_to_text($errmsg, 0));
}
if (!check_password_policy($password, $errmsg)) {
cli_error($errmsg);
}
$hashedpassword = hash_internal_user_password($password);
@@ -105,4 +78,4 @@ $DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
echo "Password changed\n";
exit(0); // 0 means success.
exit(0); // 0 means success
-182
View File
@@ -1,182 +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/>.
/**
* This script implements some useful svg manipulation tricks.
*
* @package core_admin
* @subpackage cli
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('help'=>false, 'ie9fix'=>false, 'noaspectratio'=>false, 'path'=>$CFG->dirroot),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
// If necessary add files that should be ignored - such as in 3rd party plugins.
$blacklist = array();
$path = $options['path'];
if (!file_exists($path)) {
cli_error("Invalid path $path");
}
if ($options['ie9fix']) {
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_ie9fix', $blacklist);
} else if ($options['noaspectratio']) {
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_noaspectratio', $blacklist);
} else {
$help =
"Some svg image tweaks for icon designers.
Options:
-h, --help Print out this help
--ie9fix Adds preserveAspectRatio=\"xMinYMid meet\" to every svg image
--noaspectratio Removes preserveAspectRatio from svg files
--path=PATH Path to directory or file to be converted, by default \$CFG->dirroot
Examples:
\$ php svgtool.php --ie9fix
\$ php svgtool.php --ie9fix --path=../../../pix
\$ php svgtool.php --noaspectratio
";
echo $help;
die;
}
exit(0);
/**
* Fixes SVG images for IE9.
*
* @param string $file
*/
function core_admin_svgtool_ie9fix($file) {
global $CFG;
if (strpos($file, $CFG->dirroot.DIRECTORY_SEPARATOR) === 0) {
$relfile = substr($file, strlen($CFG->dirroot));
} else {
$relfile = $file;
}
$content = file_get_contents($file);
if (!preg_match('/<svg\s[^>]*>/', $content, $matches)) {
echo " skipping $relfile (invalid format)\n";
return;
}
$svg = $matches[0];
if (strpos($svg, 'preserveAspectRatio') !== false) {
return;
}
if (!is_writable($file)) {
echo " skipping $relfile (can not modify file)\n";
return;
}
$newsvg = rtrim($svg, '>').' preserveAspectRatio="xMinYMid meet">';
$content = str_replace($svg, $newsvg, $content);
echo "converting $relfile\n";
file_put_contents($file, $content);
}
/**
* Removes preserveAspectRatio attributes from SVG images.
*
* @param string $file
*/
function core_admin_svgtool_noaspectratio($file) {
global $CFG;
if (strpos($file, $CFG->dirroot.DIRECTORY_SEPARATOR) === 0) {
$relfile = substr($file, strlen($CFG->dirroot));
} else {
$relfile = $file;
}
$content = file_get_contents($file);
if (!preg_match('/<svg\s[^>]*>/', $content, $matches)) {
echo " skipping $relfile (invalid format)\n";
return;
}
$svg = $matches[0];
if (strpos($svg, 'preserveAspectRatio="xMinYMid meet"') === false) {
return;
}
if (!is_writable($file)) {
echo " skipping $relfile (can not modify file)\n";
return;
}
$newsvg = preg_replace('/ ?preserveAspectRatio="xMinYMid meet"/', '', $svg);
$content = str_replace($svg, $newsvg, $content);
echo "resetting $relfile\n";
file_put_contents($file, $content);
}
/**
* Recursively works through directories of this theme, finding and fixing SVG images.
*
* @param string $base
* @param string $sub
* @param string $filecallback
* @param array $blacklist
*/
function core_admin_recurse_svgs($base, $sub, $filecallback, $blacklist) {
if (is_dir("$base/$sub")) {
$items = new DirectoryIterator("$base/$sub");
foreach ($items as $item) {
if ($item->isDot()) {
continue;
}
$file = $item->getFilename();
core_admin_recurse_svgs("$base/$sub", $file, $filecallback, $blacklist);
}
unset($item);
unset($items);
return;
} else if (is_file("$base/$sub")) {
if (substr($sub, -4) !== '.svg') {
return;
}
$file = realpath("$base/$sub");
if (in_array($file, $blacklist)) {
return;
}
$filecallback($file);
}
}
-171
View File
@@ -1,171 +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/>.
/**
* CLI script to uninstall plugins.
*
* @package core
* @subpackage cli
* @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->libdir . '/adminlib.php');
$help = "Command line tool to uninstall plugins.
Options:
-h --help Print this help.
--show-all Displays a list of all installed plugins.
--show-contrib Displays a list of all third-party installed plugins.
--show-missing Displays a list of plugins missing from disk.
--purge-missing Uninstall all missing from disk plugins.
--plugins=<plugin name> A comma separated list of plugins to be uninstalled. E.g. mod_assign,mod_forum
--run Execute uninstall. If this option is not set, then the script will be run in a dry mode.
Examples:
# php uninstall_plugins.php --show-all
Prints tab-separated list of all installed plugins.
# php uninstall_plugins.php --show-contrib
Prints tab-separated list of all third-party installed plugins.
# php uninstall_plugins.php --show-missing
Prints tab-separated list of all missing from disk plugins.
# php uninstall_plugins.php --purge-missing
A dry run of uninstalling all missing plugins.
# php uninstall_plugins.php --purge-missing --run
Run uninstall of all missing plugins.
# php uninstall_plugins.php --plugins=mod_assign,mod_forum
A dry run of uninstalling mod_assign and mod_forum plugins.
# php uninstall_plugins.php --plugins=mod_assign,mod_forum --run
Run uninstall for mod_assign and mod_forum plugins.
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'show-all' => false,
'show-contrib' => false,
'show-missing' => false,
'purge-missing' => false,
'plugins' => false,
'run' => false,
], [
'h' => 'help'
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($help);
exit(0);
}
$pluginman = core_plugin_manager::instance();
$plugininfo = $pluginman->get_plugins();
if ($options['show-all'] || $options['show-missing'] || $options['show-contrib']) {
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($options['show-contrib'] && $plugin->is_standard()) {
continue;
}
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($options['show-all'] || $options['show-contrib']) {
cli_writeln($pluginstring);
} else {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
cli_writeln($pluginstring);
}
}
}
}
exit(0);
}
if ($options['purge-missing']) {
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($pluginman->can_uninstall_plugin($plugin->component)) {
if ($options['run']) {
cli_writeln('Uninstalling: ' . $pluginstring);
$progress = new progress_trace_buffer(new text_progress_trace(), true);
$pluginman->uninstall_plugin($plugin->component, $progress);
$progress->finished();
cli_write($progress->get_buffer());
} else {
cli_writeln('Will be uninstalled: ' . $pluginstring);
}
} else {
cli_writeln('Can not be uninstalled: ' . $pluginstring);
}
}
}
}
exit(0);
}
if ($options['plugins']) {
$components = explode(',', $options['plugins']);
foreach ($components as $component) {
$plugin = $pluginman->get_plugin_info($component);
if (is_null($plugin)) {
cli_writeln('Unknown plugin: ' . $component);
} else {
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($pluginman->can_uninstall_plugin($plugin->component)) {
if ($options['run']) {
cli_writeln('Uninstalling: ' . $pluginstring);
$progress = new progress_trace_buffer(new text_progress_trace(), true);
$pluginman->uninstall_plugin($plugin->component, $progress);
$progress->finished();
cli_write($progress->get_buffer());
} else {
cli_writeln('Will be uninstalled: ' . $pluginstring);
}
} else {
cli_writeln('Can not be uninstalled: ' . $pluginstring);
}
}
}
exit(0);
}
cli_writeln($help);
exit(0);
+14 -67
View File
@@ -29,41 +29,27 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Force OPcache reset if used, we do not want any stale caches
// when detecting if upgrade necessary or when running upgrade.
if (function_exists('opcache_reset') and !isset($_SERVER['REMOTE_ADDR'])) {
opcache_reset();
}
define('CLI_SCRIPT', true);
define('CACHE_DISABLE_ALL', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/environmentlib.php');
require_once($CFG->libdir.'/pluginlib.php');
// now get cli options
$lang = isset($SESSION->lang) ? $SESSION->lang : $CFG->lang;
list($options, $unrecognized) = cli_get_params(
array(
'non-interactive' => false,
'allow-unstable' => false,
'help' => false,
'lang' => $lang,
'verbose-settings' => false,
'is-pending' => false,
'help' => false
),
array(
'h' => 'help'
)
);
if ($options['lang']) {
$SESSION->lang = $options['lang'];
}
$interactive = empty($options['non-interactive']);
if ($unrecognized) {
@@ -82,15 +68,6 @@ Options:
--non-interactive No interactive questions or confirmations
--allow-unstable Upgrade even if the version is not marked as stable yet,
required in non-interactive mode.
--lang=CODE Set preferred language for CLI output. Defaults to the
site language if not set. Defaults to 'en' if the lang
parameter is invalid or if the language pack is not
installed.
--verbose-settings Show new settings values. By default only the name of
new core or plugin settings are displayed. This option
outputs the new values as well as the setting name.
--is-pending If an upgrade is needed it exits with an error code of
2 so it distinct from other types of errors.
-h, --help Print out this help
Example:
@@ -119,10 +96,6 @@ if (!moodle_needs_upgrading()) {
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
}
if ($options['is-pending']) {
cli_error(get_string('cliupgradepending', 'core_admin'), 2);
}
// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
@@ -137,16 +110,15 @@ if (!$envstatus) {
// Test plugin dependencies.
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
cli_error(get_string('pluginschecktodo', 'admin'));
}
$a = new stdClass();
$a->oldversion = $oldversion;
$a->newversion = $newversion;
if ($interactive) {
$a = new stdClass();
$a->oldversion = $oldversion;
$a->newversion = $newversion;
echo cli_heading(get_string('databasechecking', '', $a)) . PHP_EOL;
}
@@ -178,12 +150,6 @@ if ($interactive) {
}
if ($version > $CFG->version) {
// We purge all of MUC's caches here.
// Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true.
// This ensures a real config object is loaded and the stores will be purged.
// This is the only way we can purge custom caches such as memcache or APC.
// Note: all other calls to caches will still used the disabled API.
cache_helper::purge_all(true);
upgrade_core($version, true);
}
set_config('release', $release);
@@ -193,32 +159,13 @@ set_config('branch', $branch);
upgrade_noncore(true);
// log in as admin - we need doanything permission when applying defaults
\core\session\manager::set_user(get_admin());
$admins = get_admins();
$admin = reset($admins);
session_set_user($admin);
// Apply default settings and output those that have changed.
cli_heading(get_string('cliupgradedefaultheading', 'admin'));
$settingsoutput = admin_apply_default_settings(null, false);
// apply all default settings, just in case do it twice to fill all defaults
admin_apply_default_settings(NULL, false);
admin_apply_default_settings(NULL, false);
foreach ($settingsoutput as $setting => $value) {
if ($options['verbose-settings']) {
$stringvlaues = array(
'name' => $setting,
'defaultsetting' => var_export($value, true) // Expand objects.
);
echo get_string('cliupgradedefaultverbose', 'admin', $stringvlaues) . PHP_EOL;
} else {
echo get_string('cliupgradedefault', 'admin', $setting) . PHP_EOL;
}
}
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
upgrade_themes();
echo get_string('cliupgradefinished', 'admin', $a)."\n";
echo get_string('cliupgradefinished', 'admin')."\n";
exit(0); // 0 means success
-82
View File
@@ -1,82 +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/>.
/**
* Allows the admin to enable, disable and uninstall course formats
*
* @package core_admin
* @copyright 2012 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$formatname = required_param('format', PARAM_PLUGIN);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/courseformats.php');
$PAGE->set_context($syscontext);
require_admin();
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'manageformats'));
$formatplugins = core_plugin_manager::instance()->get_plugins_of_type('format');
$sortorder = array_flip(array_keys($formatplugins));
if (!isset($formatplugins[$formatname])) {
print_error('courseformatnotfound', 'error', $return, $formatname);
}
switch ($action) {
case 'disable':
if ($formatplugins[$formatname]->is_enabled()) {
if (get_config('moodlecourse', 'format') === $formatname) {
print_error('cannotdisableformat', 'error', $return);
}
set_config('disabled', 1, 'format_'. $formatname);
core_plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$formatplugins[$formatname]->is_enabled()) {
unset_config('disabled', 'format_'. $formatname);
core_plugin_manager::reset_caches();
}
break;
case 'up':
if ($sortorder[$formatname]) {
$currentindex = $sortorder[$formatname];
$seq = array_keys($formatplugins);
$seq[$currentindex] = $seq[$currentindex-1];
$seq[$currentindex-1] = $formatname;
set_config('format_plugins_sortorder', implode(',', $seq));
}
break;
case 'down':
if ($sortorder[$formatname] < count($sortorder)-1) {
$currentindex = $sortorder[$formatname];
$seq = array_keys($formatplugins);
$seq[$currentindex] = $seq[$currentindex+1];
$seq[$currentindex+1] = $formatname;
set_config('format_plugins_sortorder', implode(',', $seq));
}
break;
}
redirect($return);
+16 -2
View File
@@ -53,7 +53,7 @@ require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/cronlib.php');
// extra safety
\core\session\manager::write_close();
session_get_instance()->write_close();
// check if execution allowed
if (!empty($CFG->cronclionly)) {
@@ -72,10 +72,24 @@ if (!empty($CFG->cronremotepassword)) {
}
// send mime type and encoding
@header('Content-Type: text/plain; charset=utf-8');
if (check_browser_version('MSIE')) {
//ugly IE hack to work around downloading instead of viewing
@header('Content-Type: text/html; charset=utf-8');
echo "<xmp>"; //<pre> is not good enough for us here
} else {
//send proper plaintext header
@header('Content-Type: text/plain; charset=utf-8');
}
// we do not want html markup in emulated CLI
@ini_set('html_errors', 'off');
// execute the cron
cron_run();
// finish the IE hack
if (check_browser_version('MSIE')) {
echo "</xmp>";
}
-61
View File
@@ -1,61 +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/>.
/**
* Allows the admin to enable, disable and uninstall custom fields
*
* @package core_admin
* @copyright 2018 Daniel Neis Araujo
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$customfieldname = required_param('field', PARAM_PLUGIN);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/customfields.php');
$PAGE->set_context($syscontext);
require_admin();
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'managecustomfields'));
$customfieldplugins = core_plugin_manager::instance()->get_plugins_of_type('customfield');
$sortorder = array_flip(array_keys($customfieldplugins));
if (!isset($customfieldplugins[$customfieldname])) {
print_error('customfieldnotfound', 'error', $return, $customfieldname);
}
switch ($action) {
case 'disable':
if ($customfieldplugins[$customfieldname]->is_enabled()) {
set_config('disabled', 1, 'customfield_'. $customfieldname);
core_plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$customfieldplugins[$customfieldname]->is_enabled()) {
unset_config('disabled', 'customfield_'. $customfieldname);
core_plugin_manager::reset_caches();
}
break;
}
redirect($return);
-81
View File
@@ -1,81 +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/>.
/**
* Lets users manage data formats
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @copyright 2016 Brendan Heywood (brendan@catalyst-au.net)
* @package core
* @subpackage dataformat
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$name = required_param('name', PARAM_PLUGIN);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/dataformats.php');
$PAGE->set_context($syscontext);
require_admin();
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'managedataformats'));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('dataformat');
$sortorder = array_flip(array_keys($plugins));
if (!isset($plugins[$name])) {
print_error('courseformatnotfound', 'error', $return, $name);
}
switch ($action) {
case 'disable':
if ($plugins[$name]->is_enabled()) {
set_config('disabled', 1, 'dataformat_'. $name);
core_plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$plugins[$name]->is_enabled()) {
unset_config('disabled', 'dataformat_'. $name);
core_plugin_manager::reset_caches();
}
break;
case 'up':
if ($sortorder[$name]) {
$currentindex = $sortorder[$name];
$seq = array_keys($plugins);
$seq[$currentindex] = $seq[$currentindex - 1];
$seq[$currentindex - 1] = $name;
set_config('dataformat_plugins_sortorder', implode(',', $seq));
}
break;
case 'down':
if ($sortorder[$name] < count($sortorder) - 1) {
$currentindex = $sortorder[$name];
$seq = array_keys($plugins);
$seq[$currentindex] = $seq[$currentindex + 1];
$seq[$currentindex + 1] = $name;
set_config('dataformat_plugins_sortorder', implode(',', $seq));
}
break;
}
redirect($return);
+5 -14
View File
@@ -8,17 +8,14 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$editor = required_param('editor', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/editors.php', array('action'=>$action, 'editor'=>$editor));
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageeditors";
$action = optional_param('action', '', PARAM_ACTION);
$editor = optional_param('editor', '', PARAM_PLUGIN);
// get currently installed and enabled auth plugins
$available_editors = editors_get_available();
if (!empty($editor) and empty($available_editors[$editor])) {
@@ -46,7 +43,6 @@ switch ($action) {
// remove from enabled list
$key = array_search($editor, $active_editors);
unset($active_editors[$key]);
add_to_config_log('editor_visibility', '1', '0', $editor);
break;
case 'enable':
@@ -54,7 +50,6 @@ switch ($action) {
if (!in_array($editor, $active_editors)) {
$active_editors[] = $editor;
$active_editors = array_unique($active_editors);
add_to_config_log('editor_visibility', '0', '1', $editor);
}
break;
@@ -67,7 +62,6 @@ switch ($action) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key + 1];
$active_editors[$key + 1] = $fsave;
add_to_config_log('editor_position', $key, $key + 1, $editor);
}
}
break;
@@ -81,11 +75,9 @@ switch ($action) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key - 1];
$active_editors[$key - 1] = $fsave;
add_to_config_log('editor_position', $key, $key - 1, $editor);
}
}
break;
default:
break;
}
@@ -96,7 +88,6 @@ if (empty($active_editors)) {
}
set_config('texteditors', implode(',', $active_editors));
core_plugin_manager::reset_caches();
if ($return) {
redirect ($returnurl);
+22 -27
View File
@@ -23,19 +23,18 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$action = required_param('action', PARAM_ACTION);
$enrol = required_param('enrol', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/enrol.php');
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_sesskey();
$enabled = enrol_get_plugins(true);
@@ -49,7 +48,6 @@ switch ($action) {
case 'disable':
unset($enabled[$enrol]);
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
core_plugin_manager::reset_caches();
$syscontext->mark_dirty(); // resets all enrol caches
break;
@@ -60,7 +58,6 @@ switch ($action) {
$enabled = array_keys($enabled);
$enabled[] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
core_plugin_manager::reset_caches();
$syscontext->mark_dirty(); // resets all enrol caches
break;
@@ -96,36 +93,34 @@ switch ($action) {
set_config('enrol_plugins_enabled', implode(',', $enabled));
break;
case 'migrate':
case 'uninstall':
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolments', 'enrol'));
if (get_string_manager()->string_exists('pluginname', 'enrol_'.$enrol)) {
$strplugin = get_string('pluginname', 'enrol_'.$enrol);
} else {
$strplugin = $enrol;
}
$PAGE->set_title($strplugin);
echo $OUTPUT->header();
if (!$confirm) {
$uurl = new moodle_url('/admin/enrol.php', array('action'=>'uninstall', 'enrol'=>$enrol, 'sesskey'=>sesskey(), 'confirm'=>1));
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'enrol', $strplugin), $uurl, $return);
echo $OUTPUT->footer();
exit;
// This may take a long time.
core_php_time_limit::raise();
} else { // Delete everything!!
uninstall_plugin('enrol', $enrol);
$syscontext->mark_dirty(); // resets all enrol caches
// Disable plugin to prevent concurrent cron execution.
unset($enabled[$enrol]);
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
echo $OUTPUT->heading(get_string('uninstallmigrating', 'enrol', 'enrol_'.$enrol));
require_once("$CFG->dirroot/enrol/manual/locallib.php");
enrol_manual_migrate_plugin_enrolments($enrol);
echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
if (!$return = core_plugin_manager::instance()->get_uninstall_url('enrol_'.$enrol, 'manage')) {
$return = new moodle_url('/admin/plugins.php');
$a = new stdClass();
$a->plugin = $strplugin;
$a->directory = "$CFG->dirroot/enrol/$enrol";
echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess');
echo $OUTPUT->continue_button($return);
echo $OUTPUT->footer();
exit;
}
echo $OUTPUT->continue_button($return);
echo $OUTPUT->footer();
exit;
}
+4 -4
View File
@@ -33,7 +33,7 @@ require_once($CFG->libdir.'/environmentlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
// Parameters
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ACTION);
$version = optional_param('version', '', PARAM_FILE); //
$extraurlparams = array();
@@ -45,7 +45,7 @@ admin_externalpage_setup('environment', '', $extraurlparams);
// Handle the 'updatecomponent' action
if ($action == 'updatecomponent' && confirm_sesskey()) {
// Create component installer and execute it
if ($cd = new component_installer('https://download.moodle.org',
if ($cd = new component_installer('http://download.moodle.org',
'environment',
'environment.zip')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
@@ -53,7 +53,7 @@ if ($action == 'updatecomponent' && confirm_sesskey()) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'https://download.moodle.org/environment/environment.zip';
$a->url = 'http://download.moodle.org/environment/environment.zip';
$a->dest = $CFG->dataroot . '/';
print_error($cd->get_error(), 'error', $PAGE->url, $a);
die();
@@ -102,7 +102,7 @@ if ($contents = load_environment_xml()) {
}
// Get the results of the environment check.
list($envstatus, $environment_results) = check_moodle_environment($version, ENV_SELECT_NEWER);
list($envstatus, $environment_results) = check_moodle_environment($version);
// Display the page.
$output = $PAGE->get_renderer('core', 'admin');
+20 -2770
View File
File diff suppressed because it is too large Load Diff
+205 -167
View File
@@ -1,228 +1,261 @@
<?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/>.
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// //
// This program 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 2 of the License, or //
// (at your option) any later version. //
// //
// This program 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: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Filter management page.
* Processes actions from the admin_setting_managefilters object (defined in
* adminlib.php).
*
* @package core
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package administration
*//** */
require_once(__DIR__ . '/../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/adminlib.php');
$action = optional_param('action', '', PARAM_ALPHA);
$filterpath = optional_param('filterpath', '', PARAM_PLUGIN);
$action = optional_param('action', '', PARAM_ACTION);
$filterpath = optional_param('filterpath', '', PARAM_PATH);
admin_externalpage_setup('managefilters');
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $systemcontext);
// Clean up bogus filter states first.
$plugininfos = core_plugin_manager::instance()->get_plugins_of_type('filter');
$filters = array();
$states = filter_get_global_states();
foreach ($states as $state) {
if (!isset($plugininfos[$state->filter]) and !get_config('filter_'.$state->filter, 'version')) {
// Purge messy leftovers after incorrectly uninstalled plugins and unfinished installs.
$DB->delete_records('filter_active', array('filter' => $state->filter));
$DB->delete_records('filter_config', array('filter' => $state->filter));
error_log('Deleted bogus "filter_'.$state->filter.'" states and config data.');
} else {
$filters[$state->filter] = $state;
$returnurl = "$CFG->wwwroot/$CFG->admin/filters.php";
admin_externalpage_setup('managefilters');
$filters = filter_get_global_states();
// In case any new filters have been installed, but not put in the table yet.
$fitlernames = filter_get_all_installed();
$newfilters = $fitlernames;
foreach ($filters as $filter => $notused) {
unset($newfilters[$filter]);
}
}
// Add properly installed and upgraded filters to the global states table.
foreach ($plugininfos as $filter => $info) {
if (isset($filters[$filter])) {
continue;
}
/** @var \core\plugininfo\base $info */
if ($info->is_installed_and_upgraded()) {
filter_set_global_state($filter, TEXTFILTER_DISABLED);
$states = filter_get_global_states();
foreach ($states as $state) {
if ($state->filter === $filter) {
$filters[$filter] = $state;
break;
}
/// Process actions ============================================================
if ($action) {
if (!isset($filters[$filterpath]) && !isset($newfilters[$filterpath])) {
throw new moodle_exception('filternotinstalled', 'error', $returnurl, $filterpath);
}
if (!confirm_sesskey()) {
redirect($returnurl);
}
}
}
if ($action) {
require_sesskey();
}
// Process actions.
switch ($action) {
switch ($action) {
case 'setstate':
if (isset($filters[$filterpath]) and $newstate = optional_param('newstate', '', PARAM_INT)) {
if ($newstate = optional_param('newstate', '', PARAM_INTEGER)) {
filter_set_global_state($filterpath, $newstate);
if ($newstate == TEXTFILTER_DISABLED) {
filter_set_applies_to_strings($filterpath, false);
}
unset($newfilters[$filterpath]);
}
break;
case 'setapplyto':
if (isset($filters[$filterpath])) {
$applytostrings = optional_param('stringstoo', false, PARAM_BOOL);
filter_set_applies_to_strings($filterpath, $applytostrings);
}
$applytostrings = optional_param('stringstoo', false, PARAM_BOOL);
filter_set_applies_to_strings($filterpath, $applytostrings);
break;
case 'down':
if (isset($filters[$filterpath])) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, 1);
$oldpos = $filters[$filterpath]->sortorder;
if ($oldpos <= count($filters)) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, $oldpos + 1);
}
}
break;
case 'up':
if (isset($filters[$filterpath])) {
$oldpos = $filters[$filterpath]->sortorder;
filter_set_global_state($filterpath, $filters[$filterpath]->active, -1);
if ($oldpos >= 1) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, $oldpos - 1);
}
}
break;
}
// Reset caches and return.
if ($action) {
reset_text_filters_cache();
core_plugin_manager::reset_caches();
redirect(new moodle_url('/admin/filters.php'));
}
case 'delete':
if (!empty($filternames[$filterpath])) {
$filtername = $filternames[$filterpath];
} else {
$filtername = $filterpath;
}
// Print the page heading.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('filtersettings', 'admin'));
if (substr($filterpath, 0, 4) == 'mod/') {
$mod = basename($filterpath);
$a = new stdClass;
$a->filter = $filtername;
$a->module = get_string('modulename', $mod);
print_error('cannotdeletemodfilter', 'admin', $returnurl, $a);
}
$states = filter_get_global_states();
$stringfilters = filter_get_string_filters();
// If not yet confirmed, display a confirmation message.
if (!optional_param('confirm', '', PARAM_BOOL)) {
$title = get_string('deletefilterareyousure', 'admin', $filtername);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
$table = new html_table();
$table->head = array(get_string('filter'), get_string('isactive', 'filters'),
get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('uninstallplugin', 'core_admin'));
$table->colclasses = array ('leftalign', 'leftalign', 'centeralign', 'leftalign', 'leftalign', 'leftalign');
$table->attributes['class'] = 'admintable generaltable';
$table->id = 'filterssetting';
$table->data = array();
$linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1));
$formcancel = new single_button(new moodle_url($returnurl), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel);
echo $OUTPUT->footer();
exit;
}
$lastactive = null;
foreach ($states as $state) {
if ($state->active != TEXTFILTER_DISABLED) {
$lastactive = $state->filter;
// Do the deletion.
$title = get_string('deletingfilter', 'admin', $filtername);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
// Delete all data for this plugin.
filter_delete_all_for_filter($filterpath);
$a = new stdClass;
$a->filter = $filtername;
$a->directory = $filterpath;
echo $OUTPUT->box(get_string('deletefilterfiles', 'admin', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->footer();
exit;
}
}
// Iterate through filters adding to display table.
$firstrow = true;
foreach ($states as $state) {
$filter = $state->filter;
if (!isset($plugininfos[$filter])) {
continue;
// Add any missing filters to the DB table.
foreach ($newfilters as $filter => $notused) {
filter_set_global_state($filter, TEXTFILTER_DISABLED);
}
$plugininfo = $plugininfos[$filter];
$applytostrings = isset($stringfilters[$filter]) && $state->active != TEXTFILTER_DISABLED;
$row = get_table_row($plugininfo, $state, $firstrow, $filter == $lastactive, $applytostrings);
$table->data[] = $row;
if ($state->active == TEXTFILTER_DISABLED) {
// Reset caches and return
if ($action) {
reset_text_filters_cache();
redirect($returnurl);
}
/// End of process actions =====================================================
/// Print the page heading.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('filtersettings', 'admin'));
$activechoices = array(
TEXTFILTER_DISABLED => get_string('disabled', 'filters'),
TEXTFILTER_OFF => get_string('offbutavailable', 'filters'),
TEXTFILTER_ON => get_string('on', 'filters'),
);
$applytochoices = array(
0 => get_string('content', 'filters'),
1 => get_string('contentandheadings', 'filters'),
);
$filters = filter_get_global_states();
// In case any new filters have been installed, but not put in the table yet.
$filternames = filter_get_all_installed();
$newfilters = $filternames;
foreach ($filters as $filter => $notused) {
unset($newfilters[$filter]);
}
$stringfilters = filter_get_string_filters();
$table = new html_table();
$table->head = array(get_string('filter'), get_string('isactive', 'filters'),
get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('delete'));
$table->align = array('left', 'left', 'center', 'left', 'left');
$table->width = '100%';
$table->data = array();
$lastactive = null;
foreach ($filters as $filter => $filterinfo) {
if ($filterinfo->active != TEXTFILTER_DISABLED) {
$lastactive = $filter;
}
}
// iterate through filters adding to display table
$firstrow = true;
foreach ($filters as $filter => $filterinfo) {
$applytostrings = isset($stringfilters[$filter]) && $filterinfo->active != TEXTFILTER_DISABLED;
$row = get_table_row($filterinfo, $firstrow, $filter == $lastactive, $applytostrings);
$table->data[] = $row;
if ($filterinfo->active == TEXTFILTER_DISABLED) {
$table->rowclasses[] = 'dimmed_text';
} else {
$table->rowclasses[] = '';
}
$firstrow = false;
}
foreach ($newfilters as $filter => $filtername) {
$filterinfo = new stdClass;
$filterinfo->filter = $filter;
$filterinfo->active = TEXTFILTER_DISABLED;
$row = get_table_row($filterinfo, false, false, false);
$table->data[] = $row;
$table->rowclasses[] = 'dimmed_text';
} else {
$table->rowclasses[] = '';
}
$firstrow = false;
}
echo html_writer::table($table);
echo '<p class="filtersettingnote">' . get_string('filterallwarning', 'filters') . '</p>';
echo $OUTPUT->footer();
die;
echo html_writer::table($table);
echo '<p class="filtersettingnote">' . get_string('filterallwarning', 'filters') . '</p>';
echo $OUTPUT->footer();
/// Display helper functions ===================================================
/**
* Return action URL.
*
* @param string $filterpath
* @param string $action
* @return moodle_url
*/
function filters_action_url($filterpath, $action) {
if ($action === 'delete') {
return core_plugin_manager::instance()->get_uninstall_url('filter_'.$filterpath, 'manage');
}
return new moodle_url('/admin/filters.php', array('sesskey'=>sesskey(), 'filterpath'=>$filterpath, 'action'=>$action));
}
/**
* Construct table record.
*
* @param \core\plugininfo\filter $plugininfo
* @param stdClass $state
* @param bool $isfirstrow
* @param bool $islastactive
* @param bool $applytostrings
* @return array data
*/
function get_table_row(\core\plugininfo\filter $plugininfo, $state, $isfirstrow, $islastactive, $applytostrings) {
global $OUTPUT;
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) {
global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; //TODO: this is sloppy coding style!!
$row = array();
$filter = $state->filter;
$active = $plugininfo->is_installed_and_upgraded();
$filter = $filterinfo->filter;
static $activechoices;
static $applytochoices;
if (!isset($activechoices)) {
$activechoices = array(
TEXTFILTER_DISABLED => get_string('disabled', 'core_filters'),
TEXTFILTER_OFF => get_string('offbutavailable', 'core_filters'),
TEXTFILTER_ON => get_string('on', 'core_filters'),
);
$applytochoices = array(
0 => get_string('content', 'core_filters'),
1 => get_string('contentandheadings', 'core_filters'),
);
// Filter name
if (!empty($filternames[$filter])) {
$row[] = $filternames[$filter];
} else {
$row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>';
}
// Filter name.
$displayname = $plugininfo->displayname;
if (!$plugininfo->rootdir) {
$displayname = '<span class="error">' . $displayname . ' - ' . get_string('status_missing', 'core_plugin') . '</span>';
} else if (!$active) {
$displayname = '<span class="error">' . $displayname . ' - ' . get_string('error') . '</span>';
}
$row[] = $displayname;
// Disable/off/on.
$select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $state->active, null, 'active' . $filter);
// Disable/off/on
$select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $filterinfo->active, null, 'active' . basename($filter));
$select->set_label(get_string('isactive', 'filters'), array('class' => 'accesshide'));
$row[] = $OUTPUT->render($select);
// Re-order.
// Re-order
$updown = '';
$spacer = $OUTPUT->spacer();
if ($state->active != TEXTFILTER_DISABLED) {
$spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" /> ';
if ($filterinfo->active != TEXTFILTER_DISABLED) {
if (!$isfirstrow) {
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up'), '', array('class' => 'iconsmall')));
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up')));
} else {
$updown .= $spacer;
}
if (!$islastactive) {
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'down'), new pix_icon('t/down', get_string('down'), '', array('class' => 'iconsmall')));
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'down'), new pix_icon('t/down', get_string('down')));
} else {
$updown .= $spacer;
}
@@ -230,20 +263,25 @@ function get_table_row(\core\plugininfo\filter $plugininfo, $state, $isfirstrow,
$row[] = $updown;
// Apply to strings.
$select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . $filter);
$select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . basename($filter));
$select->set_label(get_string('applyto', 'filters'), array('class' => 'accesshide'));
$select->disabled = ($state->active == TEXTFILTER_DISABLED);
$select->disabled = $filterinfo->active == TEXTFILTER_DISABLED;
$row[] = $OUTPUT->render($select);
// Settings link, if required.
if ($active and filter_has_global_settings($filter)) {
$row[] = html_writer::link(new moodle_url('/admin/settings.php', array('section'=>'filtersetting'.$filter)), get_string('settings'));
// Settings link, if required
if (filter_has_global_settings($filter)) {
$row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' .
str_replace('/', '',$filter) . '">' . get_string('settings') . '</a>';
} else {
$row[] = '';
}
// Uninstall.
$row[] = html_writer::link(filters_action_url($filter, 'delete'), get_string('uninstallplugin', 'core_admin'));
// Delete
if (substr($filter, 0, 4) != 'mod/') {
$row[] = '<a href="' . filters_action_url($filter, 'delete') . '">' . get_string('delete') . '</a>';
} else {
$row[] = '';
}
return $row;
}
+150
View File
@@ -0,0 +1,150 @@
<?php
/** This expects the output from a command like
* clamscan -r --infected --no-summary <files> 2>&1 | php -d error_log=/path/to/log thisfile.php
* also it's important that the output of clamscan prints the FULL PATH to each infected file, so use absolute paths for area to scan
* also it should be run as root, or whatever the webserver runs as so that it has the right permissions in the quarantine dir etc.
* php -d error_log=/path/to/log thisfile.php will override the default error log for php cli, which is stderr, so if you want this script to just print stuff out, use php thisfile.php instead.
*/
die('TODO: MDL-19380');
$fd = fopen('php://stdin','r');
if (!$fd) {
exit();
}
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->libdir.'/eventslib.php');
require_once($CFG->dirroot.'/lib/uploadlib.php'); // contains virus handling stuff.
$site = get_site();
while(!feof($fd)) {
$entry = fgets($fd);
if (strlen(trim($entry)) == 0) {
continue;
}
if (!$file = validate_line($entry)) {
continue;
}
$bits = explode('/',$file);
$a->filename = $bits[count($bits)-1];
if (!$log = $DB->get_record("log", array("module"=>"upload", "info"=>$file, "action"=>"upload"))) {
$a->action = clam_handle_infected_file($file,0,false);
clam_replace_infected_file($file);
notify_admins_unknown($file,$a);
continue;
}
$action = clam_handle_infected_file($file,$log->userid,true);
clam_replace_infected_file($file);
list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT c.id, c.fullname $ctxselect FROM {course} c $ctxjoin WHERE c.id = :courseid";
$course = $DB->get_record_sql($sql, array('courseid' => $log->course));
context_instance_preload($course);
$user = $DB->get_record("user", array("id"=>$log->userid));
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$a->date = userdate($log->time);
$a->action = $action;
$a->course = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$a->user = fullname($user);
notify_user($user,$subject,$a);
notify_admins($user,$subject,$a);
}
fclose($fd);
function notify_user($user,$subject,$a) {
if (!$user) {
return false;
}
$body = get_string('virusfoundlater','moodle',$a);
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
$eventdata->userto = $user;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
function notify_admins($user,$subject,$a) {
$admins = get_admins();
$body = get_string('virusfoundlateradmin','moodle',$a);
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
}
function notify_admins_unknown($file,$a) {
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$body = get_string('virusfoundlateradminnolog','moodle',$a);
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
}
function validate_line($line) {
global $CFG;
if (strpos($line,"FOUND") === false) {
return false;
}
$index = strpos($line,":");
$file = substr($line,0,$index);
if (!(strpos($file,$CFG->dataroot) === false)) {
if (!file_exists($file)) {
return false;
}
}
else {
if ($file{0} == "/") {
$file = $CFG->dataroot.$file;
}
else {
$file = $CFG->dataroot."/".$file;
}
if (!file_exists($file)) {
return false;
}
}
// clean up
$file = preg_replace('/\.\//','/',$file);
$file = preg_replace('/\/\//','/',$file);
return $file;
}
+109 -572
View File
@@ -29,9 +29,14 @@ if (!file_exists('../config.php')) {
die();
}
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Check that PHP is of a sufficient version as soon as possible
if (version_compare(phpversion(), '5.3.2') < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
echo "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).<br />";
echo "Please upgrade your server software or install older Moodle version.";
die();
}
// make sure iconv is available and actually works
if (!function_exists('iconv')) {
@@ -40,137 +45,36 @@ if (!function_exists('iconv')) {
die();
}
// Make sure php5-json is available.
if (!function_exists('json_encode') || !function_exists('json_decode')) {
// This also shouldn't happen.
echo 'Moodle requires the json PHP extension. Please install or enable the json extension.';
die();
}
// Make sure xml extension is available.
if (!extension_loaded('xml')) {
echo 'Moodle requires the xml PHP extension. Please install or enable the xml extension.';
die();
}
define('NO_OUTPUT_BUFFERING', true);
if (isset($_POST['upgradekey'])) {
// Before you start reporting issues about the collision attacks against
// SHA-1, you should understand that we are not actually attempting to do
// any cryptography here. This is hashed purely so that the key is not
// that apparent in the address bar itself. Anyone who catches the HTTP
// traffic can immediately use it as a valid admin key.
header('Location: index.php?cache=0&upgradekeyhash='.sha1($_POST['upgradekey']));
die();
}
if ((isset($_GET['cache']) and $_GET['cache'] === '0')
or (isset($_POST['cache']) and $_POST['cache'] === '0')
or (!isset($_POST['cache']) and !isset($_GET['cache']) and empty($_GET['sesskey']) and empty($_POST['sesskey']))) {
// Prevent caching at all cost when visiting this page directly,
// we redirect to self once we known no upgrades are necessary.
// Note: $_GET and $_POST are used here intentionally because our param cleaning is not loaded yet.
// Note2: the sesskey is present in all block editing hacks, we can not redirect there, so enable caching.
define('CACHE_DISABLE_ALL', true);
// Force OPcache reset if used, we do not want any stale caches
// when detecting if upgrade necessary or when running upgrade.
if (function_exists('opcache_reset')) {
opcache_reset();
}
$cache = 0;
} else {
$cache = 1;
}
require('../config.php');
// Invalidate the cache of version.php in any circumstances to help core_component
// detecting if the version has changed and component cache should be reset.
if (function_exists('opcache_invalidate')) {
opcache_invalidate($CFG->dirroot . '/version.php', true);
}
// Make sure the component cache gets rebuilt if necessary, any method that
// indirectly calls the protected init() method is good here.
core_component::get_core_subsystems();
if (is_major_upgrade_required() && isloggedin()) {
// A major upgrade is required.
// Terminate the session and redirect back here before anything DB-related happens.
redirect_if_major_upgrade_required();
}
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
require_once($CFG->libdir.'/pluginlib.php'); // available updates notifications
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL); // Core upgrade confirmed?
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL); // Core release info and server checks confirmed?
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL); // Plugins check page confirmed?
$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL); // Show all plugins on the plugins check page?
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL); // GPL license confirmed for installation?
$fetchupdates = optional_param('fetchupdates', 0, PARAM_BOOL); // Should check for available updates?
$newaddonreq = optional_param('installaddonrequest', null, PARAM_RAW); // Plugin installation requested at moodle.org/plugins.
$upgradekeyhash = optional_param('upgradekeyhash', null, PARAM_ALPHANUM); // Hash of provided upgrade key.
$installdep = optional_param('installdep', null, PARAM_COMPONENT); // Install given missing dependency (required plugin).
$installdepx = optional_param('installdepx', false, PARAM_BOOL); // Install all missing dependencies.
$confirminstalldep = optional_param('confirminstalldep', false, PARAM_BOOL); // Installing dependencies confirmed.
$abortinstall = optional_param('abortinstall', null, PARAM_COMPONENT); // Cancel installation of the given new plugin.
$abortinstallx = optional_param('abortinstallx', null, PARAM_BOOL); // Cancel installation of all new plugins.
$confirmabortinstall = optional_param('confirmabortinstall', false, PARAM_BOOL); // Installation cancel confirmed.
$abortupgrade = optional_param('abortupgrade', null, PARAM_COMPONENT); // Cancel upgrade of the given existing plugin.
$abortupgradex = optional_param('abortupgradex', null, PARAM_BOOL); // Cancel upgrade of all upgradable plugins.
$confirmabortupgrade = optional_param('confirmabortupgrade', false, PARAM_BOOL); // Upgrade cancel confirmed.
$installupdate = optional_param('installupdate', null, PARAM_COMPONENT); // Install given available update.
$installupdateversion = optional_param('installupdateversion', null, PARAM_INT); // Version of the available update to install.
$installupdatex = optional_param('installupdatex', false, PARAM_BOOL); // Install all available plugin updates.
$confirminstallupdate = optional_param('confirminstallupdate', false, PARAM_BOOL); // Available update(s) install confirmed?
$id = optional_param('id', '', PARAM_TEXT);
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL);
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
$fetchupdates = optional_param('fetchupdates', 0, PARAM_BOOL);
if (!empty($CFG->disableupdateautodeploy)) {
// Invalidate all requests to install plugins via the admin UI.
$newaddonreq = null;
$installdep = null;
$installdepx = false;
$abortupgrade = null;
$abortupgradex = null;
$installupdate = null;
$installupdateversion = null;
$installupdatex = false;
}
// Set up PAGE.
$url = new moodle_url('/admin/index.php');
$url->param('cache', $cache);
if (isset($upgradekeyhash)) {
$url->param('upgradekeyhash', $upgradekeyhash);
}
$PAGE->set_url($url);
unset($url);
// Are we returning from an add-on installation request at moodle.org/plugins?
if ($newaddonreq and !$cache and empty($CFG->disableupdateautodeploy)) {
$target = new moodle_url('/admin/tool/installaddon/index.php', array(
'installaddonrequest' => $newaddonreq,
'confirm' => 0));
if (!isloggedin() or isguestuser()) {
// Login and go the the add-on tool page.
$SESSION->wantsurl = $target->out();
redirect(get_login_url());
}
redirect($target);
}
// Check some PHP server settings
$PAGE->set_url('/admin/index.php');
$PAGE->set_pagelayout('admin'); // Set a default pagelayout
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
// Check some PHP server settings
if (ini_get_bool('session.auto_start')) {
print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
}
if (ini_get_bool('magic_quotes_runtime')) {
print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
}
if (!ini_get_bool('file_uploads')) {
print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
}
@@ -200,6 +104,10 @@ if (!$version or !$release) {
print_error('withoutversion', 'debug'); // without version, stop
}
// Turn off xmlstrictheaders during upgrade.
$origxmlstrictheaders = !empty($CFG->xmlstrictheaders);
$CFG->xmlstrictheaders = false;
if (!core_tables_exist()) {
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
@@ -210,7 +118,7 @@ if (!core_tables_exist()) {
$strinstallation = get_string('installation', 'install');
// remove current session content completely
\core\session\manager::terminate_current();
session_get_instance()->terminate_current();
if (empty($agreelicense)) {
$strlicense = get_string('license');
@@ -226,7 +134,7 @@ if (!core_tables_exist()) {
}
if (empty($confirmrelease)) {
require_once($CFG->libdir.'/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
@@ -235,19 +143,19 @@ if (!core_tables_exist()) {
$PAGE->set_cacheable(false);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->install_environment_page($maturity, $envstatus, $environmentresults, $release);
echo $output->install_environment_page($maturity, $envstatus, $environment_results, $release);
die();
}
// check plugin dependencies
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
$PAGE->navbar->add(get_string('pluginscheck', 'admin'));
$PAGE->set_title($strinstallation);
$PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release);
$output = $PAGE->get_renderer('core', 'admin');
$url = new moodle_url($PAGE->url, array('agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang));
$url = new moodle_url('/admin/index.php', array('agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang));
echo $output->unsatisfied_dependencies_page($version, $failed, $url);
die();
}
@@ -280,87 +188,44 @@ if (!core_tables_exist()) {
// Check version of Moodle code on disk compared with database
// and upgrade if possible.
if (!$cache) {
// Do not try to do anything fancy in non-cached mode,
// this prevents themes from fetching data from non-existent tables.
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
}
$stradministration = get_string('administration');
$PAGE->set_context(context_system::instance());
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
if (empty($CFG->version)) {
print_error('missingconfigversion', 'debug');
}
// Detect config cache inconsistency, this happens when you switch branches on dev servers.
if ($CFG->version != $DB->get_field('config', 'value', array('name'=>'version'))) {
if ($version > $CFG->version) { // upgrade
purge_all_caches();
redirect(new moodle_url($PAGE->url), 'Config cache inconsistency detected, resetting caches...');
}
if (!$cache and $version > $CFG->version) { // upgrade
$PAGE->set_url(new moodle_url($PAGE->url, array(
'confirmupgrade' => $confirmupgrade,
'confirmrelease' => $confirmrelease,
'confirmplugincheck' => $confirmplugins,
)));
check_upgrade_key($upgradekeyhash);
// Warning about upgrading a test site.
$testsite = false;
if (defined('BEHAT_SITE_RUNNING')) {
$testsite = 'behat';
}
if (isset($CFG->themerev)) {
// Store the themerev to restore after purging caches.
$themerev = $CFG->themerev;
}
// We purge all of MUC's caches here.
// Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true.
// This ensures a real config object is loaded and the stores will be purged.
// This is the only way we can purge custom caches such as memcache or APC.
// Note: all other calls to caches will still used the disabled API.
cache_helper::purge_all(true);
// We then purge the regular caches.
purge_all_caches();
if (isset($themerev)) {
// Restore the themerev
set_config('themerev', $themerev);
}
$output = $PAGE->get_renderer('core', 'admin');
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
if (upgrade_stale_php_files_present()) {
$PAGE->set_title($stradministration);
$PAGE->set_cacheable(false);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->upgrade_stale_php_files_page();
die();
}
if (empty($confirmupgrade)) {
$a = new stdClass();
$a->oldversion = "$CFG->release (".sprintf('%.2f', $CFG->version).")";
$a->newversion = "$release (".sprintf('%.2f', $version).")";
$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string('databasechecking', '', $a);
$PAGE->set_title($stradministration);
$PAGE->set_heading($strdatabasechecking);
$PAGE->set_cacheable(false);
echo $output->upgrade_confirm_page($a->newversion, $maturity, $testsite);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->upgrade_confirm_page($a->newversion, $maturity);
die();
} else if (empty($confirmrelease)) {
} else if (empty($confirmrelease)){
require_once($CFG->libdir.'/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE);
list($envstatus, $environment_results) = check_moodle_environment($release, ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
@@ -368,7 +233,8 @@ if (!$cache and $version > $CFG->version) { // upgrade
$PAGE->set_heading($strcurrentrelease);
$PAGE->set_cacheable(false);
echo $output->upgrade_environment_page($release, $envstatus, $environmentresults);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->upgrade_environment_page($release, $envstatus, $environment_results);
die();
} else if (empty($confirmplugins)) {
@@ -379,143 +245,33 @@ if (!$cache and $version > $CFG->version) { // upgrade
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
$pluginman = core_plugin_manager::instance();
$reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1));
// Check for available updates.
if ($fetchupdates) {
// No sesskey support guaranteed here, because sessions might not work yet.
$updateschecker = \core\update\checker::instance();
if ($updateschecker->enabled()) {
$updateschecker->fetch();
}
redirect($PAGE->url);
}
// Cancel all plugin installations.
if ($abortinstallx) {
// No sesskey support guaranteed here, because sessions might not work yet.
$abortables = $pluginman->list_cancellable_installations();
if ($abortables) {
if ($confirmabortinstall) {
foreach ($abortables as $plugin) {
$pluginman->cancel_plugin_installation($plugin->component);
}
redirect($PAGE->url);
} else {
$continue = new moodle_url($PAGE->url, array('abortinstallx' => $abortinstallx, 'confirmabortinstall' => 1));
echo $output->upgrade_confirm_abort_install_page($abortables, $continue);
die();
}
}
redirect($PAGE->url);
}
// Cancel single plugin installation.
if ($abortinstall) {
// No sesskey support guaranteed here, because sessions might not work yet.
if ($confirmabortinstall) {
$pluginman->cancel_plugin_installation($abortinstall);
redirect($PAGE->url);
} else {
$continue = new moodle_url($PAGE->url, array('abortinstall' => $abortinstall, 'confirmabortinstall' => 1));
$abortable = $pluginman->get_plugin_info($abortinstall);
if ($pluginman->can_cancel_plugin_installation($abortable)) {
echo $output->upgrade_confirm_abort_install_page(array($abortable), $continue);
die();
}
redirect($PAGE->url);
}
}
// Cancel all plugins upgrades (that is, restore archived versions).
if ($abortupgradex) {
// No sesskey support guaranteed here, because sessions might not work yet.
$restorable = $pluginman->list_restorable_archives();
if ($restorable) {
upgrade_install_plugins($restorable, $confirmabortupgrade,
get_string('cancelupgradehead', 'core_plugin'),
new moodle_url($PAGE->url, array('abortupgradex' => 1, 'confirmabortupgrade' => 1))
);
}
redirect($PAGE->url);
}
// Cancel single plugin upgrade (that is, install the archived version).
if ($abortupgrade) {
// No sesskey support guaranteed here, because sessions might not work yet.
$restorable = $pluginman->list_restorable_archives();
if (isset($restorable[$abortupgrade])) {
$restorable = array($restorable[$abortupgrade]);
upgrade_install_plugins($restorable, $confirmabortupgrade,
get_string('cancelupgradehead', 'core_plugin'),
new moodle_url($PAGE->url, array('abortupgrade' => $abortupgrade, 'confirmabortupgrade' => 1))
);
}
redirect($PAGE->url);
}
// Install all available missing dependencies.
if ($installdepx) {
// No sesskey support guaranteed here, because sessions might not work yet.
$installable = $pluginman->filter_installable($pluginman->missing_dependencies(true));
upgrade_install_plugins($installable, $confirminstalldep,
get_string('dependencyinstallhead', 'core_plugin'),
new moodle_url($PAGE->url, array('installdepx' => 1, 'confirminstalldep' => 1))
);
}
// Install single available missing dependency.
if ($installdep) {
// No sesskey support guaranteed here, because sessions might not work yet.
$installable = $pluginman->filter_installable($pluginman->missing_dependencies(true));
if (!empty($installable[$installdep])) {
$installable = array($installable[$installdep]);
upgrade_install_plugins($installable, $confirminstalldep,
get_string('dependencyinstallhead', 'core_plugin'),
new moodle_url($PAGE->url, array('installdep' => $installdep, 'confirminstalldep' => 1))
);
}
}
// Install all available updates.
if ($installupdatex) {
// No sesskey support guaranteed here, because sessions might not work yet.
$installable = $pluginman->filter_installable($pluginman->available_updates());
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1))
);
}
// Install single available update.
if ($installupdate and $installupdateversion) {
// No sesskey support guaranteed here, because sessions might not work yet.
if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) {
$installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true));
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdate' => $installupdate,
'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1)
)
);
}
}
echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(),
$version, $showallplugins, $PAGE->url, new moodle_url($PAGE->url, array('confirmplugincheck' => 1)));
die();
} else {
// Always verify plugin dependencies!
// check plugin dependencies first
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
array('confirmplugincheck' => 0)));
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
$output = $PAGE->get_renderer('core', 'admin');
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
die();
}
unset($failed);
// Launch main upgrade.
if ($fetchupdates) {
// no sesskey support guaranteed here
if (empty($CFG->disableupdatenotifications)) {
available_update_checker::instance()->fetch();
}
redirect($reloadurl);
}
$output = $PAGE->get_renderer('core', 'admin');
echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(),
$version, $showallplugins, $reloadurl,
new moodle_url('/admin/index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)));
die();
} else {
// Launch main upgrade
upgrade_core($version, true);
}
} else if ($version < $CFG->version) {
@@ -524,191 +280,51 @@ if (!$cache and $version > $CFG->version) { // upgrade
}
// Updated human-readable release version if necessary
if (!$cache and $release <> $CFG->release) { // Update the release version
if ($release <> $CFG->release) { // Update the release version
set_config('release', $release);
}
if (!$cache and $branch <> $CFG->branch) { // Update the branch
if ($branch <> $CFG->branch) { // Update the branch
set_config('branch', $branch);
}
if (!$cache and moodle_needs_upgrading()) {
$PAGE->set_url(new moodle_url($PAGE->url, array(
'confirmrelease' => $confirmrelease,
'confirmplugincheck' => $confirmplugins,
)));
check_upgrade_key($upgradekeyhash);
if (moodle_needs_upgrading()) {
if (!$PAGE->headerprinted) {
// means core upgrade or installation was not already done
$pluginman = core_plugin_manager::instance();
$output = $PAGE->get_renderer('core', 'admin');
if (empty($confirmrelease)) {
require_once($CFG->libdir . '/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
$PAGE->set_title($strcurrentrelease);
$PAGE->set_heading($strcurrentrelease);
$PAGE->set_cacheable(false);
echo $output->upgrade_environment_page($release, $envstatus, $environmentresults);
die();
} else if (!$confirmplugins) {
if (!$confirmplugins) {
$strplugincheck = get_string('plugincheck');
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
$PAGE->navbar->add($strplugincheck);
$PAGE->set_title($strplugincheck);
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
// Check for available updates.
if ($fetchupdates) {
require_sesskey();
$updateschecker = \core\update\checker::instance();
if ($updateschecker->enabled()) {
$updateschecker->fetch();
}
// no sesskey support guaranteed here
available_update_checker::instance()->fetch();
redirect($PAGE->url);
}
// Cancel all plugin installations.
if ($abortinstallx) {
require_sesskey();
$abortables = $pluginman->list_cancellable_installations();
if ($abortables) {
if ($confirmabortinstall) {
foreach ($abortables as $plugin) {
$pluginman->cancel_plugin_installation($plugin->component);
}
redirect($PAGE->url);
} else {
$continue = new moodle_url($PAGE->url, array('abortinstallx' => $abortinstallx,
'confirmabortinstall' => 1));
echo $output->upgrade_confirm_abort_install_page($abortables, $continue);
die();
}
}
redirect($PAGE->url);
}
$output = $PAGE->get_renderer('core', 'admin');
// Cancel single plugin installation.
if ($abortinstall) {
require_sesskey();
if ($confirmabortinstall) {
$pluginman->cancel_plugin_installation($abortinstall);
redirect($PAGE->url);
} else {
$continue = new moodle_url($PAGE->url, array('abortinstall' => $abortinstall, 'confirmabortinstall' => 1));
$abortable = $pluginman->get_plugin_info($abortinstall);
if ($pluginman->can_cancel_plugin_installation($abortable)) {
echo $output->upgrade_confirm_abort_install_page(array($abortable), $continue);
die();
}
redirect($PAGE->url);
}
// check plugin dependencies first
$failed = array();
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
die();
}
unset($failed);
// Cancel all plugins upgrades (that is, restore archived versions).
if ($abortupgradex) {
require_sesskey();
$restorable = $pluginman->list_restorable_archives();
if ($restorable) {
upgrade_install_plugins($restorable, $confirmabortupgrade,
get_string('cancelupgradehead', 'core_plugin'),
new moodle_url($PAGE->url, array('abortupgradex' => 1, 'confirmabortupgrade' => 1))
);
}
redirect($PAGE->url);
}
// Cancel single plugin upgrade (that is, install the archived version).
if ($abortupgrade) {
require_sesskey();
$restorable = $pluginman->list_restorable_archives();
if (isset($restorable[$abortupgrade])) {
$restorable = array($restorable[$abortupgrade]);
upgrade_install_plugins($restorable, $confirmabortupgrade,
get_string('cancelupgradehead', 'core_plugin'),
new moodle_url($PAGE->url, array('abortupgrade' => $abortupgrade, 'confirmabortupgrade' => 1))
);
}
redirect($PAGE->url);
}
// Install all available missing dependencies.
if ($installdepx) {
require_sesskey();
$installable = $pluginman->filter_installable($pluginman->missing_dependencies(true));
upgrade_install_plugins($installable, $confirminstalldep,
get_string('dependencyinstallhead', 'core_plugin'),
new moodle_url($PAGE->url, array('installdepx' => 1, 'confirminstalldep' => 1))
);
}
// Install single available missing dependency.
if ($installdep) {
require_sesskey();
$installable = $pluginman->filter_installable($pluginman->missing_dependencies(true));
if (!empty($installable[$installdep])) {
$installable = array($installable[$installdep]);
upgrade_install_plugins($installable, $confirminstalldep,
get_string('dependencyinstallhead', 'core_plugin'),
new moodle_url($PAGE->url, array('installdep' => $installdep, 'confirminstalldep' => 1))
);
}
}
// Install all available updates.
if ($installupdatex) {
require_sesskey();
$installable = $pluginman->filter_installable($pluginman->available_updates());
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1))
);
}
// Install single available update.
if ($installupdate and $installupdateversion) {
require_sesskey();
if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) {
$installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true));
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdate' => $installupdate,
'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1)
)
);
}
}
// Show plugins info.
echo $output->upgrade_plugin_check_page($pluginman, \core\update\checker::instance(),
// dependencies check passed, let's rock!
echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(),
$version, $showallplugins,
new moodle_url($PAGE->url),
new moodle_url($PAGE->url, array('confirmplugincheck' => 1, 'cache' => 0)));
new moodle_url('/admin/index.php', array('confirmplugincheck'=>1)));
die();
}
// Make sure plugin dependencies are always checked.
$failed = array();
if (!$pluginman->all_plugins_ok($version, $failed)) {
$output = $PAGE->get_renderer('core', 'admin');
echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
array('confirmplugincheck' => 0)));
die();
}
unset($failed);
}
// install/upgrade all plugins and other parts
upgrade_noncore(true);
}
@@ -718,7 +334,6 @@ if (!$cache and moodle_needs_upgrading()) {
if (during_initial_install()) {
set_config('rolesactive', 1); // after this, during_initial_install will return false.
set_config('adminsetuppending', 1);
set_config('registrationpending', 1); // Remind to register site after all other setup is finished.
// we need this redirect to setup proper session
upgrade_finished("index.php?sessionstarted=1&amp;lang=$CFG->lang");
}
@@ -742,10 +357,6 @@ if (during_initial_install()) {
}
}
// Cleanup SESSION to make sure other code does not complain in the future.
unset($SESSION->has_timed_out);
unset($SESSION->wantsurl);
// at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
$adminids = explode(',', $CFG->siteadmins);
$adminuser = get_complete_user_data('id', reset($adminids));
@@ -769,40 +380,14 @@ if (during_initial_install()) {
upgrade_finished('upgradesettings.php');
}
if (has_capability('moodle/site:config', context_system::instance())) {
if ($fetchupdates) {
require_sesskey();
$updateschecker = \core\update\checker::instance();
if ($updateschecker->enabled()) {
$updateschecker->fetch();
}
redirect(new moodle_url('/admin/index.php', array('cache' => 0)));
}
}
// Now we can be sure everything was upgraded and caches work fine,
// redirect if necessary to make sure caching is enabled.
if (!$cache) {
redirect(new moodle_url('/admin/index.php', array('cache' => 1)));
}
// Turn xmlstrictheaders back on now.
$CFG->xmlstrictheaders = $origxmlstrictheaders;
unset($origxmlstrictheaders);
// Check for valid admin user - no guest autologin
require_login(0, false);
if (isguestuser()) {
// Login as real user!
$SESSION->wantsurl = (string)new moodle_url('/admin/index.php');
redirect(get_login_url());
}
$context = context_system::instance();
if (!has_capability('moodle/site:config', $context)) {
// Do not throw exception display an empty page with administration menu if visible for current user.
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->footer();
exit;
}
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
// check that site is properly customized
$site = get_site();
@@ -810,10 +395,14 @@ if (empty($site->shortname)) {
// probably new installation - lets return to frontpage after this step
// remove settings that we want uninitialised
unset_config('registerauth');
unset_config('timezone'); // Force admin to select timezone!
redirect('upgradesettings.php?return=site');
}
// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
if (!empty($id) and $id == $CFG->siteidentifier) {
set_config('registered', time());
}
// setup critical warnings before printing admin tree block
$insecuredataroot = is_dataroot_insecure(true);
$SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR);
@@ -821,90 +410,38 @@ $SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR);
$adminroot = admin_get_root();
// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)) {
if (any_new_admin_settings($adminroot)){
redirect('upgradesettings.php');
}
// Return to original page that started the plugin uninstallation if necessary.
if (isset($SESSION->pluginuninstallreturn)) {
$return = $SESSION->pluginuninstallreturn;
unset($SESSION->pluginuninstallreturn);
if ($return) {
redirect($return);
}
}
// If site registration needs updating, redirect.
\core\hub\registration::registration_reminder('/admin/index.php');
// Everything should now be set up, and the user is an admin
// Print default admin page with notifications.
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
$lastcron = get_config('tool_task', 'lastcronstart');
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
$cronoverdue = ($lastcron < time() - 3600 * 24);
$lastcroninterval = get_config('tool_task', 'lastcroninterval');
$expectedfrequency = $CFG->expectedcronfrequency ?? 200;
$croninfrequent = !$cronoverdue && ($lastcroninterval > $expectedfrequency || $lastcron < time() - $expectedfrequency);
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
// Available updates for Moodle core.
$updateschecker = \core\update\checker::instance();
$availableupdates = array();
$availableupdatesfetch = null;
if ($updateschecker->enabled()) {
// Only compute the update information when it is going to be displayed to the user.
$availableupdates['core'] = $updateschecker->get_update_info('core',
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
// Available updates for contributed plugins
$pluginman = core_plugin_manager::instance();
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
$pluginavailableupdates = $plugininfo->available_updates();
if (!empty($pluginavailableupdates)) {
foreach ($pluginavailableupdates as $pluginavailableupdate) {
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
$availableupdates[$plugintype.'_'.$pluginname] = array();
}
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
}
}
}
}
// The timestamp of the most recent check for available updates
$availableupdatesfetch = $updateschecker->get_last_timefetched();
}
$updateschecker = available_update_checker::instance();
$availableupdates = $updateschecker->get_update_info('core',
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
$availableupdatesfetch = $updateschecker->get_last_timefetched();
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
//check if the site is registered on Moodle.org
$registered = \core\hub\registration::is_registered();
// Check if there are any cache warnings.
$cachewarnings = cache_helper::warnings();
// Check if there are events 1 API handlers.
$eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}');
$themedesignermode = !empty($CFG->themedesignermode);
$mobileconfigured = !empty($CFG->enablemobilewebservice);
$invalidforgottenpasswordurl = !empty($CFG->forgottenpasswordurl) && empty(clean_param($CFG->forgottenpasswordurl, PARAM_URL));
// Check if a directory with development libraries exists.
if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || is_dir($CFG->dirroot.'/node_modules'))) {
$devlibdir = true;
} else {
$devlibdir = false;
}
// Check if the site is being foced onto ssl.
$overridetossl = !empty($CFG->overridetossl);
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
admin_externalpage_setup('adminnotifications');
$output = $PAGE->get_renderer('core', 'admin');
if ($fetchupdates) {
require_sesskey();
$updateschecker->fetch();
redirect($PAGE->url);
}
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
$registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir,
$mobileconfigured, $overridetossl, $invalidforgottenpasswordurl, $croninfrequent);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
$registered);
+12 -86
View File
@@ -18,14 +18,12 @@
/**
* This file contains functions used by the admin pages
*
* @since Moodle 2.1
* @since 2.1
* @package admin
* @copyright 2011 Andrew Davis
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Return a list of page types
* @param string $pagetype current page type
@@ -37,88 +35,16 @@ function admin_page_type_list($pagetype, $parentcontext, $currentcontext) {
'admin-*' => get_string('page-admin-x', 'pagetype'),
$pagetype => get_string('page-admin-current', 'pagetype')
);
// Add the missing * (any page) option for them. MDL-30340
// TODO: These pages are really 'pagetype-varying' - MDL-30564 -
// and some day we should stop behaving that way, so proper pagetypes
// can be specified for it (like course-category-* or so).
// Luckly... the option we are introducing '*' is independent
// of that varying behavior, so will work.
if ($pagetype == 'admin-course-category') {
$array += array(
'*' => get_string('page-x', 'pagetype')
);
}
return $array;
}
/**
* File serving.
*
* @param stdClass $course The course object.
* @param stdClass $cm The cm object.
* @param context $context The context object.
* @param string $filearea The file area.
* @param array $args List of arguments.
* @param bool $forcedownload Whether or not to force the download of the file.
* @param array $options Array of options.
* @return void|false
*/
function core_admin_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
global $CFG;
if (in_array($filearea, ['logo', 'logocompact'])) {
$size = array_shift($args); // The path hides the size.
$itemid = clean_param(array_shift($args), PARAM_INT);
$filename = clean_param(array_shift($args), PARAM_FILE);
$themerev = theme_get_revision();
if ($themerev <= 0) {
// Normalise to 0 as -1 doesn't place well with paths.
$themerev = 0;
}
// Extract the requested width and height.
$maxwidth = 0;
$maxheight = 0;
if (preg_match('/^\d+x\d+$/', $size)) {
list($maxwidth, $maxheight) = explode('x', $size);
$maxwidth = clean_param($maxwidth, PARAM_INT);
$maxheight = clean_param($maxheight, PARAM_INT);
}
$lifetime = 0;
if ($itemid > 0 && $themerev == $itemid) {
// The itemid is $CFG->themerev, when 0 or less no caching. Also no caching when they don't match.
$lifetime = DAYSECS * 60;
}
// Anyone, including guests and non-logged in users, can view the logos.
$options = ['cacheability' => 'public'];
// Check if we've got a cached file to return. When lifetime is 0 then we don't want to cached one.
$candidate = $CFG->localcachedir . "/core_admin/$themerev/$filearea/{$maxwidth}x{$maxheight}/$filename";
if (file_exists($candidate) && $lifetime > 0) {
send_file($candidate, $filename, $lifetime, 0, false, false, '', false, $options);
}
// Find the original file.
$fs = get_file_storage();
$filepath = "/{$context->id}/core_admin/{$filearea}/0/{$filename}";
if (!$file = $fs->get_file_by_hash(sha1($filepath))) {
send_file_not_found();
}
// No need for resizing, but if the file should be cached we save it so we can serve it fast next time.
if (empty($maxwidth) && empty($maxheight)) {
if ($lifetime) {
file_safe_save_content($file->get_content(), $candidate);
}
send_stored_file($file, $lifetime, 0, false, $options);
}
// Proceed with the resizing.
$filedata = $file->resize_image($maxwidth, $maxheight);
if (!$filedata) {
send_file_not_found();
}
// If we don't want to cached the file, serve now and quit.
if (!$lifetime) {
send_content_uncached($filedata, $filename);
}
// Save, serve and quit.
file_safe_save_content($filedata, $candidate);
send_file($candidate, $filename, $lifetime, 0, false, false, '', false, $options);
}
send_file_not_found();
}
+3 -2
View File
@@ -23,11 +23,12 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/licenselib.php');
require_admin();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managelicenses";
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ACTION);
$license = optional_param('license', '', PARAM_SAFEDIR);
////////////////////////////////////////////////////////////////////////////////
+43 -11
View File
@@ -27,27 +27,61 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('managelocalplugins');
$delete = optional_param('delete', '', PARAM_PLUGIN);
$confirm = optional_param('confirm', '', PARAM_BOOL);
/// If data submitted, then process and store.
if (!empty($delete) and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('localplugins'));
if (!$confirm) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $delete)) {
$strpluginname = get_string('pluginname', 'local_' . $delete);
} else {
$strpluginname = $delete;
}
echo $OUTPUT->confirm(get_string('localplugindeleteconfirm', '', $strpluginname),
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
$PAGE->url);
echo $OUTPUT->footer();
die();
} else {
uninstall_plugin('local', $delete);
$a = new stdclass();
$a->name = $delete;
$pluginlocation = get_plugin_types();
$a->directory = $pluginlocation['local'] . '/' . $delete;
echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
echo $OUTPUT->continue_button($PAGE->url);
echo $OUTPUT->footer();
die();
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('localplugins'));
/// Print the table of all installed local plugins
$table = new flexible_table('localplugins_administration_table');
$table->define_columns(array('name', 'version', 'uninstall'));
$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('uninstallplugin', 'core_admin')));
$table->define_columns(array('name', 'version', 'delete'));
$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
$table->define_baseurl($PAGE->url);
$table->set_attribute('id', 'localplugins');
$table->set_attribute('class', 'admintable generaltable');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
$plugins = array();
foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
foreach (get_plugin_list('local') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $plugin)) {
$strpluginname = get_string('pluginname', 'local_' . $plugin);
} else {
@@ -55,13 +89,11 @@ foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
}
$plugins[$plugin] = $strpluginname;
}
core_collator::asort($plugins);
collatorlib::asort($plugins);
foreach ($plugins as $plugin => $name) {
$uninstall = '';
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('local_'.$plugin, 'manage')) {
$uninstall = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'));
}
$delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
$delete = html_writer::link($delete, get_string('delete'));
$version = get_config('local_' . $plugin);
if (!empty($version->version)) {
@@ -70,7 +102,7 @@ foreach ($plugins as $plugin => $name) {
$version = '?';
}
$table->add_data(array($name, $version, $uninstall));
$table->add_data(array($name, $version, $delete));
}
$table->print_html();
-96
View File
@@ -1,96 +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/>.
/**
* This file is used to display a categories sub categories, external pages, and settings.
*
* @package admin
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once("{$CFG->libdir}/adminlib.php");
$contextid = required_param('id', PARAM_INT);
$confirm = optional_param('confirm', null, PARAM_INT);
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
$PAGE->set_url('/admin/lock.php', ['id' => $contextid]);
list($context, $course, $cm) = get_context_info_array($contextid);
$parentcontext = $context->get_parent_context();
if ($parentcontext && !empty($parentcontext->locked)) {
// Can't make changes to a context whose parent is locked.
throw new \coding_exception('Not sure how you got here');
}
if ($course) {
$isfrontpage = ($course->id == SITEID);
} else {
$isfrontpage = false;
$course = $SITE;
}
require_login($course, false, $cm);
require_capability('moodle/site:managecontextlocks', $context);
$PAGE->set_pagelayout('admin');
$PAGE->navigation->clear_cache();
$a = (object) [
'contextname' => $context->get_context_name(),
];
if (null !== $confirm && confirm_sesskey()) {
$context->set_locked(!empty($confirm));
if ($context->locked) {
$lockmessage = get_string('managecontextlocklocked', 'admin', $a);
} else {
$lockmessage = get_string('managecontextlockunlocked', 'admin', $a);
}
if (empty($returnurl)) {
$returnurl = $context->get_url();
} else {
$returnurl = new moodle_url($returnurl);
}
redirect($returnurl, $lockmessage);
}
$heading = get_string('managecontextlock', 'admin');
$PAGE->set_title($heading);
$PAGE->set_heading($heading);
echo $OUTPUT->header();
if ($context->locked) {
$confirmstring = get_string('confirmcontextunlock', 'admin', $a);
$target = 0;
} else {
$confirmstring = get_string('confirmcontextlock', 'admin', $a);
$target = 1;
}
$confirmurl = new \moodle_url($PAGE->url, ['confirm' => $target]);
if (!empty($returnurl)) {
$confirmurl->param('returnurl', $returnurl);
}
echo $OUTPUT->confirm($confirmstring, $confirmurl, $context->get_url());
echo $OUTPUT->footer();
+1 -1
View File
@@ -29,7 +29,7 @@
*/
// Security check.
if (!file_exists(__DIR__.'/mailout-debugger.enable')) {
if (!file_exists(dirname(__FILE__).'/mailout-debugger.enable')) {
mdie("Disabled.");
}
$tmpdir=sys_get_temp_dir(); // default
-78
View File
@@ -1,78 +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/>.
/**
* Enrol config manipulation script.
*
* @package core
* @subpackage media
* @copyright 2016 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$media = required_param('media', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/media.php');
$PAGE->set_context(context_system::instance());
require_admin();
require_sesskey();
$plugins = core_plugin_manager::instance()->get_plugins_of_type('media');
$sortorder = array_values(\core\plugininfo\media::get_enabled_plugins());
$return = new moodle_url('/admin/settings.php', array('section' => 'managemediaplayers'));
if (!array_key_exists($media, $plugins)) {
redirect($return);
}
switch ($action) {
case 'disable':
$plugins[$media]->set_enabled(false);
break;
case 'enable':
$plugins[$media]->set_enabled(true);
break;
case 'up':
if (($pos = array_search($media, $sortorder)) > 0) {
$tmp = $sortorder[$pos - 1];
$sortorder[$pos - 1] = $sortorder[$pos];
$sortorder[$pos] = $tmp;
\core\plugininfo\media::set_enabled_plugins($sortorder);
}
break;
case 'down':
if ((($pos = array_search($media, $sortorder)) !== false) && ($pos < count($sortorder) - 1)) {
$tmp = $sortorder[$pos + 1];
$sortorder[$pos + 1] = $sortorder[$pos];
$sortorder[$pos] = $tmp;
\core\plugininfo\media::set_enabled_plugins($sortorder);
}
break;
}
redirect($return);
+52 -99
View File
@@ -21,125 +21,78 @@
* @copyright 2011 Lancaster University Network Services Limited
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->dirroot . '/message/lib.php');
require_once($CFG->libdir.'/adminlib.php');
// This is an admin page.
// This is an admin page
admin_externalpage_setup('managemessageoutputs');
// Fetch processors.
$allprocessors = get_message_processors();
$processors = array_filter($allprocessors, function($processor) {
return $processor->enabled;
});
$disabledprocessors = array_filter($allprocessors, function($processor) {
return !$processor->enabled;
});
// Require site configuration capability
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
// Fetch message providers.
$providers = get_message_providers();
// Fetch the manage message outputs interface.
$preferences = get_message_output_default_preferences();
// Get the submitted params
$disable = optional_param('disable', 0, PARAM_INT);
$enable = optional_param('enable', 0, PARAM_INT);
$uninstall = optional_param('uninstall', 0, PARAM_INT);
$confirm = optional_param('confirm', false, PARAM_BOOL);
if (($form = data_submitted()) && confirm_sesskey()) {
$newpreferences = array();
// Prepare default message outputs settings.
foreach ($providers as $provider) {
$componentproviderbase = $provider->component.'_'.$provider->name;
$disableprovidersetting = $componentproviderbase.'_disable';
$providerdisabled = false;
if (!isset($form->$disableprovidersetting)) {
$providerdisabled = true;
$newpreferences[$disableprovidersetting] = 1;
} else {
$newpreferences[$disableprovidersetting] = 0;
}
$headingtitle = get_string('managemessageoutputs', 'message');
foreach (array('permitted', 'loggedin', 'loggedoff') as $setting) {
$value = null;
$componentprovidersetting = $componentproviderbase.'_'.$setting;
if ($setting == 'permitted') {
// If we deal with permitted select element, we need to create individual
// setting for each possible processor. Note that this block will
// always be processed first after entring parental foreach iteration
// so we can change form values on this stage.
foreach ($processors as $processor) {
$value = '';
if (isset($form->{$componentprovidersetting}[$processor->name])) {
$value = $form->{$componentprovidersetting}[$processor->name];
}
// Ensure that loggedin loggedoff options are set correctly for this permission.
if (($value == 'disallowed') || $providerdisabled) {
// It might be better to unset them, but I can't figure out why that cause error.
$form->{$componentproviderbase.'_loggedin'}[$processor->name] = 0;
$form->{$componentproviderbase.'_loggedoff'}[$processor->name] = 0;
} else if ($value == 'forced') {
$form->{$componentproviderbase.'_loggedin'}[$processor->name] = 1;
$form->{$componentproviderbase.'_loggedoff'}[$processor->name] = 1;
}
// Record the site preference.
$newpreferences[$processor->name.'_provider_'.$componentprovidersetting] = $value;
}
} else {
$newsettings = array();
if (property_exists($form, $componentprovidersetting)) {
// We must be processing loggedin or loggedoff checkboxes.
// Store defained comma-separated processors as setting value.
// Using array_filter eliminates elements set to 0 above.
$newsettings = array_keys(array_filter($form->{$componentprovidersetting}));
}
if (!empty($disable) && confirm_sesskey()) {
if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) {
print_error('outputdoesnotexist', 'message');
}
$DB->set_field('message_processors', 'enabled', '0', array('id'=>$processor->id)); // Disable output
}
// Let's join existing setting values for disabled processors.
$property = 'message_provider_'.$componentprovidersetting;
if (property_exists($preferences, $property)) {
$existingsetting = $preferences->$property;
foreach ($disabledprocessors as $disable) {
if (strpos($existingsetting, $disable->name) > -1) {
$newsettings[] = $disable->name;
}
}
}
if (!empty($enable) && confirm_sesskey()) {
if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) {
print_error('outputdoesnotexist', 'message');
}
$DB->set_field('message_processors', 'enabled', '1', array('id'=>$processor->id)); // Enable output
}
$value = join(',', $newsettings);
if (empty($value)) {
$value = null;
}
}
if ($setting != 'permitted') {
// We have already recoded site preferences for 'permitted' type.
$newpreferences['message_provider_'.$componentprovidersetting] = $value;
}
}
if (!empty($uninstall) && confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($headingtitle);
if (!$processor = $DB->get_record('message_processors', array('id'=>$uninstall))) {
print_error('outputdoesnotexist', 'message');
}
// Update database.
$transaction = $DB->start_delegated_transaction();
$processorname = get_string('pluginname', 'message_'.$processor->name);
// Save processors enabled/disabled status.
foreach ($allprocessors as $processor) {
$enabled = isset($form->{$processor->name});
\core_message\api::update_processor_status($processor, $enabled);
if (!$confirm) {
echo $OUTPUT->confirm(get_string('processordeleteconfirm', 'message', $processorname), 'message.php?uninstall='.$processor->id.'&confirm=1', 'message.php');
echo $OUTPUT->footer();
exit;
} else {
message_processor_uninstall($processor->name);
$a = new stdClass();
$a->processor = $processorname;
$a->directory = $CFG->dirroot.'/message/output/'.$processor->name;
notice(get_string('processordeletefiles', 'message', $a), 'message.php');
}
}
foreach ($newpreferences as $name => $value) {
set_config($name, $value, 'message');
}
$transaction->allow_commit();
core_plugin_manager::reset_caches();
if ($disable || $enable || $uninstall) {
$url = new moodle_url('message.php');
redirect($url);
}
// Page settings
$PAGE->set_context(context_system::instance());
$PAGE->requires->js_init_call('M.core_message.init_defaultoutputs');
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
// Grab the renderer
$renderer = $PAGE->get_renderer('core', 'message');
// Display the page.
// Display the manage message outputs interface
$processors = get_message_processors();
$messageoutputs = $renderer->manage_messageoutputs($processors);
// Display the page
echo $OUTPUT->header();
echo $renderer->manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences);
echo $OUTPUT->footer();
echo $OUTPUT->heading($headingtitle);
echo $messageoutputs;
echo $OUTPUT->footer();
+11 -11
View File
@@ -2,7 +2,7 @@
// Allows the admin to control user logins from remote moodles.
require_once(__DIR__ . '/../../config.php');
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
@@ -12,13 +12,17 @@ $page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT);
$action = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
require_login();
admin_externalpage_setup('ssoaccesscontrol');
echo $OUTPUT->header();
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet');
}
$sitecontext = context_system::instance();
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$sesskey = sesskey();
$formerror = array();
@@ -61,11 +65,9 @@ if (!empty($action) and confirm_sesskey()) {
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
if ($accessctrl == 'allow') {
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array('user' => $idrec->username,
'host' => $mnethosts[$idrec->mnet_host_id])));
} else if ($accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array('user' => $idrec->username,
'host' => $mnethosts[$idrec->mnet_host_id])));
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array('uset'=>$idrec->username, 'host'=>$mnethosts[$idrec->mnet_host_id])));
} elseif ($accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array('user'=>$idrec->username, 'host'=>$mnethosts[$idrec->mnet_host_id])));
}
}
break;
@@ -101,7 +103,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
$usernames = explode(',', $form->username);
foreach ($usernames as $username) {
$username = trim(core_text::strtolower($username));
$username = trim(textlib::strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
@@ -116,8 +118,6 @@ if ($form = data_submitted() and confirm_sesskey()) {
exit;
}
echo $OUTPUT->header();
// Explain
echo $OUTPUT->box(get_string('ssoacldescr','mnet'));
// Are the needed bits enabled?
@@ -148,7 +148,7 @@ foreach ($columns as $column) {
} else {
$columndir = $dir == "ASC" ? "DESC" : "ASC";
$columnicon = $dir == "ASC" ? "down" : "up";
$columnicon = " " . $OUTPUT->pix_icon('t/' . $columnicon, get_string('sort'));
$columnicon = " <img src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
}
$headings[$column] = "<a href=\"?sort=$column&amp;dir=$columndir&amp;\">".$string[$column]."</a>$columnicon";
}
+6 -1
View File
@@ -27,13 +27,18 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir . '/adminlib.php');
$step = optional_param('step', 'verify', PARAM_ALPHA);
$hostid = required_param('hostid', PARAM_INT);
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$mnet = get_mnet_environment();
$PAGE->set_url('/admin/mnet/delete.php');
+7 -5
View File
@@ -1,15 +1,17 @@
<?php
<?PHP
// Allows the admin to configure mnet stuff
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('net');
$context = context_system::instance();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$site = get_site();
$mnet = get_mnet_environment();
@@ -83,7 +85,7 @@
echo $OUTPUT->header();
?>
<form method="post" action="index.php">
<table align="center" width="635" class="generaltable" border="0" cellpadding="5" cellspacing="0">
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
@@ -104,7 +106,7 @@
</table>
</form>
<form method="post" action="index.php">
<table align="center" width="635" class="generaltable" border="0" cellpadding="5" cellspacing="0">
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
+2 -17
View File
@@ -60,8 +60,7 @@ class mnet_simple_host_form extends moodleform {
}
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
global $CFG;
return array('wwwroot' => get_string('hostexists', 'mnet',
new moodle_url('/admin/mnet/peers.php', array('hostid' => $host->id))));
return array('wwwroot' => get_string('hostexists', 'mnet', $CFG->wwwroot . '/admin/mnet/peers.php?hostid=' . $host->id));
}
return array();
}
@@ -79,13 +78,9 @@ class mnet_review_host_form extends moodleform {
$mnet_peer = $this->_customdata['peer'];
$mform->addElement('hidden', 'last_connect_time');
$mform->setType('last_connect_time', PARAM_INT);
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'applicationid');
$mform->setType('applicationid', PARAM_INT);
$mform->addElement('hidden', 'oldpublickey');
$mform->setType('oldpublickey', PARAM_PEM);
$mform->addElement('text', 'name', get_string('site'), array('maxlength' => 80, 'size' => 50));
$mform->setType('name', PARAM_NOTAGS);
@@ -95,17 +90,8 @@ class mnet_review_host_form extends moodleform {
$mform->setType('wwwroot', PARAM_URL);
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$options = array(
mnet_peer::SSL_NONE => get_string('none'),
mnet_peer::SSL_HOST => get_string('verifyhostonly', 'core_mnet'),
mnet_peer::SSL_HOST_AND_PEER => get_string('verifyhostandpeer', 'core_mnet')
);
$mform->addElement('select', 'sslverification', get_string('sslverification', 'core_mnet'), $options);
$mform->setDefault('sslverification', mnet_peer::SSL_HOST_AND_PEER);
$mform->addHelpButton('sslverification', 'sslverification', 'core_mnet');
$themes = array('' => get_string('forceno'));
foreach (array_keys(core_component::get_plugin_list('theme')) as $themename) {
foreach (array_keys(get_plugin_list('theme')) as $themename) {
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
@@ -162,7 +148,6 @@ class mnet_review_host_form extends moodleform {
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
} else {
$mform->addElement('hidden', 'deleted');
$mform->setType('deleted', PARAM_BOOL);
}
// finished with static stuff, print save button
+7 -4
View File
@@ -27,11 +27,15 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mnet/lib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/mnet/peer_forms.php');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
/// Initialize variables.
$hostid = optional_param('hostid', 0, PARAM_INT);
@@ -105,7 +109,7 @@ if (!empty($hostid)) {
$mnet_peer->set_id($hostid);
echo $OUTPUT->header();
$currenttab = 'mnetdetails';
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
if ($hostid != $CFG->mnet_all_hosts_id) {
$mnet_peer->currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
@@ -140,7 +144,7 @@ if (empty($noreviewform) && $id = optional_param('id', 0, PARAM_INT)) {
// we're editing an existing one, so set up the tabs
$currenttab = 'mnetdetails';
$mnet_peer->set_id($id);
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
} else if (empty($noreviewform) && ($wwwroot = optional_param('wwwroot', '', PARAM_URL)) && ($applicationid = optional_param('applicationid', 0, PARAM_INT))) {
$application = $DB->get_field('mnet_application', 'name', array('id'=>$applicationid));
$mnet_peer->bootstrap($wwwroot, null, $application);
@@ -168,7 +172,6 @@ if ($formdata = $reviewform->get_data()) {
$mnet_peer->public_key = $formdata->public_key;
$credentials = $mnet_peer->check_credentials($mnet_peer->public_key);
$mnet_peer->public_key_expires = $credentials['validTo_time_t'];
$mnet_peer->sslverification = $formdata->sslverification;
if ($mnet_peer->commit()) {
redirect(new moodle_url('/admin/mnet/peers.php', array('hostid' => $mnet_peer->id)), get_string('changessaved'));
+6 -2
View File
@@ -24,15 +24,19 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin .'/mnet/profilefields_form.php');
require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
$mnet = get_mnet_environment();
require_login();
$hostid = required_param('hostid', PARAM_INT);
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
admin_externalpage_setup('mnetpeers');
$form = new mnet_profile_form(null, array('hostid' => $hostid));
-2
View File
@@ -50,8 +50,6 @@ class mnet_profile_form extends moodleform {
}
$mform->addElement('hidden', 'hostid', $this->_customdata['hostid']);
$mform->setType('hostid', PARAM_INT);
$fields = mnet_profile_field_options();
// Fields to import ----------------------------------------------------
+6 -3
View File
@@ -25,13 +25,16 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/services_form.php');
require_once($CFG->dirroot . '/admin/mnet/services_form.php');
$mnet = get_mnet_environment();
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$hostid = required_param('hostid', PARAM_INT);
@@ -79,7 +82,7 @@ if ($formdata = $mform->get_data()) {
echo $OUTPUT->header();
$currenttab = 'mnetservices';
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
echo $OUTPUT->box_start();
$s = mnet_get_service_info($mnet_peer, false); // basic data only
$mform->set_data($s);
-3
View File
@@ -39,7 +39,6 @@ class mnet_services_form extends moodleform {
$myservices = mnet_get_service_info($mnet_peer);
$mform->addElement('hidden', 'hostid', $mnet_peer->id);
$mform->setType('hostid', PARAM_INT);
$count = 0;
foreach ($myservices as $name => $versions) {
@@ -56,8 +55,6 @@ class mnet_services_form extends moodleform {
$mform->addElement('html', '<h3>' . get_string($name.'_name', $langmodule , $mnet_peer->name) . '</h3>' . get_string($name.'_description', $langmodule, $mnet_peer->name));
$mform->addElement('hidden', 'exists[' . $version['serviceid'] . ']', 1);
// Temporary fix until MDL-38885 gets integrated.
$mform->setType('exists', PARAM_BOOL);
$pubstr = get_string('publish','mnet');
if (!empty($version['hostsubscribes'])) {
+9
View File
@@ -34,12 +34,21 @@ if (!defined('MOODLE_INTERNAL')) {
}
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$logurl = $CFG->wwwroot.
'/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs = array();
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'services.php?hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
if ($mnet_peer->application->name == 'moodle' && $mnet_peer->id != $CFG->mnet_all_hosts_id) {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
$tabs[] = new tabobject('mnetprofilefields', 'profilefields.php?hostid=' . $mnet_peer->id, get_string('profilefields', 'mnet'), get_string('profilefields', 'mnet'), false);
} else {
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
+5 -20
View File
@@ -12,7 +12,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mnet
*/
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
@@ -21,8 +21,12 @@ if ($CFG->mnet_dispatcher_mode === 'off') {
print_error('mnetdisabled', 'mnet');
}
require_login();
admin_externalpage_setup('mnettestclient');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
error_reporting(DEBUG_ALL);
echo $OUTPUT->header();
@@ -62,19 +66,12 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
$mnet_request->set_method('system/listServices');
$mnet_request->send($mnet_peer);
$services = $mnet_request->response;
$yesno = array('No', 'Yes');
$servicenames = array();
echo $OUTPUT->heading(get_string('servicesavailableonhost', 'mnet', $host->wwwroot));
if (!empty($mnet_request->error)) {
echo $OUTPUT->heading(get_string('error'), 3);
echo html_writer::alist($mnet_request->error);
$services = array();
}
$table = new html_table();
$table->head = array(
get_string('serviceid', 'mnet'),
@@ -130,7 +127,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
echo html_writer::table($table);
$mnet_request = new mnet_xmlrpc_client();
$mnet_request->set_method('system/listMethods');
if (isset($servicename) && array_key_exists($servicename, $serviceinfo)) {
echo $OUTPUT->heading(get_string('methodsavailableonhostinservice', 'mnet', (object)array('host' => $host->wwwroot, 'service' => $servicename)));
@@ -143,11 +139,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
$mnet_request->send($mnet_peer);
$methods = $mnet_request->response;
if (!empty($mnet_request->error)) {
echo $OUTPUT->heading(get_string('error'), 3);
echo html_writer::alist($mnet_request->error);
$methods = array();
}
$table = new html_table();
$table->head = array(
@@ -180,12 +171,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
echo $OUTPUT->heading(get_string('methodsignature', 'mnet', $method));
if (!empty($mnet_request->error)) {
echo $OUTPUT->heading(get_string('error'), 3);
echo html_writer::alist($mnet_request->error);
$signature = array();
}
$table = new html_table();
$table->head = array(
get_string('position', 'mnet'),
+5 -1
View File
@@ -1,12 +1,16 @@
<?php
// Allows the admin to configure services for remote hosts
require(__DIR__.'/../../config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('trustedhosts');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
echo $OUTPUT->header();
+67 -42
View File
@@ -13,12 +13,14 @@
$show = optional_param('show', '', PARAM_PLUGIN);
$hide = optional_param('hide', '', PARAM_PLUGIN);
$delete = optional_param('delete', '', PARAM_PLUGIN);
$confirm = optional_param('confirm', '', PARAM_BOOL);
/// Print headings
$stractivities = get_string("activities");
$struninstall = get_string('uninstallplugin', 'core_admin');
$strdelete = get_string("delete");
$strversion = get_string("version");
$strhide = get_string("hide");
$strshow = get_string("show");
@@ -40,16 +42,15 @@
SET visibleold=visible, visible=0
WHERE module=?";
$DB->execute($sql, array($module->id));
// Increment course.cacherev for courses where we just made something invisible.
// This will force cache rebuilding on the next request.
increment_revision_number('course', 'cacherev',
"id IN (SELECT DISTINCT course
// clear the course modinfo cache for courses
// where we just deleted something
$sql = "UPDATE {course}
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {course_modules}
WHERE visibleold=1 AND module=?)",
array($module->id));
core_plugin_manager::reset_caches();
WHERE visibleold=1 AND module=?)";
$DB->execute($sql, array($module->id));
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
if (!empty($show) and confirm_sesskey()) {
@@ -58,16 +59,47 @@
}
$DB->set_field("modules", "visible", "1", array("id"=>$module->id)); // Show main module
$DB->set_field('course_modules', 'visible', '1', array('visibleold'=>1, 'module'=>$module->id)); // Get the previous saved visible state for the course module.
// Increment course.cacherev for courses where we just made something visible.
// This will force cache rebuilding on the next request.
increment_revision_number('course', 'cacherev',
"id IN (SELECT DISTINCT course
// clear the course modinfo cache for courses
// where we just made something visible
$sql = "UPDATE {course}
SET modinfo = ''
WHERE id IN (SELECT DISTINCT course
FROM {course_modules}
WHERE visible=1 AND module=?)",
array($module->id));
core_plugin_manager::reset_caches();
WHERE visible=1 AND module=?)";
$DB->execute($sql, array($module->id));
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
if (!empty($delete) and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($stractivities);
if (get_string_manager()->string_exists('modulename', $delete)) {
$strmodulename = get_string('modulename', $delete);
} else {
$strmodulename = $delete;
}
if (!$confirm) {
echo $OUTPUT->confirm(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1", "modules.php");
echo $OUTPUT->footer();
exit;
} else { // Delete everything!!
if ($delete == "forum") {
print_error("cannotdeleteforummodule", 'forum');
}
uninstall_plugin('mod', $delete);
$a = new stdClass();
$a->module = $strmodulename;
$a->directory = "$CFG->dirroot/mod/$delete";
echo $OUTPUT->notification(get_string("moduledeletefiles", "", $a), 'notifysuccess');
echo $OUTPUT->continue_button("modules.php");
echo $OUTPUT->footer();
exit;
}
}
echo $OUTPUT->header();
@@ -82,33 +114,26 @@
/// Print the table of all modules
// construct the flexible table ready to display
$table = new flexible_table(MODULE_TABLE);
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'uninstall', 'settings'));
$table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strsettings, $struninstall));
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
$table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
$table->set_attribute('id', 'modules');
$table->set_attribute('class', 'admintable generaltable');
$table->set_attribute('class', 'generaltable');
$table->setup();
$pluginmanager = core_plugin_manager::instance();
foreach ($modules as $module) {
$plugininfo = $pluginmanager->get_plugin_info('mod_'.$module->name);
$status = $plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) {
$strmodulename = '<span class="notifyproblem">'.$module->name.' ('.get_string('missingfromdisk').')</span>';
$missing = true;
} else {
// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"" . $OUTPUT->image_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
$icon = "<img src=\"" . $OUTPUT->pix_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
$strmodulename = $icon.' '.get_string('modulename', $module->name);
$missing = false;
}
$uninstall = '';
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('mod_'.$module->name, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
}
$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=".sesskey()."\">$strdelete</a>";
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php") ||
file_exists("$CFG->dirroot/mod/$module->name/settingstree.php")) {
@@ -123,8 +148,8 @@
$count = -1;
}
if ($count>0) {
$countlink = $OUTPUT->action_link(new moodle_url('/course/search.php', ['modulelist' => $module->name]),
$count, null, ['title' => $strshowmodulecourse]);
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
} else if ($count < 0) {
$countlink = get_string('error');
} else {
@@ -136,28 +161,28 @@
$class = '';
} else if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=".sesskey()."\" title=\"$strhide\">".
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
"<img src=\"" . $OUTPUT->pix_url('i/hide') . "\" class=\"icon\" alt=\"$strhide\" /></a>";
$class = '';
} else {
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=".sesskey()."\" title=\"$strshow\">".
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
$class = 'dimmed_text';
"<img src=\"" . $OUTPUT->pix_url('i/show') . "\" class=\"icon\" alt=\"$strshow\" /></a>";
$class = ' class="dimmed_text"';
}
if ($module->name == "forum") {
$uninstall = "";
$delete = "";
$visible = "";
$class = "";
}
$version = get_config('mod_'.$module->name, 'version');
$table->add_data(array(
$strmodulename,
'<span'.$class.'>'.$strmodulename.'</span>',
$countlink,
$version,
'<span'.$class.'>'.$module->version.'</span>',
$visible,
$settings,
$uninstall,
), $class);
$delete,
$settings
));
}
$table->print_html();
+166
View File
@@ -0,0 +1,166 @@
<?php
if (!isset($CFG)) {
require('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('oacleanup');
echo $OUTPUT->header();
online_assignment_cleanup(true);
echo $OUTPUT->footer();
}
function online_assignment_cleanup($output=false) {
global $CFG, $DB, $OUTPUT;
if ($output) {
echo $OUTPUT->heading('Online Assignment Cleanup');
echo '<center>';
}
/// We don't want to run this code if we are doing an upgrade from an assignment
/// version earlier than 2005041400
/// because the assignment type field will not exist
$amv = $DB->get_field('modules', 'version', array('name'=>'assignment'));
if ((int)$amv < 2005041400) {
if ($output) {
echo '</center>';
}
return;
}
/// get the module id for assignments from db
$arecord = $DB->get_record('modules', array('name', 'assignment'));
$aid = $arecord->id;
/// get a list of all courses on this site
list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT c.* $ctxselect FROM {course} c $ctxjoin";
$courses = $DB->get_records_sql($sql);
/// cycle through each course
foreach ($courses as $course) {
context_instance_preload($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (empty($course->fullname)) {
$fullname = get_string('course').': '.$course->id;
} else {
$fullname = format_string($course->fullname, true, array('context' => $context));
}
if ($output) echo $OUTPUT->heading($fullname);
/// retrieve a list of sections beyond what is currently being shown
$sql = "SELECT *
FROM {course_sections}
WHERE course=? AND section>?
ORDER BY section ASC";
$params = array($course->id, $course->numsections);
if (!($xsections = $DB->get_records_sql($sql, $params))) {
if ($output) echo 'No extra sections<br />';
continue;
}
/// cycle through each of the xtra sections
foreach ($xsections as $xsection) {
if ($output) echo 'Checking Section: '.$xsection->section.'<br />';
/// grab any module instances from the sequence field
if (!empty($xsection->sequence)) {
$instances = explode(',', $xsection->sequence);
/// cycle through the instances
foreach ($instances as $instance) {
/// is this an instance of an online assignment
$sql = "SELECT a.id
FROM {course_modules} cm, {assignment} a
WHERE cm.id = ? AND cm.module = ? AND
cm.instance = a.id AND a.assignmenttype = 'online'";
$params = array($instance, $aid);
/// if record exists then we need to move instance to it's correct section
if ($DB->record_exists_sql($sql, $params)) {
/// check the new section id
/// the journal update erroneously stored it in course_sections->section
$newsection = $xsection->section;
/// double check the new section
if ($newsection > $course->numsections) {
/// get the record for section 0 for this course
if (!($zerosection = $DB->get_record('course_sections', array('course'=>$course->id, 'section'=>'0')))) {
continue;
}
$newsection = $zerosection->id;
}
/// grab the section record
if (!($section = $DB->get_record('course_sections', array('id'=>$newsection)))) {
if ($output) {
echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. $fullname .'<br />';
}
continue;
}
/// explode the sequence
if (($sequence = explode(',', $section->sequence)) === false) {
$sequence = array();
}
/// add instance to correct section
array_push($sequence, $instance);
/// implode the sequence
$section->sequence = implode(',', $sequence);
$DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
/// now we need to remove the instance from the old sequence
/// grab the old section record
if (!($section = $DB->get_record('course_sections', array('id'=>$xsection->id)))) {
if ($output) echo 'Serious error: Cannot retrieve old section: '.$xsection->id.' for course: '.$fullname.'<br />';
continue;
}
/// explode the sequence
if (($sequence = explode(',', $section->sequence)) === false) {
$sequence = array();
}
/// remove the old value from the array
$key = array_search($instance, $sequence);
unset($sequence[$key]);
/// implode the sequence
$section->sequence = implode(',', $sequence);
$DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
if ($output) echo 'Online Assignment (instance '.$instance.') moved from section '.$section->id.': to section '.$newsection.'<br />';
}
}
}
/// if the summary and sequence are empty then remove this section
if (empty($xsection->summary) and empty($xsection->sequence)) {
$DB->delete_records('course_sections', array('id'=>$xsection->id));
if ($output) echo 'Deleting empty section '.$xsection->section.'<br />';
}
}
}
echo '</center>';
}
+1 -12
View File
@@ -28,18 +28,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
$error = optional_param('error', '', PARAM_RAW);
if ($error) {
$message = optional_param('error_description', '', PARAM_RAW);
if ($message) {
print_error($message);
} else {
print_error($error);
}
die();
}
require_once(dirname(dirname(__FILE__)).'/config.php');
// The authorization code generated by the authorization server.
$code = required_param('code', PARAM_RAW);
+2 -2
View File
@@ -8,10 +8,10 @@
echo $OUTPUT->header();
echo '<div class="phpinfo text-ltr">';
echo '<div class="phpinfo">';
ob_start();
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES);
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES);
$html = ob_get_contents();
ob_end_clean();
-86
View File
@@ -1,86 +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/>.
/**
* Provides an overview of installed plagiarism plugins
*
* Displays the list of found plagiarism plugins, their version (if found) and
* a link to uninstall the plagiarism plugin.
*
* @see http://docs.moodle.org/dev/Plagiarism_API
* @package admin
* @copyright 2012 Dan Marsden <dan@danmarsden.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('manageplagiarismplugins');
echo $OUTPUT->header();
// Print the table of all installed plagiarism plugins.
$txt = get_strings(array('settings', 'name', 'version'));
$txt->uninstall = get_string('uninstallplugin', 'core_admin');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
echo $OUTPUT->footer();
exit;
}
echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
echo $OUTPUT->box_start('generalbox authsui');
$table = new html_table();
$table->head = array($txt->name, $txt->version, $txt->uninstall, $txt->settings);
$table->colclasses = array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
$table->data = array();
$table->attributes['class'] = 'manageplagiarismtable generaltable';
// Iterate through auth plugins and add to the display table.
$authcount = count($plagiarismplugins);
foreach ($plagiarismplugins as $plugin => $dir) {
if (file_exists($dir.'/settings.php')) {
$displayname = "<span>".get_string($plugin, 'plagiarism_'.$plugin)."</span>";
// Settings link.
$url = new moodle_url("/plagiarism/$plugin/settings.php");
$settings = html_writer::link($url, $txt->settings);
// Get version.
$version = get_config('plagiarism_' . $plugin);
if (!empty($version->version)) {
$version = $version->version;
} else {
$version = '?';
}
// uninstall link.
$uninstall = '';
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $txt->uninstall);
}
$table->data[] = array($displayname, $version, $uninstall, $settings);
}
}
echo html_writer::table($table);
echo get_string('configplagiarismplugins', 'plagiarism');
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
+10 -179
View File
@@ -24,192 +24,23 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/pluginlib.php');
$fetchupdates = optional_param('fetchupdates', false, PARAM_BOOL); // Check for available plugins updates.
$updatesonly = optional_param('updatesonly', false, PARAM_BOOL); // Show updateable plugins only.
$contribonly = optional_param('contribonly', false, PARAM_BOOL); // Show additional plugins only.
$uninstall = optional_param('uninstall', '', PARAM_COMPONENT); // Uninstall the plugin.
$delete = optional_param('delete', '', PARAM_COMPONENT); // Delete the plugin folder after it is uninstalled.
$confirmed = optional_param('confirm', false, PARAM_BOOL); // Confirm the uninstall/delete action.
$return = optional_param('return', 'overview', PARAM_ALPHA); // Where to return after uninstall.
$installupdate = optional_param('installupdate', null, PARAM_COMPONENT); // Install given available update.
$installupdateversion = optional_param('installupdateversion', null, PARAM_INT); // Version of the available update to install.
$installupdatex = optional_param('installupdatex', false, PARAM_BOOL); // Install all available plugin updates.
$confirminstallupdate = optional_param('confirminstallupdate', false, PARAM_BOOL); // Available update(s) install confirmed?
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
admin_externalpage_setup('pluginsoverview');
// NOTE: do not use admin_externalpage_setup() here because it loads
// full admin tree which is not possible during uninstallation.
$fetchremote = optional_param('fetchremote', false, PARAM_BOOL);
require_admin();
$syscontext = context_system::instance();
$pluginman = plugin_manager::instance();
$checker = available_update_checker::instance();
// URL params we want to maintain on redirects.
$pageparams = array('updatesonly' => $updatesonly, 'contribonly' => $contribonly);
$pageurl = new moodle_url('/admin/plugins.php', $pageparams);
$pluginman = core_plugin_manager::instance();
if ($uninstall) {
if (!$confirmed) {
admin_externalpage_setup('pluginsoverview', '', $pageparams);
} else {
$PAGE->set_url($pageurl);
$PAGE->set_context($syscontext);
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
}
/** @var core_admin_renderer $output */
$output = $PAGE->get_renderer('core', 'admin');
$pluginfo = $pluginman->get_plugin_info($uninstall);
// Make sure we know the plugin.
if (is_null($pluginfo)) {
throw new moodle_exception('err_uninstalling_unknown_plugin', 'core_plugin', '', array('plugin' => $uninstall),
'core_plugin_manager::get_plugin_info() returned null for the plugin to be uninstalled');
}
$pluginname = $pluginman->plugin_name($pluginfo->component);
$PAGE->set_title($pluginname);
$PAGE->navbar->add(get_string('uninstalling', 'core_plugin', array('name' => $pluginname)));
if (!$pluginman->can_uninstall_plugin($pluginfo->component)) {
throw new moodle_exception('err_cannot_uninstall_plugin', 'core_plugin', '',
array('plugin' => $pluginfo->component),
'core_plugin_manager::can_uninstall_plugin() returned false');
}
if (!$confirmed) {
$continueurl = new moodle_url($PAGE->url, array('uninstall' => $pluginfo->component, 'sesskey' => sesskey(), 'confirm' => 1, 'return'=>$return));
$cancelurl = $pluginfo->get_return_url_after_uninstall($return);
echo $output->plugin_uninstall_confirm_page($pluginman, $pluginfo, $continueurl, $cancelurl);
exit();
} else {
require_sesskey();
$SESSION->pluginuninstallreturn = $pluginfo->get_return_url_after_uninstall($return);
$progress = new progress_trace_buffer(new text_progress_trace(), false);
$pluginman->uninstall_plugin($pluginfo->component, $progress);
$progress->finished();
if ($pluginman->is_plugin_folder_removable($pluginfo->component)) {
$continueurl = new moodle_url($PAGE->url, array('delete' => $pluginfo->component, 'sesskey' => sesskey(), 'confirm' => 1));
echo $output->plugin_uninstall_results_removable_page($pluginman, $pluginfo, $progress, $continueurl);
// Reset op code caches.
if (function_exists('opcache_reset')) {
opcache_reset();
}
exit();
} else {
echo $output->plugin_uninstall_results_page($pluginman, $pluginfo, $progress);
// Reset op code caches.
if (function_exists('opcache_reset')) {
opcache_reset();
}
exit();
}
}
}
if ($delete and $confirmed) {
require_sesskey();
$PAGE->set_url($pageurl);
$PAGE->set_context($syscontext);
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
/** @var core_admin_renderer $output */
$output = $PAGE->get_renderer('core', 'admin');
$pluginfo = $pluginman->get_plugin_info($delete);
// Make sure we know the plugin.
if (is_null($pluginfo)) {
throw new moodle_exception('err_removing_unknown_plugin', 'core_plugin', '', array('plugin' => $delete),
'core_plugin_manager::get_plugin_info() returned null for the plugin to be deleted');
}
$pluginname = $pluginman->plugin_name($pluginfo->component);
$PAGE->set_title($pluginname);
$PAGE->navbar->add(get_string('uninstalling', 'core_plugin', array('name' => $pluginname)));
// Make sure it is not installed.
if (!is_null($pluginfo->versiondb)) {
throw new moodle_exception('err_removing_installed_plugin', 'core_plugin', '',
array('plugin' => $pluginfo->component, 'versiondb' => $pluginfo->versiondb),
'core_plugin_manager::get_plugin_info() returned not-null versiondb for the plugin to be deleted');
}
// Make sure the folder is within Moodle installation tree.
if (strpos($pluginfo->rootdir, $CFG->dirroot) !== 0) {
throw new moodle_exception('err_unexpected_plugin_rootdir', 'core_plugin', '',
array('plugin' => $pluginfo->component, 'rootdir' => $pluginfo->rootdir, 'dirroot' => $CFG->dirroot),
'plugin root folder not in the moodle dirroot');
}
// So long, and thanks for all the bugs.
$pluginman->remove_plugin_folder($pluginfo);
// We need to execute upgrade to make sure everything including caches is up to date.
redirect(new moodle_url('/admin/index.php'));
}
// Install all avilable updates.
if ($installupdatex) {
require_once($CFG->libdir.'/upgradelib.php');
require_sesskey();
$PAGE->set_url($pageurl);
$PAGE->set_context($syscontext);
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
$installable = $pluginman->filter_installable($pluginman->available_updates());
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1))
);
}
// Install single available update.
if ($installupdate and $installupdateversion) {
require_once($CFG->libdir.'/upgradelib.php');
require_sesskey();
$PAGE->set_url($pageurl);
$PAGE->set_context($syscontext);
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) {
$installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true));
upgrade_install_plugins($installable, $confirminstallupdate,
get_string('updateavailableinstallallhead', 'core_admin'),
new moodle_url($PAGE->url, array('installupdate' => $installupdate,
'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1)
)
);
}
}
admin_externalpage_setup('pluginsoverview', '', $pageparams);
/** @var core_admin_renderer $output */
$output = $PAGE->get_renderer('core', 'admin');
$checker = \core\update\checker::instance();
if ($fetchupdates) {
if ($fetchremote) {
require_sesskey();
$checker->fetch();
redirect($PAGE->url);
}
echo $output->plugin_management_page($pluginman, $checker, $pageparams);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->plugin_management_page($pluginman, $checker);
+5 -5
View File
@@ -1,11 +1,11 @@
<?php
require_once(__DIR__ . '/../config.php');
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir . '/portfoliolib.php');
require_once($CFG->libdir . '/portfolio/forms.php');
require_once($CFG->libdir . '/adminlib.php');
$portfolio = optional_param('pf', '', PARAM_ALPHANUMEXT);
$portfolio = optional_param('pf', '', PARAM_FORMAT);
$action = optional_param('action', '', PARAM_ALPHA);
$sure = optional_param('sure', '', PARAM_ALPHA);
@@ -35,6 +35,8 @@ if ($action == 'newon') {
admin_externalpage_setup($pagename);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$baseurl = "$CFG->wwwroot/$CFG->admin/portfolio.php";
$sesskeyurl = "$CFG->wwwroot/$CFG->admin/portfolio.php?sesskey=" . sesskey();
$configstr = get_string('manageportfolios', 'portfolio');
@@ -86,7 +88,6 @@ if (($action == 'edit') || ($action == 'new')) {
} else {
portfolio_static_function($plugin, 'create_instance', $plugin, $fromform->name, $fromform);
}
core_plugin_manager::reset_caches();
$savedstr = get_string('instancesaved', 'portfolio');
redirect($baseurl, $savedstr, 1);
exit;
@@ -115,7 +116,6 @@ if (($action == 'edit') || ($action == 'new')) {
$instance->set('visible', $visible);
$instance->save();
core_plugin_manager::reset_caches();
$return = true;
} else if ($action == 'delete') {
$instance = portfolio_instance($portfolio);
@@ -160,7 +160,7 @@ if (($action == 'edit') || ($action == 'new')) {
$output = $OUTPUT->box_start('generalbox');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = array();
+1 -1
View File
@@ -3,7 +3,7 @@
//error_reporting(0);
//ini_set('display_errors',0);
require_once(__DIR__ . '/../config.php');
require_once(dirname(dirname(__FILE__)).'/config.php');
$tmp = explode('@',$_ENV['RECIPIENT']);
$address = $tmp[0];
+25 -31
View File
@@ -27,43 +27,37 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$returnurl = optional_param('returnurl', '/admin/purgecaches.php', PARAM_LOCALURL);
$returnurl = new moodle_url($returnurl);
admin_externalpage_setup('purgecaches');
$form = new core_admin\form\purge_caches(null, ['returnurl' => $returnurl]);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
// If we have got here as a confirmed aciton, do it.
if ($data = $form->get_data()) {
if ($confirm) {
require_sesskey();
// Valid request. Purge, and redirect the user back to where they came from.
$selected = $data->purgeselectedoptions;
purge_caches($selected);
// Valid request. Purge, and redisplay the form so it is easy to purge again
// in the near future.
purge_all_caches();
redirect(new moodle_url('/admin/purgecaches.php'), get_string('purgecachesfinished', 'admin'));
if (isset($data->all)) {
$message = get_string('purgecachesfinished', 'admin');
} else {
$message = get_string('purgeselectedcachesfinished', 'admin');
} else {
// Show a confirm form.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('purgecaches', 'admin'));
$url = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
$button = new single_button($url, get_string('purgecaches','admin'), 'post');
// Cancel button takes them back to the page the were on, if possible,
// otherwise to the site home page.
$return = new moodle_url('/');
if (isset($_SERVER['HTTP_REFERER']) and !empty($_SERVER['HTTP_REFERER'])) {
if ($_SERVER['HTTP_REFERER'] !== "$CFG->wwwroot/$CFG->admin/purgecaches.php") {
$return = $_SERVER['HTTP_REFERER'];
}
}
} else if ($confirm && confirm_sesskey()) {
purge_caches();
$message = get_string('purgecachesfinished', 'admin');
echo $OUTPUT->confirm(get_string('purgecachesconfirm', 'admin'), $button, $return);
echo $OUTPUT->footer();
}
if (isset($message)) {
redirect($returnurl, $message);
}
// Otherwise, show a form to actually purge the caches.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('purgecachespage', 'admin'));
echo $OUTPUT->box_start('generalbox', 'notice');
echo html_writer::tag('p', get_string('purgecachesconfirm', 'admin'));
echo $form->render();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
+80 -19
View File
@@ -25,21 +25,22 @@
*/
require_once(__DIR__ . '/../config.php');
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/pluginlib.php');
require_once($CFG->libdir . '/tablelib.php');
// Check permissions.
require_login(null, false);
$systemcontext = context_system::instance();
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/question:config', $systemcontext);
admin_externalpage_setup('manageqbehaviours');
$thispageurl = new moodle_url('/admin/qbehaviours.php');
$behaviours = core_component::get_plugin_list('qbehaviour');
$pluginmanager = core_plugin_manager::instance();
$behaviours = get_plugin_list('qbehaviour');
$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql_menu("
@@ -91,7 +92,6 @@ if (($disable = optional_param('disable', '', PARAM_PLUGIN)) && confirm_sesskey(
$disabledbehaviours[] = $disable;
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
}
core_plugin_manager::reset_caches();
redirect($thispageurl);
}
@@ -109,7 +109,6 @@ if (($enable = optional_param('enable', '', PARAM_PLUGIN)) && confirm_sesskey())
unset($disabledbehaviours[$key]);
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
}
core_plugin_manager::reset_caches();
redirect($thispageurl);
}
@@ -137,6 +136,70 @@ if (($down = optional_param('down', '', PARAM_PLUGIN)) && confirm_sesskey()) {
redirect($thispageurl);
}
// Delete.
if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) {
// Check it is OK to delete this question type.
if ($delete == 'missing') {
print_error('cannotdeletemissingbehaviour', 'question', $thispageurl);
}
if (!isset($behaviours[$delete])) {
print_error('unknownbehaviour', 'question', $thispageurl, $delete);
}
$behaviourname = $sortedbehaviours[$delete];
if ($counts[$delete] > 0) {
print_error('cannotdeletebehaviourinuse', 'question', $thispageurl, $behaviourname);
}
if ($needed[$delete] > 0) {
print_error('cannotdeleteneededbehaviour', 'question', $thispageurl, $behaviourname);
}
// If not yet confirmed, display a confirmation message.
if (!optional_param('confirm', '', PARAM_BOOL)) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletebehaviourareyousure', 'question', $behaviourname));
echo $OUTPUT->confirm(
get_string('deletebehaviourareyousuremessage', 'question', $behaviourname),
new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
$thispageurl);
echo $OUTPUT->footer();
exit;
}
// Do the deletion.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletingbehaviour', 'question', $behaviourname));
// Delete any configuration records.
if (!unset_all_config_for_plugin('qbehaviour_' . $delete)) {
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qbehaviour_' . $delete));
}
if (($key = array_search($delete, $disabledbehaviours)) !== false) {
unset($disabledbehaviours[$key]);
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
}
$behaviourorder = array_keys($sortedbehaviours);
if (($key = array_search($delete, $behaviourorder)) !== false) {
unset($behaviourorder[$key]);
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
}
// Then the tables themselves
drop_plugin_tables($delete, get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
// Remove event handlers and dequeue pending events
events_uninstall('qbehaviour_' . $delete);
$a = new stdClass();
$a->behaviour = $behaviourname;
$a->directory = get_plugin_directory('qbehaviour', $delete);
echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($thispageurl);
echo $OUTPUT->footer();
exit;
}
// End of process actions ==================================================
// Print the page heading.
@@ -147,12 +210,12 @@ echo $OUTPUT->heading(get_string('manageqbehaviours', 'admin'));
$table = new flexible_table('qbehaviouradmintable');
$table->define_baseurl($thispageurl);
$table->define_columns(array('behaviour', 'numqas', 'version', 'requires',
'available', 'uninstall'));
'available', 'delete'));
$table->define_headers(array(get_string('behaviour', 'question'), get_string('numqas', 'question'),
get_string('version'), get_string('requires', 'admin'),
get_string('availableq', 'question'), get_string('uninstallplugin', 'core_admin')));
get_string('availableq', 'question'), get_string('delete')));
$table->set_attribute('id', 'qbehaviours');
$table->set_attribute('class', 'generaltable admintable');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
// Add a row for each question type.
@@ -195,7 +258,7 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
$rowclass = 'dimmed_text';
}
} else {
$icons = $OUTPUT->spacer(array('class' => 'iconsmall'));
$icons = $OUTPUT->spacer() . ' ';
}
// Move icons.
@@ -207,11 +270,9 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
if ($needed[$behaviour]) {
$row[] = '';
} else {
$uninstallurl = core_plugin_manager::instance()->get_uninstall_url('qbehaviour_'.$behaviour, 'manage');
if ($uninstallurl) {
$row[] = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'),
$row[] = html_writer::link(new moodle_url($thispageurl,
array('delete' => $behaviour, 'sesskey' => sesskey())), get_string('delete'),
array('title' => get_string('uninstallbehaviour', 'question')));
}
}
$table->add_data($row, $rowclass);
@@ -223,10 +284,10 @@ echo $OUTPUT->footer();
function question_behaviour_enable_disable_icons($behaviour, $enabled) {
if ($enabled) {
return question_behaviour_icon_html('disable', $behaviour, 't/hide',
return question_behaviour_icon_html('disable', $behaviour, 'i/hide',
get_string('enabled', 'question'), get_string('disable'));
} else {
return question_behaviour_icon_html('enable', $behaviour, 't/show',
return question_behaviour_icon_html('enable', $behaviour, 'i/show',
get_string('disabled', 'question'), get_string('enable'));
}
}
@@ -235,7 +296,7 @@ function question_behaviour_icon_html($action, $behaviour, $icon, $alt, $tip) {
global $OUTPUT;
return $OUTPUT->action_icon(new moodle_url('/admin/qbehaviours.php',
array($action => $behaviour, 'sesskey' => sesskey())),
new pix_icon($icon, $alt, 'moodle', array('title' => '', 'class' => 'iconsmall')),
null, array('title' => $tip));
new pix_icon($icon, $alt, 'moodle', array('title' => '')),
null, array('title' => $tip)) . ' ';
}
+82 -24
View File
@@ -25,21 +25,23 @@
*/
require_once(__DIR__ . '/../config.php');
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/pluginlib.php');
require_once($CFG->libdir . '/tablelib.php');
admin_externalpage_setup('manageqtypes');
$systemcontext = context_system::instance();
// Check permissions.
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/question:config', $systemcontext);
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
admin_externalpage_setup('manageqtypes');
$thispageurl = new moodle_url('/admin/qtypes.php');
$qtypes = question_bank::get_all_qtypes();
$pluginmanager = core_plugin_manager::instance();
$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql("
@@ -120,6 +122,64 @@ if (($down = optional_param('down', '', PARAM_PLUGIN)) && confirm_sesskey()) {
redirect($thispageurl);
}
// Delete.
if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) {
// Check it is OK to delete this question type.
if ($delete == 'missingtype') {
print_error('cannotdeletemissingqtype', 'question', $thispageurl);
}
if (!isset($qtypes[$delete])) {
print_error('unknownquestiontype', 'question', $thispageurl, $delete);
}
$qtypename = $qtypes[$delete]->local_name();
if ($counts[$delete]->numquestions + $counts[$delete]->numhidden > 0) {
print_error('cannotdeleteqtypeinuse', 'question', $thispageurl, $qtypename);
}
if ($needed[$delete] > 0) {
print_error('cannotdeleteqtypeneeded', 'question', $thispageurl, $qtypename);
}
// If not yet confirmed, display a confirmation message.
if (!optional_param('confirm', '', PARAM_BOOL)) {
$qtypename = $qtypes[$delete]->local_name();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'question', $qtypename));
echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'question', $qtypename),
new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
$thispageurl);
echo $OUTPUT->footer();
exit;
}
// Do the deletion.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletingqtype', 'question', $qtypename));
// Delete any configuration records.
if (!unset_all_config_for_plugin('qtype_' . $delete)) {
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qtype_' . $delete));
}
unset_config($delete . '_disabled', 'question');
unset_config($delete . '_sortorder', 'question');
// Then the tables themselves
drop_plugin_tables($delete, $qtypes[$delete]->plugin_dir() . '/db/install.xml', false);
// Remove event handlers and dequeue pending events
events_uninstall('qtype_' . $delete);
$a = new stdClass();
$a->qtype = $qtypename;
$a->directory = $qtypes[$delete]->plugin_dir();
echo $OUTPUT->box(get_string('qtypedeletefiles', 'question', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($thispageurl);
echo $OUTPUT->footer();
exit;
}
// End of process actions ==================================================
// Print the page heading.
@@ -130,12 +190,12 @@ echo $OUTPUT->heading(get_string('manageqtypes', 'admin'));
$table = new flexible_table('qtypeadmintable');
$table->define_baseurl($thispageurl);
$table->define_columns(array('questiontype', 'numquestions', 'version', 'requires',
'availableto', 'uninstall', 'settings'));
'availableto', 'delete', 'settings'));
$table->define_headers(array(get_string('questiontype', 'question'), get_string('numquestions', 'question'),
get_string('version'), get_string('requires', 'admin'), get_string('availableq', 'question'),
get_string('settings'), get_string('uninstallplugin', 'core_admin')));
get_string('delete'), get_string('settings')));
$table->set_attribute('id', 'qtypes');
$table->set_attribute('class', 'admintable generaltable');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
// Add a row for each question type.
@@ -197,7 +257,7 @@ foreach ($sortedqtypes as $qtypename => $localname) {
$rowclass = 'dimmed_text';
}
} else {
$icons = $OUTPUT->spacer();
$icons = $OUTPUT->spacer() . ' ';
}
// Move icons.
@@ -205,6 +265,15 @@ foreach ($sortedqtypes as $qtypename => $localname) {
$icons .= question_type_icon_html('down', $qtypename, 't/down', get_string('down'), '');
$row[] = $icons;
// Delete link, if available.
if ($needed[$qtypename]) {
$row[] = '';
} else {
$row[] = html_writer::link(new moodle_url($thispageurl,
array('delete' => $qtypename, 'sesskey' => sesskey())), get_string('delete'),
array('title' => get_string('uninstallqtype', 'question')));
}
// Settings link, if available.
$settings = admin_get_root()->locate('qtypesetting' . $qtypename);
if ($settings instanceof admin_externalpage) {
@@ -216,17 +285,6 @@ foreach ($sortedqtypes as $qtypename => $localname) {
$row[] = '';
}
// Uninstall link, if available.
if ($needed[$qtypename]) {
$row[] = '';
} else {
$uninstallurl = core_plugin_manager::instance()->get_uninstall_url('qtype_'.$qtypename, 'manage');
if ($uninstallurl) {
$row[] = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'),
array('title' => get_string('uninstallqtype', 'question')));
}
}
$table->add_data($row, $rowclass);
}
@@ -236,10 +294,10 @@ echo $OUTPUT->footer();
function question_types_enable_disable_icons($qtypename, $createable) {
if ($createable) {
return question_type_icon_html('disable', $qtypename, 't/hide',
return question_type_icon_html('disable', $qtypename, 'i/hide',
get_string('enabled', 'question'), get_string('disable'));
} else {
return question_type_icon_html('enable', $qtypename, 't/show',
return question_type_icon_html('enable', $qtypename, 'i/show',
get_string('disabled', 'question'), get_string('enable'));
}
}
@@ -248,7 +306,7 @@ function question_type_icon_html($action, $qtypename, $icon, $alt, $tip) {
global $OUTPUT;
return $OUTPUT->action_icon(new moodle_url('/admin/qtypes.php',
array($action => $qtypename, 'sesskey' => sesskey())),
new pix_icon($icon, $alt, 'moodle', array('title' => '', 'class' => 'iconsmall')),
null, array('title' => $tip));
new pix_icon($icon, $alt, 'moodle', array('title' => '')),
null, array('title' => $tip)) . ' ';
}
+35 -27
View File
@@ -20,7 +20,7 @@
// //
///////////////////////////////////////////////////////////////////////////
/**
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
@@ -36,6 +36,7 @@
require('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
$newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
$url = optional_param('url', '', PARAM_URL);
@@ -43,19 +44,7 @@ $hubname = optional_param('hubname', '', PARAM_TEXT);
$token = optional_param('token', '', PARAM_TEXT);
$error = optional_param('error', '', PARAM_ALPHANUM);
admin_externalpage_setup('registrationmoodleorg');
if (parse_url($url, PHP_URL_HOST) !== parse_url(HUB_MOODLEORGHUBURL, PHP_URL_HOST)) {
// Allow other plugins to confirm registration on custom hubs. Plugins implementing this
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
$callbacks = get_plugins_with_function('hub_registration');
foreach ($callbacks as $plugintype => $plugins) {
foreach ($plugins as $plugin => $callback) {
$callback('confirm');
}
}
throw new moodle_exception('errorotherhubsnotsupported', 'hub');
}
admin_externalpage_setup('registrationhubs');
if (!empty($error) and $error == 'urlalreadyexist') {
throw new moodle_exception('urlalreadyregistered', 'hub',
@@ -63,22 +52,41 @@ if (!empty($error) and $error == 'urlalreadyexist') {
}
//check that we are waiting a confirmation from this hub, and check that the token is correct
core\hub\registration::confirm_registration($token, $newtoken, $hubname);
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
if (!empty($registeredhub) and $registeredhub->token == $token) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
$hublink = html_writer::tag('a', $hubname, array('href' => $url));
// Display notification message.
echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
$registeredhub->token = $newtoken;
$registeredhub->confirmed = 1;
$registeredhub->hubname = $hubname;
$registrationmanager->update_registeredhub($registeredhub);
// Display continue button.
$returnurl = !empty($SESSION->registrationredirect) ? clean_param($SESSION->registrationredirect, PARAM_LOCALURL) : null;
unset($SESSION->registrationredirect);
$continueurl = new moodle_url($returnurl ?: '/admin/registration/index.php');
$continuebutton = $OUTPUT->render(new single_button($continueurl, get_string('continue')));
$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
echo $continuebutton;
//display notficiation message
$notificationmessage = $OUTPUT->notification(
get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
echo $notificationmessage;
echo $OUTPUT->footer();
//display continue button
$registrationpage = new moodle_url('/admin/registration/index.php');
$continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
echo $continuebutton;
if (!extension_loaded('xmlrpc')) {
//display notice about xmlrpc
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
echo $OUTPUT->notification($xmlrpcnotification);
}
echo $OUTPUT->footer();
} else {
throw new moodle_exception('wrongtoken', 'hub',
$CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
}
+437 -3
View File
@@ -20,7 +20,7 @@
// //
///////////////////////////////////////////////////////////////////////////
/**
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
@@ -30,6 +30,440 @@
* The forms needed by registration pages.
*/
defined('MOODLE_INTERNAL') || die();
debugging('Support for alternative hubs has been removed from Moodle in 3.4.', DEBUG_DEVELOPER);
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
/**
* This form display a unregistration form.
*/
class site_unregistration_form extends moodleform {
public function definition() {
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$unregisterlabel = get_string('unregister', 'hub');
$mform->addElement('checkbox', 'unpublishalladvertisedcourses', '',
' ' . get_string('unpublishalladvertisedcourses', 'hub'));
$mform->addElement('checkbox', 'unpublishalluploadedcourses', '',
' ' . get_string('unpublishalluploadedcourses', 'hub'));
$mform->addElement('hidden', 'confirm', 1);
$mform->setType('confirm', PARAM_INT);
$mform->addElement('hidden', 'unregistration', 1);
$mform->setType('unregistration', PARAM_INT);
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$this->add_action_buttons(true, $unregisterlabel);
}
}
/**
* This form display a clean registration data form.
*/
class site_clean_registration_data_form extends moodleform {
public function definition() {
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$unregisterlabel = get_string('forceunregister', 'hub');
$mform->addElement('static', '', get_string('warning', 'hub'), get_string('forceunregisterconfirmation', 'hub', $hubname));
$mform->addElement('hidden', 'confirm', 1);
$mform->setType('confirm', PARAM_INT);
$mform->addElement('hidden', 'unregistration', 1);
$mform->setType('unregistration', PARAM_INT);
$mform->addElement('hidden', 'cleanregdata', 1);
$mform->setType('cleanregdata', PARAM_INT);
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$this->add_action_buttons(true, $unregisterlabel);
}
}
/**
* This form display a hub selector.
* The hub list is retrieved from Moodle.org hub directory.
* Also displayed, a text field to enter private hub url + its password
*/
class hub_selector_form extends moodleform {
public function definition() {
global $CFG, $OUTPUT;
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('selecthub', 'hub'));
//retrieve the hub list on the hub directory by web service
$function = 'hubdirectory_get_hubs';
$params = array();
$serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
try {
$hubs = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
$error = $OUTPUT->notification(get_string('errorhublisting', 'hub', $e->getMessage()));
$mform->addElement('static', 'errorhub', '', $error);
$hubs = array();
}
//remove moodle.org from the hub list
foreach ($hubs as $key => $hub) {
if ($hub['url'] == HUB_MOODLEORGHUBURL) {
unset($hubs[$key]);
}
}
//Public hub list
$options = array();
foreach ($hubs as $hub) {
//to not display a name longer than 100 character (too big)
if (textlib::strlen($hub['name']) > 100) {
$hubname = textlib::substr($hub['name'], 0, 100);
$hubname = $hubname . "...";
} else {
$hubname = $hub['name'];
}
$options[$hub['url']] = $hubname;
$mform->addElement('hidden', clean_param($hub['url'], PARAM_ALPHANUMEXT), $hubname);
$mform->setType(clean_param($hub['url'], PARAM_ALPHANUMEXT), PARAM_ALPHANUMEXT);
}
if (!empty($hubs)) {
$mform->addElement('select', 'publichub', get_string('publichub', 'hub'),
$options, array("size" => 15));
}
$mform->addElement('static', 'or', '', get_string('orenterprivatehub', 'hub'));
//Private hub
$mform->addElement('text', 'unlistedurl', get_string('privatehuburl', 'hub'),
array('class' => 'registration_textfield'));
$mform->addElement('text', 'password', get_string('password'),
array('class' => 'registration_textfield'));
$this->add_action_buttons(false, get_string('selecthub', 'hub'));
}
/**
* Check the unlisted URL is a URL
*/
function validation($data, $files) {
global $CFG;
$errors = parent::validation($data, $files);
$unlistedurl = $this->_form->_submitValues['unlistedurl'];
if (!empty($unlistedurl)) {
$unlistedurltotest = clean_param($unlistedurl, PARAM_URL);
if (empty($unlistedurltotest)) {
$errors['unlistedurl'] = get_string('badurlformat', 'hub');
}
}
return $errors;
}
}
/**
* The site registration form. Information will be sent to a given hub.
*/
class site_registration_form extends moodleform {
public function definition() {
global $CFG, $DB;
$strrequired = get_string('required');
$mform = & $this->_form;
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$password = $this->_customdata['password'];
$admin = get_admin();
$site = get_site();
//retrieve config for this hub and set default if they don't exist
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
$sitename = get_config('hub', 'site_name_' . $cleanhuburl);
if ($sitename === false) {
$sitename = format_string($site->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
}
$sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
if ($sitedescription === false) {
$sitedescription = $site->summary;
}
$contactname = get_config('hub', 'site_contactname_' . $cleanhuburl);
if ($contactname === false) {
$contactname = fullname($admin, true);
}
$contactemail = get_config('hub', 'site_contactemail_' . $cleanhuburl);
if ($contactemail === false) {
$contactemail = $admin->email;
}
$contactphone = get_config('hub', 'site_contactphone_' . $cleanhuburl);
if ($contactphone === false) {
$contactphone = $admin->phone1;
}
$imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl);
$privacy = get_config('hub', 'site_privacy_' . $cleanhuburl);
$address = get_config('hub', 'site_address_' . $cleanhuburl);
$region = get_config('hub', 'site_region_' . $cleanhuburl);
$country = get_config('hub', 'site_country_' . $cleanhuburl);
if ($country === false) {
$country = $admin->country;
}
$language = get_config('hub', 'site_language_' . $cleanhuburl);
if ($language === false) {
$language = current_language();
}
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
$emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
$emailalert = ($emailalert === 0) ? 0 : 1;
$coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
$usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
$roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
$postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
$questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
$resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
$mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
//hidden parameters
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$mform->addElement('hidden', 'password', $password);
$mform->setType('password', PARAM_RAW);
//the input parameters
$mform->addElement('header', 'moodle', get_string('registrationinfo', 'hub'));
$mform->addElement('text', 'name', get_string('sitename', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('name', $strrequired, 'required', null, 'client');
$mform->setType('name', PARAM_TEXT);
$mform->setDefault('name', $sitename);
$mform->addHelpButton('name', 'sitename', 'hub');
$options = array();
$registrationmanager = new registration_manager();
$options[HUB_SITENOTPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENOTPUBLISHED);
$options[HUB_SITENAMEPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENAMEPUBLISHED);
$options[HUB_SITELINKPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITELINKPUBLISHED);
$mform->addElement('select', 'privacy', get_string('siteprivacy', 'hub'), $options);
$mform->setDefault('privacy', $privacy);
$mform->addHelpButton('privacy', 'privacy', 'hub');
unset($options);
$mform->addElement('textarea', 'description', get_string('sitedesc', 'hub'),
array('rows' => 8, 'cols' => 41));
$mform->addRule('description', $strrequired, 'required', null, 'client');
$mform->setDefault('description', $sitedescription);
$mform->setType('description', PARAM_TEXT);
$mform->addHelpButton('description', 'sitedesc', 'hub');
$languages = get_string_manager()->get_list_of_languages();
collatorlib::asort($languages);
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
$languages);
$mform->setType('language', PARAM_ALPHANUMEXT);
$mform->addHelpButton('language', 'sitelang', 'hub');
$mform->setDefault('language', $language);
$mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'),
array('rows' => 4, 'cols' => 41));
$mform->setType('address', PARAM_TEXT);
$mform->setDefault('address', $address);
$mform->addHelpButton('address', 'postaladdress', 'hub');
//TODO: use the region array I generated
// $mform->addElement('select', 'region', get_string('selectaregion'), array('-' => '-'));
// $mform->setDefault('region', $region);
$mform->addElement('hidden', 'regioncode', '-');
$mform->setType('regioncode', PARAM_ALPHANUMEXT);
$countries = get_string_manager()->get_list_of_countries();
$mform->addElement('select', 'countrycode', get_string('sitecountry', 'hub'), $countries);
$mform->setDefault('countrycode', $country);
$mform->addHelpButton('countrycode', 'sitecountry', 'hub');
$mform->addElement('text', 'geolocation', get_string('sitegeolocation', 'hub'),
array('class' => 'registration_textfield'));
$mform->setDefault('geolocation', $geolocation);
$mform->addHelpButton('geolocation', 'sitegeolocation', 'hub');
$mform->addElement('text', 'contactname', get_string('siteadmin', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('contactname', $strrequired, 'required', null, 'client');
$mform->setType('contactname', PARAM_TEXT);
$mform->setDefault('contactname', $contactname);
$mform->addHelpButton('contactname', 'siteadmin', 'hub');
$mform->addElement('text', 'contactphone', get_string('sitephone', 'hub'),
array('class' => 'registration_textfield'));
$mform->setType('contactphone', PARAM_TEXT);
$mform->addHelpButton('contactphone', 'sitephone', 'hub');
$mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('contactemail', $strrequired, 'required', null, 'client');
$mform->setType('contactemail', PARAM_TEXT);
$mform->setDefault('contactemail', $contactemail);
$mform->addHelpButton('contactemail', 'siteemail', 'hub');
$options = array();
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
$mform->addElement('select', 'contactable', get_string('siteregistrationcontact', 'hub'), $options);
$mform->setDefault('contactable', $contactable);
$mform->addHelpButton('contactable', 'siteregistrationcontact', 'hub');
unset($options);
$options = array();
$options[0] = get_string("registrationno");
$options[1] = get_string("registrationyes");
$mform->addElement('select', 'emailalert', get_string('siteregistrationemail', 'hub'), $options);
$mform->setDefault('emailalert', $emailalert);
$mform->addHelpButton('emailalert', 'siteregistrationemail', 'hub');
unset($options);
//TODO site logo
$mform->addElement('hidden', 'imageurl', ''); //TODO: temporary
$mform->setType('imageurl', PARAM_URL);
$mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
$mform->addHelpButton('urlstring', 'siteurl', 'hub');
$mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
$mform->addElement('hidden', 'moodleversion', $CFG->version);
$mform->setType('moodleversion', PARAM_INT);
$mform->addHelpButton('versionstring', 'siteversion', 'hub');
$mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
$mform->addElement('hidden', 'moodlerelease', $CFG->release);
$mform->setType('moodlerelease', PARAM_TEXT);
$mform->addHelpButton('releasestring', 'siterelease', 'hub');
/// Display statistic that are going to be retrieve by the hub
$coursecount = $DB->count_records('course') - 1;
$usercount = $DB->count_records('user', array('deleted' => 0));
$roleassigncount = $DB->count_records('role_assignments');
$postcount = $DB->count_records('forum_posts');
$questioncount = $DB->count_records('question');
$resourcecount = $DB->count_records('resource');
require_once($CFG->dirroot . "/course/lib.php");
$participantnumberaverage = number_format(average_number_of_participants(), 2);
$modulenumberaverage = number_format(average_number_of_courses_modules(), 2);
if (HUB_MOODLEORGHUBURL != $huburl) {
$mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
" " . get_string('coursesnumber', 'hub', $coursecount));
$mform->setDefault('courses', true);
$mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
$mform->addElement('checkbox', 'users', '',
" " . get_string('usersnumber', 'hub', $usercount));
$mform->setDefault('users', true);
$mform->addElement('checkbox', 'roleassignments', '',
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
$mform->setDefault('roleassignments', true);
$mform->addElement('checkbox', 'posts', '',
" " . get_string('postsnumber', 'hub', $postcount));
$mform->setDefault('posts', true);
$mform->addElement('checkbox', 'questions', '',
" " . get_string('questionsnumber', 'hub', $questioncount));
$mform->setDefault('questions', true);
$mform->addElement('checkbox', 'resources', '',
" " . get_string('resourcesnumber', 'hub', $resourcecount));
$mform->setDefault('resources', true);
$mform->addElement('checkbox', 'participantnumberaverage', '',
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
$mform->setDefault('participantnumberaverage', true);
$mform->addElement('checkbox', 'modulenumberaverage', '',
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
$mform->setDefault('modulenumberaverage', true);
} else {
$mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
" " . get_string('coursesnumber', 'hub', $coursecount));
$mform->addElement('hidden', 'courses', true);
$mform->setType('courses', PARAM_FLOAT);
$mform->addHelpButton('courseslabel', 'sendfollowinginfo', 'hub');
$mform->addElement('static', 'userslabel', '',
" " . get_string('usersnumber', 'hub', $usercount));
$mform->addElement('hidden', 'users', true);
$mform->setType('users', PARAM_FLOAT);
$mform->addElement('static', 'roleassignmentslabel', '',
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
$mform->addElement('hidden', 'roleassignments', true);
$mform->setType('roleassignments', PARAM_FLOAT);
$mform->addElement('static', 'postslabel', '',
" " . get_string('postsnumber', 'hub', $postcount));
$mform->addElement('hidden', 'posts', true);
$mform->setType('posts', PARAM_FLOAT);
$mform->addElement('static', 'questionslabel', '',
" " . get_string('questionsnumber', 'hub', $questioncount));
$mform->addElement('hidden', 'questions', true);
$mform->setType('questions', PARAM_FLOAT);
$mform->addElement('static', 'resourceslabel', '',
" " . get_string('resourcesnumber', 'hub', $resourcecount));
$mform->addElement('hidden', 'resources', true);
$mform->setType('resources', PARAM_FLOAT);
$mform->addElement('static', 'participantnumberaveragelabel', '',
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
$mform->addElement('hidden', 'participantnumberaverage', true);
$mform->setType('participantnumberaverage', PARAM_FLOAT);
$mform->addElement('static', 'modulenumberaveragelabel', '',
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
$mform->addElement('hidden', 'modulenumberaverage', true);
$mform->setType('modulenumberaverage', PARAM_FLOAT);
}
//check if it's a first registration or update
$hubregistered = $registrationmanager->get_registeredhub($huburl);
if (!empty($hubregistered)) {
$buttonlabel = get_string('updatesite', 'hub',
!empty($hubname) ? $hubname : $huburl);
$mform->addElement('hidden', 'update', true);
$mform->setType('update', PARAM_BOOL);
} else {
$buttonlabel = get_string('registersite', 'hub',
!empty($hubname) ? $hubname : $huburl);
}
$this->add_action_buttons(false, $buttonlabel);
}
}
+171 -86
View File
@@ -15,114 +15,199 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* This page displays the site registration form.
* It handles redirection to the hub to continue the registration workflow process.
* It also handles update operation by web service.
* On this page the administrator selects which hub he wants to register,
* except for MOOCH. Admins can register with MOOCH with the top admin menu "Registration" link.
* On this page the administrator can also unregister from any hubs, including MOOCH.
*/
require_once('../../config.php');
require('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
require_once($CFG->dirroot . '/course/publish/lib.php');
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
admin_externalpage_setup('registrationmoodleorg');
admin_externalpage_setup('registrationhubs');
$unregistration = optional_param('unregistration', false, PARAM_BOOL);
$confirm = optional_param('confirm', false, PARAM_BOOL);
$renderer = $PAGE->get_renderer('core', 'register');
if ($unregistration && \core\hub\registration::is_registered()) {
if ($confirm) {
require_sesskey();
\core\hub\registration::unregister(false, false);
$unregistration = optional_param('unregistration', 0, PARAM_INT);
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_INT);
$huburl = optional_param('huburl', '', PARAM_URL);
$cancel = optional_param('cancel', null, PARAM_ALPHA);
if (!\core\hub\registration::is_registered()) {
redirect(new moodle_url('/admin/registration/index.php'));
$registrationmanager = new registration_manager();
$publicationmanager = new course_publish_manager();
$errormessage = '';
if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
$hub = $registrationmanager->get_registeredhub($huburl);
//unpublish course and unregister the site by web service
if (!$cleanregdata) {
//check if we need to unpublish courses
//enrollable courses
$unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
$hubcourseids = array();
if ($unpublishalladvertisedcourses) {
$enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
if (!empty($enrollablecourses)) {
foreach ($enrollablecourses as $enrollablecourse) {
$hubcourseids[] = $enrollablecourse->hubcourseid;
}
}
}
//downloadable courses
$unpublishalluploadedcourses = optional_param('unpublishalluploadedcourses', 0, PARAM_INT);
if ($unpublishalluploadedcourses) {
$downloadablecourses = $publicationmanager->get_publications($huburl, null, 0);
if (!empty($downloadablecourses)) {
foreach ($downloadablecourses as $downloadablecourse) {
$hubcourseids[] = $downloadablecourse->hubcourseid;
}
}
}
//unpublish the courses by web service
if (!empty($hubcourseids)) {
$function = 'hub_unregister_courses';
$params = array('courseids' => $hubcourseids);
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
//delete the published courses
if (!empty($enrollablecourses)) {
$publicationmanager->delete_hub_publications($huburl, 1);
}
if (!empty($downloadablecourses)) {
$publicationmanager->delete_hub_publications($huburl, 0);
}
} catch (Exception $e) {
$errormessage = $e->getMessage();
$errormessage .= html_writer::empty_tag('br') .
get_string('errorunpublishcourses', 'hub');
$confirm = false;
$cleanregdata = 1;
}
}
}
//course unpublish went ok, unregister the site now
if ($confirm) {
$function = 'hub_unregister_site';
$params = array();
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
if (!$cleanregdata) {
$errormessage = $e->getMessage();
$confirm = false;
$cleanregdata = 1;
}
}
}
//check that we are still processing the unregistration,
//it could have been unset if an exception were previsouly catched
if ($confirm) {
$registrationmanager->delete_registeredhub($huburl);
}
}
if (empty($cancel) and $unregistration and !$confirm) {
echo $OUTPUT->header();
//do not check sesskey if confirm = false because this script is linked into email message
if (!empty($errormessage)) {
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
}
$hub = $registrationmanager->get_registeredhub($huburl);
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
if ($cleanregdata) {
$siteunregistrationform = new site_clean_registration_data_form('',
array('huburl' => $huburl, 'hubname' => $hub->hubname));
} else {
$siteunregistrationform = new site_unregistration_form('',
array('huburl' => $huburl, 'hubname' => $hub->hubname));
}
$siteunregistrationform->display();
} else {
$registeredonmoodleorg = false;
$moodleorghub = $registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL);
if (!empty($moodleorghub)) {
$registeredonmoodleorg = true;
}
// load the hub selector form
$hubselectorform = new hub_selector_form();
$fromform = $hubselectorform->get_data();
$selectedhuburl = optional_param('publichub', false, PARAM_URL);
$unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
$password = optional_param('password', '', PARAM_RAW);
$registeringhuburl = null;
if (!empty($unlistedhuburl)) {
if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
$registeringhuburl = $unlistedhuburl;
}
} else if (!empty($selectedhuburl)) {
$registeringhuburl = $selectedhuburl;
}
// a hub has been selected, redirect to the hub registration page
if (empty($cancel) and !empty($registeringhuburl) and confirm_sesskey()) {
$hubname = optional_param(clean_param($registeringhuburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
$params = array('sesskey' => sesskey(), 'huburl' => $registeringhuburl,
'password' => $password, 'hubname' => $hubname);
redirect(new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/registration/register.php",
$params));
}
echo $OUTPUT->header();
echo $OUTPUT->confirm(
get_string('registerwithmoodleorgremove', 'core_hub'),
new moodle_url(new moodle_url('/admin/registration/index.php', ['unregistration' => 1, 'confirm' => 1])),
new moodle_url(new moodle_url('/admin/registration/index.php'))
);
echo $OUTPUT->footer();
exit;
}
$isinitialregistration = \core\hub\registration::show_after_install(true);
if (!$returnurl = optional_param('returnurl', null, PARAM_LOCALURL)) {
$returnurl = $isinitialregistration ? '/admin/index.php' : '/admin/registration/index.php';
}
//check if the site is registered on Moodle.org and display a message about registering on MOOCH
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
if (empty($registered)) {
$warningmsg = get_string('registermoochtips', 'hub');
$warningmsg .= $renderer->single_button(new moodle_url('register.php', array('huburl' => HUB_MOODLEORGHUBURL
, 'hubname' => 'Moodle.org')), get_string('register', 'admin'));
echo $renderer->box($warningmsg, 'buttons mdl-align generalbox adminwarning');
}
$siteregistrationform = new \core\hub\site_registration_form();
$siteregistrationform->set_data(['returnurl' => $returnurl]);
if ($fromform = $siteregistrationform->get_data()) {
//do not check sesskey if confirm = false because this script is linked into email message
if (!empty($errormessage)) {
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
}
// Save the settings.
\core\hub\registration::save_site_info($fromform);
echo $OUTPUT->heading(get_string('registerwith', 'hub'));
if (\core\hub\registration::is_registered()) {
if (\core\hub\registration::update_manual()) {
redirect(new moodle_url($returnurl));
$hubselectorform->display();
if (extension_loaded('xmlrpc')) {
$hubs = $registrationmanager->get_registered_on_hubs();
if (!empty($hubs)) {
echo $OUTPUT->heading(get_string('registeredon', 'hub'), 3, 'main');
echo $renderer->registeredonhublisting($hubs);
}
redirect(new moodle_url('/admin/registration/index.php', ['returnurl' => $returnurl]));
} else {
\core\hub\registration::register($returnurl);
// This method will redirect away.
} else { //display notice about xmlrpc
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
echo $OUTPUT->notification($xmlrpcnotification);
}
}
// OUTPUT SECTION.
echo $OUTPUT->header();
// Current status of registration.
$notificationtype = \core\output\notification::NOTIFY_ERROR;
if (\core\hub\registration::is_registered()) {
$lastupdated = \core\hub\registration::get_last_updated();
if ($lastupdated == 0) {
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
} else if (\core\hub\registration::get_new_registration_fields()) {
$registrationmessage = get_string('pleaserefreshregistrationnewdata', 'admin');
} else {
$lastupdated = userdate($lastupdated, get_string('strftimedate', 'langconfig'));
$registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
$notificationtype = \core\output\notification::NOTIFY_INFO;
}
echo $OUTPUT->notification($registrationmessage, $notificationtype);
} else if (!$isinitialregistration) {
$registrationmessage = get_string('registrationwarning', 'admin');
echo $OUTPUT->notification($registrationmessage, $notificationtype);
}
// Heading.
if (\core\hub\registration::is_registered()) {
echo $OUTPUT->heading(get_string('registerwithmoodleorgupdate', 'core_hub'));
} else if ($isinitialregistration) {
echo $OUTPUT->heading(get_string('registerwithmoodleorgcomplete', 'core_hub'));
} else {
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'core_hub'));
}
$renderer = $PAGE->get_renderer('core', 'admin');
echo $renderer->moodleorg_registration_message();
$siteregistrationform->display();
if (\core\hub\registration::is_registered()) {
// Unregister link.
$unregisterhuburl = new moodle_url("/admin/registration/index.php", ['unregistration' => 1]);
echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister mt-2');
} else if ($isinitialregistration) {
echo html_writer::div(html_writer::link(new moodle_url($returnurl), get_string('skipregistration', 'hub')),
'skipregistration mt-2');
}
echo $OUTPUT->footer();
+280 -1
View File
@@ -1,4 +1,5 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -14,4 +15,282 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
//// SITE PRIVACY /////
/**
* Site privacy: private
*/
define('HUB_SITENOTPUBLISHED', 'notdisplayed');
/**
* Site privacy: public
*/
define('HUB_SITENAMEPUBLISHED', 'named');
/**
* Site privacy: public and global
*/
define('HUB_SITELINKPUBLISHED', 'linked');
/**
*
* Site registration library
*
* @package course
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @author Jerome Mouneyrac
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class registration_manager {
/**
* Automatically update the registration on all hubs
*/
public function cron() {
global $CFG;
if (extension_loaded('xmlrpc')) {
//check if the last registration cron update was less than a week ago
$lastcron = get_config('registration', 'crontime');
if ($lastcron === false or $lastcron < strtotime("-7 day")) { //set to a week, see MDL-23704
$function = 'hub_update_site_info';
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
//update all hub where the site is registered on
$hubs = $this->get_registered_on_hubs();
foreach ($hubs as $hub) {
//update the registration
$siteinfo = $this->get_site_info($hub->huburl);
$params = array('siteinfo' => $siteinfo);
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
} catch (Exception $e) {
$errorparam = new stdClass();
$errorparam->errormessage = $e->getMessage();
$errorparam->hubname = $hub->hubname;
mtrace(get_string('errorcron', 'hub', $errorparam));
}
}
set_config('crontime', time(), 'registration');
}
} else {
mtrace(get_string('errorcronnoxmlrpc', 'hub'));
}
}
/**
* Return the site secret for a given hub
* site identifier is assigned to Mooch
* each hub has a unique and personal site secret.
* @param string $huburl
* @return string site secret
*/
public function get_site_secret_for_hub($huburl) {
global $DB;
$existingregistration = $DB->get_record('registration_hubs',
array('huburl' => $huburl));
if (!empty($existingregistration)) {
return $existingregistration->secret;
}
if ($huburl == HUB_MOODLEORGHUBURL) {
$siteidentifier = get_site_identifier();
} else {
$siteidentifier = random_string(32) . $_SERVER['HTTP_HOST'];
}
return $siteidentifier;
}
/**
* When the site register on a hub, he must call this function
* @param object $hub where the site is registered on
* @return integer id of the record
*/
public function add_registeredhub($hub) {
global $DB;
$id = $DB->insert_record('registration_hubs', $hub);
return $id;
}
/**
* When a site unregister from a hub, he must call this function
* @param string $huburl the huburl to delete
*/
public function delete_registeredhub($huburl) {
global $DB;
$DB->delete_records('registration_hubs', array('huburl' => $huburl));
}
/**
* Get a hub on which the site is registered for a given url or token
* Mostly use to check if the site is registered on a specific hub
* @param string $huburl
* @param string $token
* @return object the hub
*/
public function get_registeredhub($huburl = null, $token = null) {
global $DB;
$params = array();
if (!empty($huburl)) {
$params['huburl'] = $huburl;
}
if (!empty($token)) {
$params['token'] = $token;
}
$params['confirmed'] = 1;
$token = $DB->get_record('registration_hubs', $params);
return $token;
}
/**
* Get the hub which has not confirmed that the site is registered on,
* but for which a request has been sent
* @param string $huburl
* @return object the hub
*/
public function get_unconfirmedhub($huburl) {
global $DB;
$params = array();
$params['huburl'] = $huburl;
$params['confirmed'] = 0;
$token = $DB->get_record('registration_hubs', $params);
return $token;
}
/**
* Update a registered hub (mostly use to update the confirmation status)
* @param object $communication the hub
*/
public function update_registeredhub($communication) {
global $DB;
$DB->update_record('registration_hubs', $communication);
}
/**
* Return all hubs where the site is registered on
*/
public function get_registered_on_hubs() {
global $DB;
$hubs = $DB->get_records('registration_hubs', array('confirmed' => 1));
return $hubs;
}
/**
* Return site information for a specific hub
* @param string $huburl
* @return array site info
*/
public function get_site_info($huburl) {
global $CFG, $DB;
$siteinfo = array();
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
$siteinfo['name'] = get_config('hub', 'site_name_' . $cleanhuburl);
$siteinfo['description'] = get_config('hub', 'site_description_' . $cleanhuburl);
$siteinfo['contactname'] = get_config('hub', 'site_contactname_' . $cleanhuburl);
$siteinfo['contactemail'] = get_config('hub', 'site_contactemail_' . $cleanhuburl);
$siteinfo['contactphone'] = get_config('hub', 'site_contactphone_' . $cleanhuburl);
$siteinfo['imageurl'] = get_config('hub', 'site_imageurl_' . $cleanhuburl);
$siteinfo['privacy'] = get_config('hub', 'site_privacy_' . $cleanhuburl);
$siteinfo['street'] = get_config('hub', 'site_address_' . $cleanhuburl);
$siteinfo['regioncode'] = get_config('hub', 'site_region_' . $cleanhuburl);
$siteinfo['countrycode'] = get_config('hub', 'site_country_' . $cleanhuburl);
$siteinfo['geolocation'] = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$siteinfo['contactable'] = get_config('hub', 'site_contactable_' . $cleanhuburl);
$siteinfo['emailalert'] = get_config('hub', 'site_emailalert_' . $cleanhuburl);
if (get_config('hub', 'site_coursesnumber_' . $cleanhuburl) == -1) {
$coursecount = -1;
} else {
$coursecount = $DB->count_records('course') - 1;
}
$siteinfo['courses'] = $coursecount;
if (get_config('hub', 'site_usersnumber_' . $cleanhuburl) == -1) {
$usercount = -1;
} else {
$usercount = $DB->count_records('user', array('deleted' => 0));
}
$siteinfo['users'] = $usercount;
if (get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl) == -1) {
$roleassigncount = -1;
} else {
$roleassigncount = $DB->count_records('role_assignments');
}
$siteinfo['enrolments'] = $roleassigncount;
if (get_config('hub', 'site_postsnumber_' . $cleanhuburl) == -1) {
$postcount = -1;
} else {
$postcount = $DB->count_records('forum_posts');
}
$siteinfo['posts'] = $postcount;
if (get_config('hub', 'site_questionsnumber_' . $cleanhuburl) == -1) {
$questioncount = -1;
} else {
$questioncount = $DB->count_records('question');
}
$siteinfo['questions'] = $questioncount;
if (get_config('hub', 'site_resourcesnumber_' . $cleanhuburl) == -1) {
$resourcecount = -1;
} else {
$resourcecount = $DB->count_records('resource');
}
$siteinfo['resources'] = $resourcecount;
//TODO
require_once($CFG->dirroot . "/course/lib.php");
if (get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl) == -1) {
$participantnumberaverage = -1;
} else {
$participantnumberaverage = average_number_of_participants();
}
$siteinfo['participantnumberaverage'] = $participantnumberaverage;
if (get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl) == -1) {
$modulenumberaverage = -1;
} else {
$modulenumberaverage = average_number_of_courses_modules();
}
$siteinfo['modulenumberaverage'] = $modulenumberaverage;
$siteinfo['language'] = get_config('hub', 'site_language_' . $cleanhuburl);
$siteinfo['moodleversion'] = $CFG->version;
$siteinfo['moodlerelease'] = $CFG->release;
$siteinfo['url'] = $CFG->wwwroot;
return $siteinfo;
}
/**
* Retrieve the site privacy string matching the define value
* @param string $privacy must match the define into moodlelib.php
* @return string
*/
public function get_site_privacy_string($privacy) {
switch ($privacy) {
case HUB_SITENOTPUBLISHED:
$privacystring = get_string('siteprivacynotpublished', 'hub');
break;
case HUB_SITENAMEPUBLISHED:
$privacystring = get_string('siteprivacypublished', 'hub');
break;
case HUB_SITELINKPUBLISHED:
$privacystring = get_string('siteprivacylinked', 'hub');
break;
}
if (empty($privacystring)) {
throw new moodle_exception('unknownprivacy');
}
return $privacystring;
}
}
?>
+122 -2
View File
@@ -20,7 +20,7 @@
// //
///////////////////////////////////////////////////////////////////////////
/**
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
@@ -34,5 +34,125 @@
require_once('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
require_once($CFG->dirroot . '/webservice/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
redirect(new moodle_url('/admin/registration/index.php'));
$huburl = required_param('huburl', PARAM_URL);
$huburl = rtrim($huburl, "/");
if ($huburl == HUB_MOODLEORGHUBURL) { // register to Moodle.org
admin_externalpage_setup('registrationmoodleorg');
} else { //register to a hub
admin_externalpage_setup('registrationhub');
}
$password = optional_param('password', '', PARAM_TEXT);
$hubname = optional_param('hubname', '', PARAM_TEXT);
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_registeredhub($huburl);
$siteregistrationform = new site_registration_form('',
array('alreadyregistered' => !empty($registeredhub->token),
'huburl' => $huburl, 'hubname' => $hubname,
'password' => $password));
$fromform = $siteregistrationform->get_data();
if (!empty($fromform) and confirm_sesskey()) {
//save the settings
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
set_config('site_contactname_' . $cleanhuburl, $fromform->contactname, 'hub');
set_config('site_contactemail_' . $cleanhuburl, $fromform->contactemail, 'hub');
set_config('site_contactphone_' . $cleanhuburl, $fromform->contactphone, 'hub');
set_config('site_imageurl_' . $cleanhuburl, $fromform->imageurl, 'hub');
set_config('site_privacy_' . $cleanhuburl, $fromform->privacy, 'hub');
set_config('site_address_' . $cleanhuburl, $fromform->address, 'hub');
set_config('site_region_' . $cleanhuburl, $fromform->regioncode, 'hub');
set_config('site_country_' . $cleanhuburl, $fromform->countrycode, 'hub');
set_config('site_language_' . $cleanhuburl, $fromform->language, 'hub');
set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
set_config('site_postsnumber_' . $cleanhuburl, $fromform->posts, 'hub');
set_config('site_questionsnumber_' . $cleanhuburl, $fromform->questions, 'hub');
set_config('site_resourcesnumber_' . $cleanhuburl, $fromform->resources, 'hub');
set_config('site_modulenumberaverage_' . $cleanhuburl, $fromform->modulenumberaverage, 'hub');
set_config('site_participantnumberaverage_' . $cleanhuburl, $fromform->participantnumberaverage, 'hub');
}
/////// UPDATE ACTION ////////
// update the hub registration
$update = optional_param('update', 0, PARAM_INT);
if ($update and confirm_sesskey()) {
//update the registration
$function = 'hub_update_site_info';
$siteinfo = $registrationmanager->get_site_info($huburl);
$params = array('siteinfo' => $siteinfo);
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
try {
$result = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
$error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
}
}
/////// FORM REGISTRATION ACTION //////
if (!empty($fromform) and empty($update) and confirm_sesskey()) {
if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
$params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
$unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
if (empty($unconfirmedhub)) {
//we save the token into the communication table in order to have a reference
$unconfirmedhub = new stdClass();
$unconfirmedhub->token = $registrationmanager->get_site_secret_for_hub($huburl);
$unconfirmedhub->secret = $unconfirmedhub->token;
$unconfirmedhub->huburl = $huburl;
$unconfirmedhub->hubname = $hubname;
$unconfirmedhub->confirmed = 0;
$unconfirmedhub->id = $registrationmanager->add_registeredhub($unconfirmedhub);
}
$params['token'] = $unconfirmedhub->token;
$params['url'] = $CFG->wwwroot;
redirect(new moodle_url($huburl . '/local/hub/siteregistration.php', $params));
}
}
/////// OUTPUT SECTION /////////////
echo $OUTPUT->header();
//Display update notification result
if (!empty($registeredhub->confirmed)) {
if (!empty($result)) {
echo $OUTPUT->notification(get_string('siteregistrationupdated', 'hub'), 'notifysuccess');
}
}
if (!empty($error)) {
echo $error;
}
//some Moodle.org resitration explanation
if ($huburl == HUB_MOODLEORGHUBURL) {
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
$renderer = $PAGE->get_renderer('core', 'register');
echo $renderer->moodleorg_registration_message();
}
$siteregistrationform->display();
echo $OUTPUT->footer();

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