Merge branch 'MDL-58836-master' of git://github.com/damyon/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 10 May 2017 05:56:42 +0000 (06:56 +0100)
committerDan Poltawski <dan@moodle.com>
Wed, 10 May 2017 05:56:42 +0000 (06:56 +0100)
479 files changed:
admin/index.php
admin/tool/assignmentupgrade/version.php
admin/tool/availabilityconditions/version.php
admin/tool/behat/version.php
admin/tool/capability/version.php
admin/tool/cohortroles/version.php
admin/tool/customlang/version.php
admin/tool/dbtransfer/version.php
admin/tool/filetypes/version.php
admin/tool/generator/version.php
admin/tool/health/version.php
admin/tool/innodb/version.php
admin/tool/installaddon/version.php
admin/tool/langimport/version.php
admin/tool/log/store/database/version.php
admin/tool/log/store/legacy/version.php
admin/tool/log/store/standard/version.php
admin/tool/log/version.php
admin/tool/lp/version.php
admin/tool/lpimportcsv/version.php
admin/tool/lpmigrate/version.php
admin/tool/messageinbound/version.php
admin/tool/mobile/version.php
admin/tool/monitor/version.php
admin/tool/multilangupgrade/version.php
admin/tool/oauth2/version.php
admin/tool/phpunit/version.php
admin/tool/profiling/version.php
admin/tool/recyclebin/version.php
admin/tool/replace/version.php
admin/tool/spamcleaner/version.php
admin/tool/task/version.php
admin/tool/templatelibrary/version.php
admin/tool/unsuproles/version.php
admin/tool/uploadcourse/version.php
admin/tool/uploaduser/version.php
admin/tool/usertours/version.php
admin/tool/xmldb/version.php
auth/cas/db/upgrade.php
auth/cas/settings.php
auth/cas/version.php
auth/db/db/upgrade.php
auth/db/settings.php
auth/db/version.php
auth/email/db/upgrade.php
auth/email/settings.php
auth/email/version.php
auth/fc/db/upgrade.php
auth/fc/settings.php
auth/fc/version.php
auth/imap/db/upgrade.php
auth/imap/settings.php
auth/imap/version.php
auth/ldap/db/upgrade.php
auth/ldap/settings.php
auth/ldap/version.php
auth/lti/version.php
auth/manual/db/upgrade.php
auth/manual/settings.php
auth/manual/version.php
auth/mnet/db/upgrade.php
auth/mnet/version.php
auth/nntp/db/upgrade.php
auth/nntp/settings.php
auth/nntp/version.php
auth/nologin/version.php
auth/none/db/upgrade.php
auth/none/settings.php
auth/none/version.php
auth/oauth2/classes/api.php
auth/oauth2/db/events.php [new file with mode: 0644]
auth/oauth2/lang/en/auth_oauth2.php
auth/oauth2/linkedlogins.php
auth/oauth2/settings.php
auth/oauth2/version.php
auth/pam/db/upgrade.php
auth/pam/settings.php
auth/pam/version.php
auth/pop3/db/upgrade.php
auth/pop3/settings.php
auth/pop3/version.php
auth/shibboleth/db/upgrade.php
auth/shibboleth/settings.php
auth/shibboleth/version.php
auth/upgrade.txt
auth/webservice/version.php
availability/condition/completion/version.php
availability/condition/date/version.php
availability/condition/grade/version.php
availability/condition/group/version.php
availability/condition/grouping/version.php
availability/condition/profile/version.php
backup/backup.class.php
backup/moodle2/backup_stepslib.php
backup/moodle2/restore_stepslib.php
blocks/activity_modules/version.php
blocks/activity_results/version.php
blocks/admin_bookmarks/version.php
blocks/badges/version.php
blocks/blog_menu/version.php
blocks/blog_recent/version.php
blocks/blog_tags/version.php
blocks/calendar_month/version.php
blocks/calendar_upcoming/version.php
blocks/comments/version.php
blocks/community/version.php
blocks/completionstatus/version.php
blocks/course_list/version.php
blocks/course_summary/version.php
blocks/feedback/version.php
blocks/globalsearch/version.php
blocks/glossary_random/version.php
blocks/html/version.php
blocks/login/version.php
blocks/lp/version.php
blocks/mentees/version.php
blocks/messages/version.php
blocks/mnet_hosts/version.php
blocks/myoverview/amd/build/event_list_by_course.min.js
blocks/myoverview/amd/src/event_list_by_course.js
blocks/myoverview/tests/behat/block_myoverview_progress.feature
blocks/myoverview/version.php
blocks/myprofile/version.php
blocks/navigation/version.php
blocks/news_items/version.php
blocks/online_users/version.php
blocks/participants/version.php
blocks/private_files/version.php
blocks/quiz_results/version.php
blocks/recent_activity/version.php
blocks/rss_client/version.php
blocks/search_forums/version.php
blocks/section_links/version.php
blocks/selfcompletion/version.php
blocks/settings/version.php
blocks/site_main_menu/version.php
blocks/social_activities/version.php
blocks/tag_flickr/version.php
blocks/tag_youtube/version.php
blocks/tags/version.php
cache/locks/file/version.php
cache/stores/apcu/version.php
cache/stores/file/version.php
cache/stores/memcache/version.php
cache/stores/memcached/version.php
cache/stores/mongodb/version.php
cache/stores/redis/version.php
cache/stores/session/version.php
cache/stores/static/version.php
calendar/classes/local/event/container.php
calendar/classes/local/event/data_access/event_vault.php
calendar/classes/local/event/entities/event_interface.php
calendar/classes/local/event/factories/event_abstract_factory.php
calendar/classes/local/event/mappers/event_mapper.php
calendar/classes/local/event/proxies/cm_info_proxy.php [moved from calendar/classes/local/event/proxies/module_std_proxy.php with 53% similarity]
calendar/classes/local/event/proxies/proxy_interface.php
calendar/classes/local/event/proxies/std_proxy.php
calendar/classes/rrule_manager.php
calendar/export_execute.php
calendar/externallib.php
calendar/lib.php
calendar/renderer.php
calendar/tests/cm_info_proxy_test.php [new file with mode: 0644]
calendar/tests/container_test.php
calendar/tests/event_factory_test.php
calendar/tests/event_mapper_test.php
calendar/tests/externallib_test.php
calendar/tests/helpers.php
calendar/tests/module_std_proxy_test.php [deleted file]
calendar/tests/rrule_manager_test.php
calendar/tests/std_proxy_test.php
calendar/type/gregorian/version.php
course/format/singleactivity/version.php
course/format/social/version.php
course/format/topics/version.php
course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php
course/format/weeks/lib.php
course/format/weeks/tests/observer_test.php
course/format/weeks/version.php
dataformat/csv/version.php
dataformat/excel/version.php
dataformat/html/version.php
dataformat/json/version.php
dataformat/ods/version.php
enrol/category/version.php
enrol/cohort/version.php
enrol/database/version.php
enrol/flatfile/version.php
enrol/guest/version.php
enrol/imsenterprise/version.php
enrol/ldap/version.php
enrol/lti/version.php
enrol/manual/version.php
enrol/meta/version.php
enrol/mnet/version.php
enrol/paypal/version.php
enrol/self/version.php
files/converter/googledrive/version.php
files/converter/unoconv/version.php
filter/activitynames/version.php
filter/algebra/version.php
filter/censor/version.php
filter/data/version.php
filter/emailprotect/version.php
filter/emoticon/version.php
filter/glossary/version.php
filter/mathjaxloader/version.php
filter/mediaplugin/version.php
filter/multilang/version.php
filter/tex/version.php
filter/tidy/version.php
filter/urltolink/version.php
grade/export/ods/version.php
grade/export/txt/version.php
grade/export/xls/version.php
grade/export/xml/version.php
grade/grading/form/guide/version.php
grade/grading/form/rubric/version.php
grade/import/csv/version.php
grade/import/direct/version.php
grade/import/xml/version.php
grade/report/grader/version.php
grade/report/history/version.php
grade/report/outcomes/version.php
grade/report/overview/version.php
grade/report/singleview/version.php
grade/report/user/version.php
install/lang/en/install.php
install/lang/es_mx/install.php
install/lang/hu/install.php
install/lang/ja/install.php
lib/antivirus/clamav/version.php
lib/db/upgrade.php
lib/editor/atto/plugins/accessibilitychecker/version.php
lib/editor/atto/plugins/accessibilityhelper/version.php
lib/editor/atto/plugins/align/version.php
lib/editor/atto/plugins/backcolor/version.php
lib/editor/atto/plugins/bold/version.php
lib/editor/atto/plugins/charmap/version.php
lib/editor/atto/plugins/clear/version.php
lib/editor/atto/plugins/collapse/version.php
lib/editor/atto/plugins/emoticon/version.php
lib/editor/atto/plugins/equation/version.php
lib/editor/atto/plugins/fontcolor/version.php
lib/editor/atto/plugins/html/version.php
lib/editor/atto/plugins/image/version.php
lib/editor/atto/plugins/indent/version.php
lib/editor/atto/plugins/italic/version.php
lib/editor/atto/plugins/link/version.php
lib/editor/atto/plugins/managefiles/version.php
lib/editor/atto/plugins/media/version.php
lib/editor/atto/plugins/noautolink/version.php
lib/editor/atto/plugins/orderedlist/version.php
lib/editor/atto/plugins/rtl/version.php
lib/editor/atto/plugins/strike/version.php
lib/editor/atto/plugins/subscript/version.php
lib/editor/atto/plugins/superscript/version.php
lib/editor/atto/plugins/table/version.php
lib/editor/atto/plugins/title/version.php
lib/editor/atto/plugins/underline/version.php
lib/editor/atto/plugins/undo/version.php
lib/editor/atto/plugins/unorderedlist/version.php
lib/editor/atto/version.php
lib/editor/textarea/version.php
lib/editor/tinymce/plugins/ctrlhelp/version.php
lib/editor/tinymce/plugins/managefiles/version.php
lib/editor/tinymce/plugins/moodleemoticon/tinymce/editor_plugin.js
lib/editor/tinymce/plugins/moodleemoticon/version.php
lib/editor/tinymce/plugins/moodleimage/version.php
lib/editor/tinymce/plugins/moodlemedia/version.php
lib/editor/tinymce/plugins/moodlenolink/version.php
lib/editor/tinymce/plugins/pdw/version.php
lib/editor/tinymce/plugins/spellchecker/version.php
lib/editor/tinymce/plugins/wrap/version.php
lib/editor/tinymce/version.php
lib/filestorage/stored_file.php
lib/setuplib.php
lib/templates/columns-1to1to1.mustache
lib/templates/columns-1to2.mustache
lib/templates/columns-2to1.mustache
lib/upgradelib.php
media/player/html5audio/version.php
media/player/html5video/version.php
media/player/swf/version.php
media/player/videojs/version.php
media/player/vimeo/version.php
media/player/youtube/version.php
message/output/airnotifier/version.php
message/output/email/version.php
message/output/jabber/version.php
message/output/popup/version.php
mnet/service/enrol/version.php
mod/assign/backup/moodle2/restore_assign_stepslib.php
mod/assign/feedback/comments/version.php
mod/assign/feedback/editpdf/version.php
mod/assign/feedback/file/version.php
mod/assign/feedback/offline/version.php
mod/assign/gradingtable.php
mod/assign/submission/comments/version.php
mod/assign/submission/file/version.php
mod/assign/submission/onlinetext/version.php
mod/assign/version.php
mod/assignment/type/offline/version.php
mod/assignment/type/online/version.php
mod/assignment/type/upload/version.php
mod/assignment/type/uploadsingle/version.php
mod/assignment/version.php
mod/book/tool/exportimscp/version.php
mod/book/tool/importhtml/version.php
mod/book/tool/print/version.php
mod/book/version.php
mod/chat/version.php
mod/choice/version.php
mod/data/field/checkbox/version.php
mod/data/field/date/version.php
mod/data/field/file/version.php
mod/data/field/latlong/version.php
mod/data/field/menu/version.php
mod/data/field/multimenu/version.php
mod/data/field/number/version.php
mod/data/field/picture/version.php
mod/data/field/radiobutton/version.php
mod/data/field/text/version.php
mod/data/field/textarea/version.php
mod/data/field/url/version.php
mod/data/preset/imagegallery/version.php
mod/data/version.php
mod/feedback/version.php
mod/folder/version.php
mod/forum/version.php
mod/glossary/locallib.php
mod/glossary/tests/lib_test.php
mod/glossary/version.php
mod/imscp/version.php
mod/label/version.php
mod/lesson/classes/external.php
mod/lesson/tests/external_test.php
mod/lesson/version.php
mod/lti/service/memberships/version.php
mod/lti/service/profile/version.php
mod/lti/service/toolproxy/version.php
mod/lti/service/toolsettings/version.php
mod/lti/version.php
mod/page/version.php
mod/quiz/accessrule/delaybetweenattempts/version.php
mod/quiz/accessrule/ipaddress/version.php
mod/quiz/accessrule/numattempts/version.php
mod/quiz/accessrule/offlineattempts/version.php
mod/quiz/accessrule/openclosedate/version.php
mod/quiz/accessrule/password/version.php
mod/quiz/accessrule/safebrowser/version.php
mod/quiz/accessrule/securewindow/version.php
mod/quiz/accessrule/timelimit/version.php
mod/quiz/report/grading/version.php
mod/quiz/report/overview/version.php
mod/quiz/report/responses/version.php
mod/quiz/report/statistics/version.php
mod/quiz/version.php
mod/resource/version.php
mod/scorm/report/basic/version.php
mod/scorm/report/graphs/version.php
mod/scorm/report/interactions/version.php
mod/scorm/report/objectives/version.php
mod/scorm/version.php
mod/survey/version.php
mod/url/version.php
mod/wiki/version.php
mod/workshop/allocation/manual/version.php
mod/workshop/allocation/random/version.php
mod/workshop/allocation/scheduled/version.php
mod/workshop/eval/best/version.php
mod/workshop/form/accumulative/version.php
mod/workshop/form/comments/version.php
mod/workshop/form/numerrors/version.php
mod/workshop/form/rubric/version.php
mod/workshop/version.php
portfolio/boxnet/version.php
portfolio/download/version.php
portfolio/flickr/version.php
portfolio/googledocs/version.php
portfolio/mahara/version.php
portfolio/picasa/version.php
question/behaviour/adaptive/version.php
question/behaviour/adaptivenopenalty/version.php
question/behaviour/deferredcbm/version.php
question/behaviour/deferredfeedback/version.php
question/behaviour/immediatecbm/version.php
question/behaviour/immediatefeedback/version.php
question/behaviour/informationitem/version.php
question/behaviour/interactive/version.php
question/behaviour/interactivecountback/version.php
question/behaviour/manualgraded/version.php
question/behaviour/missing/version.php
question/format/aiken/version.php
question/format/blackboard_six/version.php
question/format/examview/version.php
question/format/gift/version.php
question/format/missingword/version.php
question/format/multianswer/version.php
question/format/webct/version.php
question/format/xhtml/version.php
question/format/xml/version.php
question/type/calculated/version.php
question/type/calculatedmulti/version.php
question/type/calculatedsimple/version.php
question/type/ddimageortext/version.php
question/type/ddmarker/version.php
question/type/ddwtos/version.php
question/type/description/version.php
question/type/essay/version.php
question/type/gapselect/version.php
question/type/match/version.php
question/type/missingtype/version.php
question/type/multianswer/version.php
question/type/multichoice/version.php
question/type/numerical/version.php
question/type/random/version.php
question/type/randomsamatch/version.php
question/type/shortanswer/version.php
question/type/truefalse/version.php
report/backups/version.php
report/competency/version.php
report/completion/version.php
report/configlog/version.php
report/courseoverview/version.php
report/eventlist/version.php
report/log/version.php
report/loglive/version.php
report/outline/version.php
report/participation/version.php
report/performance/version.php
report/progress/version.php
report/questioninstances/version.php
report/security/version.php
report/stats/version.php
report/usersessions/version.php
repository/areafiles/version.php
repository/boxnet/version.php
repository/coursefiles/version.php
repository/dropbox/version.php
repository/equella/version.php
repository/filesystem/lib.php
repository/filesystem/version.php
repository/flickr/version.php
repository/flickr_public/version.php
repository/googledocs/lib.php
repository/googledocs/version.php
repository/local/version.php
repository/merlot/version.php
repository/onedrive/lib.php
repository/onedrive/version.php
repository/picasa/version.php
repository/recent/version.php
repository/s3/version.php
repository/skydrive/version.php
repository/upload/version.php
repository/url/version.php
repository/user/version.php
repository/webdav/version.php
repository/wikimedia/version.php
repository/youtube/version.php
search/engine/solr/version.php
theme/boost/scss/moodle/filemanager.scss
theme/boost/templates/core/columns-1to1to1.mustache [new file with mode: 0644]
theme/boost/templates/core/columns-1to2.mustache [new file with mode: 0644]
theme/boost/templates/core/columns-2to1.mustache [new file with mode: 0644]
theme/boost/version.php
theme/bootstrapbase/version.php
theme/clean/version.php
theme/more/version.php
user/profile/field/checkbox/version.php
user/profile/field/datetime/version.php
user/profile/field/menu/version.php
user/profile/field/text/version.php
user/profile/field/textarea/version.php
version.php
webservice/rest/version.php
webservice/soap/version.php
webservice/xmlrpc/version.php

index 30ba5cb..6cf7f45 100644 (file)
@@ -101,6 +101,12 @@ if (function_exists('opcache_invalidate')) {
 // 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
 
index c44e6a3..b9f686e 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version   = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'tool_assignmentupgrade';
-$plugin->dependencies = array('mod_assign' => 2016112900);
+$plugin->dependencies = array('mod_assign' => 2017050500);
index 88205f6..c653aae 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'tool_availabilityconditions';
index e79651f..86b4270 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;   // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;   // Requires this Moodle version
+$plugin->version   = 2017051500;   // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;   // Requires this Moodle version
 $plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
index 8fd2642..207cc49 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
index f65a0fb..4184223 100644 (file)
@@ -25,8 +25,8 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_cohortroles'; // Full name of the plugin (used for diagnostics).
 
 $plugin->dependencies = array(
index b2a4907..d781f1c 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version   = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
index 0f52139..77a6bb5 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
index 05ad249..cdeb0bc 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'tool_filetypes';
index 2e19cbb..2bbb64a 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'tool_generator';
index e7e62f8..cefee6d 100644 (file)
@@ -25,8 +25,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
 
 $plugin->maturity  = MATURITY_ALPHA; // this version's maturity level
index 439c750..4c6c9b2 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
index b9426f4..023919f 100644 (file)
@@ -24,6 +24,6 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component  = 'tool_installaddon';
-$plugin->version    = 2016120500;
-$plugin->requires   = 2016112900;
+$plugin->version    = 2017051500;
+$plugin->requires   = 2017050500;
 $plugin->maturity   = MATURITY_STABLE;
index 6b2724e..dd33c73 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
index 13e0a29..40d4db1 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2016112900; // Requires this Moodle version.
+$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2017050500; // Requires this Moodle version.
 $plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
index d8eb2b4..54b807f 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2016112900; // Requires this Moodle version.
+$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2017050500; // Requires this Moodle version.
 $plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
index 36da7a1..3406918 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2016112900; // Requires this Moodle version.
+$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2017050500; // Requires this Moodle version.
 $plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
index 59fc1ff..6a64dec 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2016112900; // Requires this Moodle version.
+$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
index 84d7b12..3dadfb7 100644 (file)
@@ -25,6 +25,6 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
index 79a1d15..d9cde29 100644 (file)
@@ -25,8 +25,8 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_lpimportcsv'; // Full name of the plugin (used for diagnostics).
-$plugin->dependencies = array('tool_lp' => 2016112900);
+$plugin->dependencies = array('tool_lp' => 2017050500);
 
index 0eb8e8c..c26c239 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_lpmigrate'; // Full name of the plugin (used for diagnostics).
 $plugin->dependencies = array(
     'tool_lp' => ANY_VERSION
index 9b419f3..dea4dde 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version   = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'tool_messageinbound';
index d42f121..0903cc5 100644 (file)
@@ -23,9 +23,9 @@
  */
 
 defined('MOODLE_INTERNAL') || die();
-$plugin->version   = 2017041200; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
 $plugin->dependencies = array(
-    'webservice_rest' => 2016120500
+    'webservice_rest' => 2017050500
 );
index 2a46e91..0d70292 100644 (file)
@@ -26,6 +26,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2017021300;     // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;     // Requires this Moodle version.
+$plugin->version   = 2017051500;     // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;     // Requires this Moodle version.
 $plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
index e5d7f88..4f66912 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
 
index 22ed6ee..8a08f7c 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_oauth2'; // Full name of the plugin (used for diagnostics).
 
index 1e4f201..5ee13dd 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
 
index c5392cd..9adf0db 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
index 3f175ff..167b312 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_recyclebin'; // Full name of the plugin (used for diagnostics).
index 02187ed..54c7726 100644 (file)
@@ -25,8 +25,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
 
 $plugin->maturity  = MATURITY_ALPHA; // this version's maturity level
index 6bbc743..284a709 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version   = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
 
index 5b18888..a6b9679 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_task'; // Full name of the plugin (used for diagnostics)
 
index 76bfae2..e53fbfe 100644 (file)
@@ -21,6 +21,6 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 defined('MOODLE_INTERNAL') || die();
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900; // Requires this Moodle version.
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500; // Requires this Moodle version.
 $plugin->component = 'tool_templatelibrary'; // Full name of the plugin (used for diagnostics).
index 3a26e06..dc879b0 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
 
index 871661f..f5d2a5c 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;            // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;            // Requires this Moodle version.
+$plugin->version   = 2017051500;            // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;            // Requires this Moodle version.
 $plugin->component = 'tool_uploadcourse';   // Full name of the plugin (used for diagnostics).
index 912729d..980892a 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
 
index 384b8f4..b890559 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120501;            // The current module version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;            // Requires this Moodle version.
+$plugin->version   = 2017051500;            // The current module version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;            // Requires this Moodle version.
 $plugin->component = 'tool_usertours';      // Full name of the plugin (used for diagnostics).
index 9c2edef..b42ae5c 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900; // Requires this Moodle version
+$plugin->version   = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500; // Requires this Moodle version
 $plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
 
index dc0a265..7c7c1c0 100644 (file)
@@ -62,6 +62,7 @@ function xmldb_auth_cas_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/cas to auth_cas.
         upgrade_fix_config_auth_plugin_names('cas');
+        upgrade_fix_config_auth_plugin_defaults('cas');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'cas');
     }
 
index 961c8d2..2bd7434 100644 (file)
@@ -264,7 +264,7 @@ if ($ADMIN->fulltree) {
     }
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('cas');
     $help  = get_string('auth_ldapextrafields', 'auth_ldap');
     $help .= get_string('auth_updatelocal_expl', 'auth');
     $help .= get_string('auth_fieldlock_expl', 'auth');
index 26f3bc5..b99fa65 100644 (file)
@@ -26,8 +26,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_cas';        // Full name of the plugin (used for diagnostics)
 
-$plugin->dependencies = array('auth_ldap' => 2017020700);
+$plugin->dependencies = array('auth_ldap' => 2017050500);
index f40ea86..00e18b9 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_db_upgrade($oldversion) {
     if ($oldversion < 2017032800) {
         // Convert info in config plugins from auth/db to auth_db
         upgrade_fix_config_auth_plugin_names('db');
+        upgrade_fix_config_auth_plugin_defaults('db');
         upgrade_plugin_savepoint(true, 2017032800, 'auth', 'db');
     }
 
index da5622a..54f3450 100644 (file)
@@ -135,7 +135,7 @@ if ($ADMIN->fulltree) {
         new lang_string('auth_dbupdateusers_description', 'auth_db'), 0, $yesno));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('db');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_dbextrafields', 'auth_db'),
             true, true, $authplugin->get_custom_user_profile_fields());
index f291cf8..a8d12b7 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017032800;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_db';         // Full name of the plugin (used for diagnostics)
index f1b9ca7..cd0ed73 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_email_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/email to auth_email.
         upgrade_fix_config_auth_plugin_names('email');
+        upgrade_fix_config_auth_plugin_defaults('email');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'email');
     }
 
index 88d7bc2..29d2849 100644 (file)
@@ -40,7 +40,7 @@ if ($ADMIN->fulltree) {
         new lang_string('auth_emailrecaptcha', 'auth_email'), 0, $options));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('email');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 5787477..e6138fc 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_email';      // Full name of the plugin (used for diagnostics)
index 4aefd46..61a9bab 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_fc_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/fc to auth_fc.
         upgrade_fix_config_auth_plugin_names('fc');
+        upgrade_fix_config_auth_plugin_defaults('fc');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'fc');
     }
 
index 6039a64..ff3aa3f 100644 (file)
@@ -55,7 +55,7 @@ if ($ADMIN->fulltree) {
             get_string('changepasswordhelp', 'auth'), '', PARAM_URL));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('fc');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 55fc7e5..386950a 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_fc';         // Full name of the plugin (used for diagnostics)
index e89b077..d26dac2 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_imap_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/imap to auth_imap.
         upgrade_fix_config_auth_plugin_names('imap');
+        upgrade_fix_config_auth_plugin_defaults('imap');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'imap');
     }
 
index b2478bd..fe8e7a1 100644 (file)
@@ -55,7 +55,7 @@ if ($ADMIN->fulltree) {
             get_string('changepasswordhelp', 'auth'), '', PARAM_URL));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('imap');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 
index 5c102b0..b38709a 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_imap';       // Full name of the plugin (used for diagnostics)
index 4b8bab0..355b719 100644 (file)
@@ -62,6 +62,7 @@ function xmldb_auth_ldap_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/ldap to auth_ldap.
         upgrade_fix_config_auth_plugin_names('ldap');
+        upgrade_fix_config_auth_plugin_defaults('ldap');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'ldap');
     }
 
index 85c5f79..5f62569 100644 (file)
@@ -295,7 +295,7 @@ if ($ADMIN->fulltree) {
     }
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('ldap');
     $help  = get_string('auth_ldapextrafields', 'auth_ldap');
     $help .= get_string('auth_updatelocal_expl', 'auth');
     $help .= get_string('auth_fieldlock_expl', 'auth');
index 8afa03a..5e96509 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_ldap';       // Full name of the plugin (used for diagnostics)
index 1da5ecc..66901a2 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2016112900; // Requires this Moodle version (3.1).
+$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2017050500; // Requires this Moodle version (3.1).
 $plugin->component = 'auth_lti'; // Full name of the plugin (used for diagnostics).
index e0dc4a6..ca483c0 100644 (file)
@@ -50,6 +50,7 @@ function xmldb_auth_manual_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/manual to auth_manual.
         upgrade_fix_config_auth_plugin_names('manual');
+        upgrade_fix_config_auth_plugin_defaults('manual');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'manual');
     }
 
index cb546e0..95b29b1 100644 (file)
@@ -72,7 +72,7 @@ if ($ADMIN->fulltree) {
         new lang_string('expiration_warning_desc', 'auth_manual'), 0, $expirationwarningoptions));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('manual');
     display_auth_lock_options($settings, $authplugin->authtype,
         $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 794366f..4411e68 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_manual';     // Full name of the plugin (used for diagnostics)
index 1aceca6..46786fe 100644 (file)
@@ -49,6 +49,7 @@ function xmldb_auth_mnet_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/mnet to auth_mnet.
         upgrade_fix_config_auth_plugin_names('mnet');
+        upgrade_fix_config_auth_plugin_defaults('mnet');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'mnet');
     }
 
index 6bc7751..47b270e 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_mnet';       // Full name of the plugin (used for diagnostics)
index 4fd893d..8708487 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_nntp_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/nntp to auth_nntp.
         upgrade_fix_config_auth_plugin_names('nntp');
+        upgrade_fix_config_auth_plugin_defaults('nntp');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'nntp');
     }
 
index d318c68..bf475ee 100644 (file)
@@ -44,7 +44,7 @@ if ($ADMIN->fulltree) {
             get_string('changepasswordhelp', 'auth'), '', PARAM_URL));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('nntp');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index b94e05e..4ee22dc 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_nntp';       // Full name of the plugin (used for diagnostics)
index c7317df..e9c7094 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_nologin';    // Full name of the plugin (used for diagnostics)
index 2f858cb..56bf606 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_none_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/none to auth_none.
         upgrade_fix_config_auth_plugin_names('none');
+        upgrade_fix_config_auth_plugin_defaults('none');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'none');
     }
 
index 8f79897..28ff931 100644 (file)
@@ -31,7 +31,7 @@ if ($ADMIN->fulltree) {
         new lang_string('auth_nonedescription', 'auth_none')));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('none');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
         get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 4530356..7a5f580 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_none';       // Full name of the plugin (used for diagnostics)
index 430abee..ffcb79c 100644 (file)
@@ -105,6 +105,10 @@ class api {
             $userid = $USER->id;
         }
 
+        if (linked_login::count_records(['username' => $userinfo['username']]) > 0) {
+            throw new moodle_exception('alreadylinked', 'auth_oauth2');
+        }
+
         if (\core\session\manager::is_loggedinas()) {
             throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
         }
@@ -144,9 +148,8 @@ class api {
         $record->issuerid = $issuer->get('id');
         $record->username = $userinfo['username'];
         $record->userid = $userid;
-        $existing = linked_login::get_record((array)$record);
-        if ($existing) {
-            return false;
+        if (linked_login::count_records(['username' => $userinfo['username']]) > 0) {
+            throw new moodle_exception('alreadylinked', 'auth_oauth2');
         }
         $record->email = $userinfo['email'];
         $record->confirmtoken = random_string(32);
@@ -239,6 +242,10 @@ class api {
         require_once($CFG->dirroot.'/user/profile/lib.php');
         require_once($CFG->dirroot.'/user/lib.php');
 
+        if (linked_login::count_records(['username' => $userinfo['username']]) > 0) {
+            throw new moodle_exception('alreadylinked', 'auth_oauth2');
+        }
+
         $user = new stdClass();
         $user->username = $userinfo['username'];
         $user->email = $userinfo['email'];
@@ -319,4 +326,18 @@ class api {
 
         $login->delete();
     }
+
+    /**
+     * Delete linked logins for a user.
+     *
+     * @param \core\event\user_deleted $event
+     * @return boolean
+     */
+    public static function user_deleted(\core\event\user_deleted $event) {
+        global $DB;
+
+        $userid = $event->objectid;
+
+        return $DB->delete_records(linked_login::TABLE, ['userid' => $userid]);
+    }
 }
diff --git a/auth/oauth2/db/events.php b/auth/oauth2/db/events.php
new file mode 100644 (file)
index 0000000..b6f793c
--- /dev/null
@@ -0,0 +1,31 @@
+<?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 definies observers needed by the plugin.
+ *
+ * @package    auth_oauth2
+ * @copyright  2017 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+// List of observers.
+$observers = [
+    [
+        'eventname'   => '\core\event\user_deleted',
+        'callback'    => '\auth_oauth2\api::user_deleted',
+    ],
+];
index f0715e0..1ba808c 100644 (file)
@@ -83,3 +83,4 @@ $string['notwhileloggedinas'] = 'Linked logins cannot be managed while logged in
 $string['oauth2:managelinkedlogins'] = 'Manage own linked login accounts';
 $string['plugindescription'] = 'This authentication plugin displays a list of the configured identity providers on the login page. Selecting an identity provider allows users to login with their credentials from an OAuth 2 provider.';
 $string['pluginname'] = 'OAuth 2';
+$string['alreadylinked'] = 'This external account is already linked to an account on this site';
index 1228530..fe18f8f 100644 (file)
@@ -58,8 +58,12 @@ if ($action == 'new') {
     $userinfo = $client->get_userinfo();
 
     if (!empty($userinfo)) {
-        \auth_oauth2\api::link_login($userinfo, $issuer);
-        redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
+        try {
+            \auth_oauth2\api::link_login($userinfo, $issuer);
+            redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
+        } catch (Exception $e) {
+            redirect($PAGE->url, $e->getMessage(), null, \core\output\notification::NOTIFY_ERROR);
+        }
     } else {
         redirect($PAGE->url, get_string('notloggedin', 'auth_oauth2'), null, \core\output\notification::NOTIFY_ERROR);
     }
index 51e15b7..cecdae5 100644 (file)
@@ -29,7 +29,7 @@ if ($ADMIN->fulltree) {
     $warning = $OUTPUT->notification(get_string('createaccountswarning', 'auth_oauth2'), 'warning');
     $settings->add(new admin_setting_heading('auth_oauth2/pluginname', '', $warning));
 
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('oauth2');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 2ff2041..2758934 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017032300;        // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;        // Requires this Moodle version.
+$plugin->version   = 2017051501;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;        // Requires this Moodle version.
 $plugin->component = 'auth_oauth2';       // Full name of the plugin (used for diagnostics).
index 480fe39..e69eb57 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_pam_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/pam to auth_pam.
         upgrade_fix_config_auth_plugin_names('pam');
+        upgrade_fix_config_auth_plugin_defaults('pam');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'pam');
     }
 
index 40ef60a..7a053a3 100644 (file)
@@ -31,7 +31,7 @@ if ($ADMIN->fulltree) {
         new lang_string('auth_pamdescription', 'auth_pam')));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('pam');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
         get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 8cbc60d..3589681 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_pam';       // Full name of the plugin (used for diagnostics)
index ea91a44..e540c77 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_pop3_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/pop3 to auth_pop3.
         upgrade_fix_config_auth_plugin_names('pop3');
+        upgrade_fix_config_auth_plugin_defaults('pop3');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'pop3');
     }
 
index 5454f95..fa9c6a9 100644 (file)
@@ -59,7 +59,7 @@ if ($ADMIN->fulltree) {
             get_string('changepasswordhelp', 'auth'), '', PARAM_URL));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('pop3');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             get_string('auth_fieldlocks_help', 'auth'), false, false);
 }
index 7218aa2..a4b54ac 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_pop3';       // Full name of the plugin (used for diagnostics)
index 3bd2d13..38cec6c 100644 (file)
@@ -38,6 +38,7 @@ function xmldb_auth_shibboleth_upgrade($oldversion) {
     if ($oldversion < 2017020700) {
         // Convert info in config plugins from auth/shibboleth to auth_shibboleth.
         upgrade_fix_config_auth_plugin_names('shibboleth');
+        upgrade_fix_config_auth_plugin_defaults('shibboleth');
         upgrade_plugin_savepoint(true, 2017020700, 'auth', 'shibboleth');
     }
 
index 94db01f..c901378 100644 (file)
@@ -75,7 +75,7 @@ if ($ADMIN->fulltree) {
             get_string('changepasswordhelp', 'auth'), '', PARAM_URL));
 
     // Display locking / mapping of profile fields.
-    $authplugin = get_auth_plugin($this->name);
+    $authplugin = get_auth_plugin('shibboleth');
     display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
             '', true, false, $authplugin->get_custom_user_profile_fields());
 
index 9a9e3e2..e0aad0e 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2017020700;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_shibboleth'; // Full name of the plugin (used for diagnostics)
index 1a3a50a..fff9fdd 100644 (file)
@@ -3,10 +3,11 @@ information provided here is intended especially for developers.
 
 === 3.3 ===
 
-* Authentication plugins have been migrated to use the admin settings API.
-  Plugins should use a settings.php file to manage configurations rather than using the config.html files.
-  See how the helper function upgrade_fix_config_auth_plugin_names() can be used to convert the legacy settings to the
-  new ones.
+* Authentication plugins have been migrated to use the admin settings API.  Plugins should use a settings.php file to
+  manage configurations rather than using the old config.html files. See how the helper function
+  upgrade_fix_config_auth_plugin_names() can be used to convert the legacy settings to the new ones. Another helper
+  function upgrade_fix_config_auth_plugin_defaults() can be used to populate the settings with default values so that
+  they are not falsely reported as newly added ones.
 * The function 'print_auth_lock_options' has been replaced by 'display_auth_lock_options' which uses the admin settings API.
   See auth_manual as an exmple of how it can be used.  More information can be found in MDL-12689.
 * The list of supported identity providers (SSO IdP) returned by the 'loginpage_idp_list' method (used to render the
index 576fdbd..416c4f0 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'auth_webservice'; // Full name of the plugin (used for diagnostics)
index d57b8b7..29ff423 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_completion';
index fc366c1..ad4638a 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_date';
index 9556f99..5ce9b39 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_grade';
index 54d5a0a..054a355 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_group';
index 3b3017e..26d0460 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_grouping';
index bf4e0e6..da86203 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->component = 'availability_profile';
index 0361f10..ff2d38c 100644 (file)
@@ -136,7 +136,7 @@ abstract class backup implements checksumable {
      * point is backup when some behavior/approach channged, in order to allow
      * conditional coding based on it.
      */
-    const VERSION = 2016120500;
+    const VERSION = 2017051500;
     /**
      * Usually same than major release zero version, mainly for informative/historic purposes.
      */
index 8855d58..acdf34b 100644 (file)
@@ -863,8 +863,9 @@ class backup_calendarevents_structure_step extends backup_structure_step {
 
         $event = new backup_nested_element('event', array('id'), array(
                 'name', 'description', 'format', 'courseid', 'groupid', 'userid',
-                'repeatid', 'modulename', 'instance', 'eventtype', 'timestart',
-                'timeduration', 'visible', 'uuid', 'sequence', 'timemodified'));
+                'repeatid', 'modulename', 'instance', 'type', 'eventtype', 'timestart',
+                'timeduration', 'timesort', 'visible', 'uuid', 'sequence', 'timemodified',
+                'priority'));
 
         // Build the tree
         $events->add_child($event);
@@ -876,6 +877,14 @@ class backup_calendarevents_structure_step extends backup_structure_step {
                         AND (eventtype = 'course' OR eventtype = 'group')";
             $calendar_items_params = array('courseid'=>backup::VAR_COURSEID);
             $event->set_source_sql($calendar_items_sql, $calendar_items_params);
+        } else if ($this->name == 'activity_calendar') {
+            $params = array('instance' => backup::VAR_ACTIVITYID, 'modulename' => backup::VAR_MODNAME);
+            // If we don't want to include the userinfo in the backup then setting the courseid
+            // will filter out all of the user override events (which have a course id of zero).
+            if (!$this->get_setting_value('userinfo')) {
+                $params['courseid'] = backup::VAR_COURSEID;
+            }
+            $event->set_source_table('event', $params);
         } else {
             $event->set_source_table('event', array('courseid' => backup::VAR_COURSEID, 'instance' => backup::VAR_ACTIVITYID, 'modulename' => backup::VAR_MODNAME));
         }
index d4757be..b23fda4 100644 (file)
@@ -2653,6 +2653,16 @@ class restore_calendarevents_structure_step extends restore_structure_step {
         $data = (object)$data;
         $oldid = $data->id;
         $restorefiles = true; // We'll restore the files
+        // User overrides for activities are identified by having a courseid of zero with
+        // both a modulename and instance value set.
+        $isuseroverride = !$data->courseid && $data->modulename && $data->instance;
+
+        // If we don't want to include user data and this record is a user override event
+        // for an activity then we should not create it.
+        if (!$this->task->get_setting_value('userinfo') && $isuseroverride) {
+            return;
+        }
+
         // Find the userid and the groupid associated with the event.
         $data->userid = $this->get_mappingid('user', $data->userid);
         if ($data->userid === false) {
@@ -2688,18 +2698,23 @@ class restore_calendarevents_structure_step extends restore_structure_step {
                 'name'           => $data->name,
                 'description'    => $data->description,
                 'format'         => $data->format,
-                'courseid'       => $this->get_courseid(),
+                // User overrides in activities use a course id of zero. All other event types
+                // must use the mapped course id.
+                'courseid'       => $data->courseid ? $this->get_courseid() : 0,
                 'groupid'        => $data->groupid,
                 'userid'         => $data->userid,
                 'repeatid'       => $this->get_mappingid('event', $data->repeatid),
                 'modulename'     => $data->modulename,
+                'type'           => $data->type,
                 'eventtype'      => $data->eventtype,
                 'timestart'      => $this->apply_date_offset($data->timestart),
                 'timeduration'   => $data->timeduration,
+                'timesort'       => $this->apply_date_offset($data->timesort),
                 'visible'        => $data->visible,
                 'uuid'           => $data->uuid,
                 'sequence'       => $data->sequence,
-                'timemodified'    => $this->apply_date_offset($data->timemodified));
+                'timemodified'   => $this->apply_date_offset($data->timemodified),
+                'priority'       => $data->priority);
         if ($this->name == 'activity_calendar') {
             $params['instance'] = $this->task->get_activityid();
         } else {
@@ -2710,10 +2725,11 @@ class restore_calendarevents_structure_step extends restore_structure_step {
                  WHERE " . $DB->sql_compare_text('name', 255) . " = " . $DB->sql_compare_text('?', 255) . "
                    AND courseid = ?
                    AND modulename = ?
+                   AND instance = ?
                    AND timestart = ?
                    AND timeduration = ?
                    AND " . $DB->sql_compare_text('description', 255) . " = " . $DB->sql_compare_text('?', 255);
-        $arg = array ($params['name'], $params['courseid'], $params['modulename'], $params['timestart'], $params['timeduration'], $params['description']);
+        $arg = array ($params['name'], $params['courseid'], $params['modulename'], $params['instance'], $params['timestart'], $params['timeduration'], $params['description']);
         $result = $DB->record_exists_sql($sql, $arg);
         if (empty($result)) {
             $newitemid = $DB->insert_record('event', $params);
@@ -5512,4 +5528,4 @@ class restore_completion_defaults_structure_step extends restore_structure_step
         // Save id mapping for restoring associated events.
         $this->set_mapping('course_completion_defaults', $oldid, $newid);
     }
-}
\ No newline at end of file
+}
index 5b09911..7346c3c 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
index e5e15b3..435c00e 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;               // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;               // Requires this Moodle version.
+$plugin->version   = 2017051500;               // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;               // Requires this Moodle version.
 $plugin->component = 'block_activity_results'; // Full name of the plugin (used for diagnostics).
\ No newline at end of file
index 1226edd..50208ad 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_admin_bookmarks'; // Full name of the plugin (used for diagnostics)
index d01b98b..59917c8 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;        // Requires this Moodle version.
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;        // Requires this Moodle version.
 $plugin->component = 'block_badges';
index 605d79d..1e225ab 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_blog_menu'; // Full name of the plugin (used for diagnostics)
index 14d8d30..2b6b773 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_blog_recent'; // Full name of the plugin (used for diagnostics)
index 98cf76a..7966baa 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_blog_tags'; // Full name of the plugin (used for diagnostics)
index d888aee..e61045b 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_calendar_month'; // Full name of the plugin (used for diagnostics)
index 8d62a1a..2552569 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_calendar_upcoming'; // Full name of the plugin (used for diagnostics)
index a2f40fe..7a7a250 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_comments'; // Full name of the plugin (used for diagnostics)
index b616365..565b9d6 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_community'; // Full name of the plugin (used for diagnostics)
index 6096abd..dcf22e2 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version      = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires     = 2016112900; // Requires this Moodle version.
+$plugin->version      = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires     = 2017050500; // Requires this Moodle version.
 $plugin->component    = 'block_completionstatus';
-$plugin->dependencies = array('report_completion' => 2016112900);
+$plugin->dependencies = array('report_completion' => 2017050500);
index fb17904..9b8b4d6 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_course_list'; // Full name of the plugin (used for diagnostics)
index f12aaff..d88f9db 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_course_summary'; // Full name of the plugin (used for diagnostics)
index cda52ce..f2d4afa 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_feedback';  // Full name of the plugin (used for diagnostics)
 
-$plugin->dependencies = array('mod_feedback' => 2016112900);
+$plugin->dependencies = array('mod_feedback' => 2017050500);
index 4748aa3..720f248 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'block_globalsearch';
index 95c3a74..8ff4daa 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_glossary_random'; // Full name of the plugin (used for diagnostics)
 
-$plugin->dependencies = array('mod_glossary' => 2016112900);
+$plugin->dependencies = array('mod_glossary' => 2017050500);
index c7dd028..4775882 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_html';      // Full name of the plugin (used for diagnostics)
index 1aa499e..ab911a2 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_login';     // Full name of the plugin (used for diagnostics)
index 6c48baa..8a56ae6 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;
-$plugin->requires  = 2016112900;
+$plugin->version   = 2017051500;
+$plugin->requires  = 2017050500;
 $plugin->component = 'block_lp';
 $plugin->dependencies = array(
     'tool_lp' => ANY_VERSION
index 360430d..9289290 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_mentees';   // Full name of the plugin (used for diagnostics)
index cbe41ac..9faef4d 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_messages';  // Full name of the plugin (used for diagnostics)
index 0f5e628..95b67a5 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_mnet_hosts'; // Full name of the plugin (used for diagnostics)
index 4abb4fb..055a8b3 100644 (file)
Binary files a/blocks/myoverview/amd/build/event_list_by_course.min.js and b/blocks/myoverview/amd/build/event_list_by_course.min.js differ
index 69fae95..32d52cc 100644 (file)
@@ -33,6 +33,7 @@ function($, EventList, EventsRepository) {
 
     var SELECTORS = {
         EVENTS_BY_COURSE_CONTAINER: '[data-region="course-events-container"]',
+        EVENT_LIST_CONTAINER: '[data-region="event-list-container"]',
     };
 
     /**
@@ -48,9 +49,10 @@ function($, EventList, EventsRepository) {
             return;
         }
 
-        var midnight = root.attr('data-midnight');
+        var eventList = courseBlocks.find(SELECTORS.EVENT_LIST_CONTAINER).first();
+        var midnight = eventList.attr('data-midnight');
         var startTime = midnight - (14 * SECONDS_IN_DAY);
-        var limit = courseBlocks.attr('data-limit');
+        var limit = eventList.attr('data-limit');
         var courseIds = courseBlocks.map(function() {
             return $(this).attr('data-course-id');
         }).get();
index d361f87..8bd3afe 100644 (file)
@@ -24,7 +24,7 @@ Feature: Course overview block show users their progress on courses
     Given I log in as "student1"
     And I click on "Timeline" "link" in the "Course overview" "block"
     When I click on "Sort by courses" "link" in the "Course overview" "block"
-    Then I should see "Choice Test choice 1 closes" in the "Course overview" "block"
+    Then I should see "Choice Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
     And I should not see "0%" in the "Course overview" "block"
     And I click on "Courses" "link" in the "Course overview" "block"
     And I click on "In progress" "link" in the "Course overview" "block"
@@ -44,7 +44,7 @@ Feature: Course overview block show users their progress on courses
     And I log out
     And I log in as "student1"
     And I click on "Sort by courses" "link" in the "Course overview" "block"
-    And I should see "Choice Test choice 1 closes" in the "Course overview" "block"
+    And I should see "Choice Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
     And I should see "0%" in the "Course overview" "block"
     And I click on "Courses" "link" in the "Course overview" "block"
     When I click on "In progress" "link" in the "Course overview" "block"
index 682aeed..fd45f77 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016122000;         // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires  = 2016112900;         // Requires this Moodle version.
+$plugin->version   = 2017051500;         // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2017050500;         // Requires this Moodle version.
 $plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).
index 06ddbb1..c60b963 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_myprofile'; // Full name of the plugin (used for diagnostics)
index f815e1b..4b0fb24 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_navigation'; // Full name of the plugin (used for diagnostics)
index 6e670bc..31a5fe2 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;         // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;         // Requires this Moodle version
+$plugin->version   = 2017051500;         // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;         // Requires this Moodle version
 $plugin->component = 'block_news_items'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_forum' => 2016112900);
+$plugin->dependencies = array('mod_forum' => 2017050500);
index 28be900..06fa65a 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_online_users'; // Full name of the plugin (used for diagnostics)
index eabb5ac..2685a32 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_participants'; // Full name of the plugin (used for diagnostics)
index a4af1e2..e96bb91 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_private_files'; // Full name of the plugin (used for diagnostics)
index 3414a3a..78a2a5f 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_quiz_results'; // Full name of the plugin (used for diagnostics)
 
-$plugin->dependencies = array('mod_quiz' => 2016112900);
+$plugin->dependencies = array('mod_quiz' => 2017050500);
index 9bb0314..c42120c 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_recent_activity'; // Full name of the plugin (used for diagnostics)
 $plugin->cron      = 24*3600;           // Cron interval 1 day.
\ No newline at end of file
index 5875191..8c3f02c 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_rss_client'; // Full name of the plugin (used for diagnostics)
 $plugin->cron      = 300;               // Set min time between cron executions to 300 secs (5 mins)
index 4130645..36161f0 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_search_forums'; // Full name of the plugin (used for diagnostics)
 
-$plugin->dependencies = array('mod_forum' => 2016112900);
+$plugin->dependencies = array('mod_forum' => 2017050500);
index d060b0f..e1aaf6e 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_section_links'; // Full name of the plugin (used for diagnostics)
index 579700d..4424755 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_selfcompletion'; // Full name of the plugin (used for diagnostics)
index 8e4dab4..42cac99 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_settings';  // Full name of the plugin (used for diagnostics)
index 3be64db..511dc12 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_site_main_menu'; // Full name of the plugin (used for diagnostics)
index b4131a8..2e6da63 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_social_activities'; // Full name of the plugin (used for diagnostics)
index 92c3869..0f7901c 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_tag_flickr'; // Full name of the plugin (used for diagnostics)
index cfe0175..b50afb7 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_tag_youtube'; // Full name of the plugin (used for diagnostics)
index 0ba23b7..bf75450 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'block_tags';      // Full name of the plugin (used for diagnostics)
index 5cae773..de2b012 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016120500;        // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;        // Requires this Moodle version
+$plugin->version   = 2017051500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;        // Requires this Moodle version
 $plugin->component = 'cachelock_file';  // Full name of the plugin (used for diagnostics)
index 038acb5..c795791 100644 (file)
@@ -24,7 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version = 2016120500;
-$plugin->requires = 2016112900;
+$plugin->version = 2017051500;
+$plugin->requires = 2017050500;
 $plugin->maturity = MATURITY_STABLE;
 $plugin->component = 'cachestore_apcu';
index e6a72de..735880d 100644 (file)
@@ -27,6 +27,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2016112900;    // Requires this Moodle version.
+$plugin->version = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_file';  // Full name of the plugin.
\ No newline at end of file
index e3fa26c..34d07e5 100644 (file)
@@ -26,6 +26,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2016112900;    // Requires this Moodle version.
+$plugin->version = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_memcache';  // Full name of the plugin.
index b01b9af..421c20b 100644 (file)
@@ -26,6 +26,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;    // Requires this Moodle version.
+$plugin->version   = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_memcached';  // Full name of the plugin.
\ No newline at end of file
index 467a3cc..4a18e16 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;    // Requires this Moodle version.
+$plugin->version   = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_mongodb';  // Full name of the plugin.
\ No newline at end of file
index 3a8afba..3159f90 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version    = 2017031900;
-$plugin->requires   = 2016112900; // Requires this Moodle version (3.0.4).
+$plugin->version    = 2017051500;
+$plugin->requires   = 2017050500; // Requires this Moodle version (3.0.4).
 $plugin->maturity   = MATURITY_STABLE;
 $plugin->component  = 'cachestore_redis';
 $plugin->release    = '3.0.4 (Build: 20160509)';
index 09a3790..48d7bcd 100644 (file)
@@ -27,6 +27,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2016112900;    // Requires this Moodle version.
+$plugin->version = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_session';  // Full name of the plugin.
\ No newline at end of file
index d133a99..6a0d65b 100644 (file)
@@ -27,6 +27,6 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2016120500;    // The current module version (Date: YYYYMMDDXX)
-$plugin->requires  = 2016112900;    // Requires this Moodle version.
+$plugin->version   = 2017051500;    // The current module version (Date: YYYYMMDDXX)
+$plugin->requires  = 2017050500;    // Requires this Moodle version.
 $plugin->component = 'cachestore_static';  // Full name of the plugin.
\ No newline at end of file
index bb88a5c..083b19c 100644 (file)
@@ -147,7 +147,16 @@ class container {
                     $cm = $instances[$dbrow->modulename][$dbrow->instance];
 
                     // If the module is not visible to the current user, we should ignore it.
-                    if (!$cm->uservisible) {
+                    // We have to check enrolment here as well because the uservisible check
+                    // looks for the "view" capability however some activities (such as Lesson)
+                    // have that capability set on the "Authenticated User" role rather than
+                    // on "Student" role, which means uservisible returns true even when the user
+                    // is no longer enrolled in the course.
+                    $modulecontext = \context_module::instance($cm->id);
+                    // A user with the 'moodle/course:view' capability is able to see courses
+                    // that they are not a participant in.
+                    $canseecourse = (has_capability('moodle/course:view', $modulecontext) || is_enrolled($modulecontext));
+                    if (!$cm->uservisible || !$canseecourse) {
                         return true;
                     }
 
index eaed118..c24c5f8 100644 (file)
@@ -252,7 +252,7 @@ class event_vault implements event_vault_interface {
                 true,
                 true,
                 function ($event) use ($course) {
-                    return $event instanceof action_event_interface && $event->get_course()->get_id() == $course->id;
+                    return $event instanceof action_event_interface && $event->get_course()->get('id') == $course->id;
                 }
             )
         );
@@ -348,11 +348,6 @@ class event_vault implements event_vault_interface {
      * @return event_interface|null
      */
     protected function transform_from_database_record(\stdClass $record) {
-        if ($record->courseid == 0 && $record->instance && $record->modulename) {
-            list($course, $cm) = get_course_and_cm_from_instance($record->instance, $record->modulename);
-            $record->courseid = $course->id;
-        }
-
         return $this->factory->create_instance($record);
     }
 
index a277901..192e75d 100644 (file)
@@ -24,6 +24,8 @@
 
 namespace core_calendar\local\event\entities;
 
+use core_calendar\local\event\proxies\proxy_interface;
+
 defined('MOODLE_INTERNAL') || die();
 
 /**
index c3520f4..2695d93 100644 (file)
@@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die();
 use core_calendar\local\event\entities\event;
 use core_calendar\local\event\entities\repeat_event_collection;
 use core_calendar\local\event\exceptions\invalid_callback_exception;
-use core_calendar\local\event\proxies\module_std_proxy;
+use core_calendar\local\event\proxies\cm_info_proxy;
 use core_calendar\local\event\proxies\std_proxy;
 use core_calendar\local\event\value_objects\event_description;
 use core_calendar\local\event\value_objects\event_times;
@@ -107,6 +107,12 @@ abstract class event_abstract_factory implements event_factory_interface {
     }
 
     public function create_instance(\stdClass $dbrow) {
+        if ($dbrow->modulename && $dbrow->instance && $dbrow->courseid == 0) {
+            // Some events (for example user overrides) may contain module instance but not course id. Find course id.
+            $cm = calendar_get_module_cached($this->modulecachereference, $dbrow->modulename, $dbrow->instance);
+            $dbrow->courseid = $cm->course;
+        }
+
         $bailcheck = $this->bailoutcheck;
         $bail = $bailcheck($dbrow);
 
@@ -126,9 +132,8 @@ abstract class event_abstract_factory implements event_factory_interface {
         $module = null;
         $subscription = null;
 
-        if ($dbrow->courseid == 0 && !empty($dbrow->modulename)) {
-            $cm = get_coursemodule_from_instance($dbrow->modulename, $dbrow->instance);
-            $dbrow->courseid = get_course($cm->course)->id;
+        if ($dbrow->modulename && $dbrow->instance) {
+            $module = new cm_info_proxy($dbrow->modulename, $dbrow->instance, $dbrow->courseid);
         }
 
         $course = new std_proxy($dbrow->courseid, function($id) {
@@ -148,20 +153,6 @@ abstract class event_abstract_factory implements event_factory_interface {
             });
         }
 
-        if ($dbrow->instance && !empty($dbrow->modulename)) {
-            $module = new module_std_proxy(
-                $dbrow->modulename,
-                $dbrow->instance,
-                function($modulename, $instance) {
-                    return calendar_get_module_cached(
-                        $this->modulecachereference,
-                        $modulename,
-                        $instance
-                    );
-                }
-            );
-        }
-
         if ($dbrow->subscriptionid) {
             $subscription = new std_proxy($dbrow->subscriptionid, function($id) {
                 return calendar_get_subscription($id);
index ae50e7d..a4191f2 100644 (file)
@@ -103,9 +103,9 @@ class event_mapper implements event_mapper_interface {
             'name'             => $event->get_name(),
             'description'      => $event->get_description()->get_value(),
             'format'           => $event->get_description()->get_format(),
-            'courseid'         => $event->get_course() ? $event->get_course()->get_id() : null,
-            'groupid'          => $event->get_group() ? $event->get_group()->get_id() : null,
-            'userid'           => $event->get_user() ? $event->get_user()->get_id() : null,
+            'courseid'         => $event->get_course() ? $event->get_course()->get('id') : null,
+            'groupid'          => $event->get_group() ? $event->get_group()->get('id') : null,
+            'userid'           => $event->get_user() ? $event->get_user()->get('id') : null,
             'repeatid'         => $event->get_repeats()->get_id(),
             'modulename'       => $event->get_course_module() ? $event->get_course_module()->get('modname') : null,
             'instance'         => $event->get_course_module() ? $event->get_course_module()->get('instance') : null,
@@ -115,7 +115,7 @@ class event_mapper implements event_mapper_interface {
             'timesort'         => $event->get_times()->get_sort_time()->getTimestamp(),
             'visible'          => $event->is_visible() ? 1 : 0,
             'timemodified'     => $event->get_times()->get_modified_time()->getTimestamp(),
-            'subscriptionid'   => $event->get_subscription() ? $event->get_subscription()->get_id() : null,
+            'subscriptionid'   => $event->get_subscription() ? $event->get_subscription()->get('id') : null,
             'actionname'       => $action ? $action->get_name() : null,
             'actionurl'        => $action ? $action->get_url() : null,
             'actionnum'        => $action ? $action->get_item_count() : null,
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Course module stdClass proxy.
+ * Course module cm_info proxy.
  *
  * @package    core_calendar
  * @copyright  2017 Cameron Ball <cameron@cameron1729.xyz>
@@ -38,27 +38,46 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class module_std_proxy extends std_proxy implements proxy_interface {
+class cm_info_proxy implements proxy_interface {
+    /** @var \stdClass */
+    protected $base;
+    /** @var  \cm_info */
+    protected $cm;
+
+    /**
+     * cm_info_proxy constructor.
+     *
+     * @param string $modname The module name.
+     * @param int $instance The module instance.
+     * @param int $courseid course id this module belongs to
+     */
+    public function __construct($modname, $instance, $courseid) {
+        $this->base = (object)['course' => $courseid, 'modname' => $modname, 'instance' => $instance];
+    }
 
     /**
-     * module_std_proxy constructor.
+     * Retrieve a member of the proxied class.
      *
-     * @param int $modulename The module name.
-     * @param callable $instance The module instance.
-     * @param callable $callback Callback to load the class.
-     * @param \stdClass $base Class containing base values.
+     * @param string $member The name of the member to retrieve
+     * @return mixed The member.
      */
-    public function __construct($modulename, $instance, callable $callback, \stdClass $base = null) {
-        $this->modulename = $modulename;
-        $this->instance = $instance;
-        $this->callbackargs = [$modulename, $instance];
-        $this->callback = $callback;
-        $this->base = $base = is_null($base) ? new \stdClass() : $base;
-        $this->base->modulename = $modulename;
-        $this->base->instance = $instance;
+    public function get($member) {
+        if ($this->base && property_exists($this->base, $member)) {
+            return $this->base->{$member};
+        }
+
+        return $this->get_proxied_instance()->{$member};
     }
 
-    public function get_id() {
-        return $this->get_proxied_instance()->id;
+    /**
+     * Get the full instance of the proxied class.
+     *
+     * @return \stdClass
+     */
+    public function get_proxied_instance() {
+        if (!$this->cm) {
+            $this->cm = get_fast_modinfo($this->base->course)->instances[$this->base->modname][$this->base->instance];
+        }
+        return $this->cm;
     }
 }
index 6869fd8..d6ed021 100644 (file)
@@ -43,23 +43,6 @@ interface proxy_interface {
      */
     public function get($member);
 
-    /**
-     * Retrieve the ID of the proxied class.
-     * @return int The proxied class' ID.
-     */
-    public function get_id();
-
-    /**
-     * Set a member of the proxied class.
-     *
-     * @param string $member The name of the member to set
-     * @param mixed  $value  The value to set the member to
-     * @throws \core_calendar\local\event\exceptions\member_does_not_exist_exception If the proxied class does not have the
-     *                                                                               requested member.
-     * @return void
-     */
-    public function set($member, $value);
-
     /**
      * Get the full instance of the proxied class.
      *
index e94746d..04c892d 100644 (file)
@@ -78,13 +78,9 @@ class std_proxy implements proxy_interface {
         $this->base = $base;
     }
 
-    public function get_id() {
-        return $this->id;
-    }
-
     public function get($member) {
         if ($member === 'id') {
-            return $this->get_id();
+            return $this->id;
         }
 
         if ($this->base && property_exists($this->base, $member)) {
@@ -98,14 +94,6 @@ class std_proxy implements proxy_interface {
         return $this->get_proxied_instance()->{$member};
     }
 
-    public function set($member, $value) {
-        if (!property_exists($this->get_proxied_instance(), $member)) {
-            throw new member_does_not_exist_exception(sprintf('Member %s does not exist', $member));
-        }
-
-        $this->get_proxied_instance()->{$member} = $value;
-    }
-
     public function get_proxied_instance() {
         $callback = $this->callback;
         return $this->class = $this->class ? $this->class : $callback(...$this->callbackargs);
index ea8e184..c746671 100644 (file)
@@ -24,6 +24,7 @@
 
 namespace core_calendar;
 
+use calendar_event;
 use DateInterval;
 use DateTime;
 use moodle_exception;
@@ -223,7 +224,7 @@ class rrule_manager {
     /**
      * Create events for specified rrule.
      *
-     * @param \calendar_event $passedevent Properties of event to create.
+     * @param calendar_event $passedevent Properties of event to create.
      * @throws moodle_exception
      */
     public function create_events($passedevent) {
@@ -243,13 +244,16 @@ class rrule_manager {
         // Generate timestamps that obey the rrule.
         $eventtimes = $this->generate_recurring_event_times($eventrec);
 
-        // Adjust the parent event's timestart, if necessary.
+        // Update the parent event. Make sure that its repeat ID is the same as its ID.
+        $calevent = new calendar_event($eventrec);
+        $updatedata = new stdClass();
+        $updatedata->repeatid = $event->id;
+        // Also, adjust the parent event's timestart, if necessary.
         if (count($eventtimes) > 0 && !in_array($eventrec->timestart, $eventtimes)) {
-            $calevent = new \calendar_event($eventrec);
-            $updatedata = (object)['timestart' => $eventtimes[0], 'repeatid' => $eventrec->id];
-            $calevent->update($updatedata, false);
-            $eventrec->timestart = $calevent->timestart;
+            $updatedata->timestart = reset($eventtimes);
         }
+        $calevent->update($updatedata, false);
+        $eventrec->timestart = $calevent->timestart;
 
         // Create the recurring calendar events.
         $this->create_recurring_events($eventrec, $eventtimes);
@@ -719,7 +723,9 @@ class rrule_manager {
             $cloneevent->repeatid = $event->id;
             $cloneevent->timestart = $time;
             unset($cloneevent->id);
-            \calendar_event::create($cloneevent, false);
+            // UUID should only be set on the first instance of the recurring events.
+            unset($cloneevent->uuid);
+            calendar_event::create($cloneevent, false);
         }
 
         // If COUNT rule is defined and the number of the generated event times is less than the the COUNT rule,
index add05a5..a711b76 100644 (file)
@@ -185,9 +185,9 @@ $events = calendar_get_legacy_events($timestart, $timeend, $users, $groups, arra
 $ical = new iCalendar;
 $ical->add_property('method', 'PUBLISH');
 foreach($events as $event) {
-   if (!empty($event->modulename)) {
-        $cm = get_coursemodule_from_instance($event->modulename, $event->instance);
-        if (!\core_availability\info_module::is_user_visible($cm, $userid, false)) {
+    if (!empty($event->modulename)) {
+        $instances = get_fast_modinfo($event->courseid, $userid)->get_instances_of($event->modulename);
+        if (empty($instances[$event->instance]->uservisible)) {
             continue;
         }
     }
index 074f0e0..bf0855b 100644 (file)
@@ -254,8 +254,15 @@ class core_calendar_external extends external_api {
                 // User can see everything, no further check is needed.
                 $events[$eventid] = $event;
             } else if (!empty($eventobj->modulename)) {
-                $cm = get_coursemodule_from_instance($eventobj->modulename, $eventobj->instance);
-                if (\core_availability\info_module::is_user_visible($cm, 0, false)) {
+                $courseid = $eventobj->courseid;
+                if (!$courseid) {
+                    if (!$calendareventobj->context || !($context = $calendareventobj->context->get_course_context(false))) {
+                        continue;
+                    }
+                    $courseid = $context->instanceid;
+                }
+                $instances = get_fast_modinfo($courseid)->get_instances_of($eventobj->modulename);
+                if (!empty($instances[$eventobj->instance]->uservisible)) {
                     $events[$eventid] = $event;
                 }
             } else {
index f75cc9e..1d5c19b 100644 (file)
@@ -1309,8 +1309,8 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
     if (!empty($events)) {
         foreach ($events as $eventid => $event) {
             if (!empty($event->modulename)) {
-                $cm = get_coursemodule_from_instance($event->modulename, $event->instance);
-                if (!\core_availability\info_module::is_user_visible($cm, 0, false)) {
+                $instances = get_fast_modinfo($event->courseid)->get_instances_of($event->modulename);
+                if (empty($instances[$event->instance]->uservisible)) {
                     unset($events[$eventid]);
                 }
             }
@@ -1635,23 +1635,11 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
     }
 
     if ($events !== false) {
-        $modinfo = get_fast_modinfo($COURSE);
         foreach ($events as $event) {
             if (!empty($event->modulename)) {
-                if ($event->courseid == $COURSE->id) {
-                    if (isset($modinfo->instances[$event->modulename][$event->instance])) {
-                        $cm = $modinfo->instances[$event->modulename][$event->instance];
-                        if (!$cm->uservisible) {
-                            continue;
-                        }
-                    }
-                } else {
-                    if (!$cm = get_coursemodule_from_instance($event->modulename, $event->instance)) {
-                        continue;
-                    }
-                    if (!\core_availability\info_module::is_user_visible($cm, 0, false)) {
-                        continue;
-                    }
+                $instances = get_fast_modinfo($event->courseid)->get_instances_of($event->modulename);
+                if (empty($instances[$event->instance]->uservisible)) {
+                    continue;
                 }
             }
 
@@ -1671,18 +1659,20 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
 /**
  * Get a HTML link to a course.
  *
- * @param int $courseid the course id
+ * @param int|stdClass $course the course id or course object
  * @return string a link to the course (as HTML); empty if the course id is invalid
  */
-function calendar_get_courselink($courseid) {
-    if (!$courseid) {
+function calendar_get_courselink($course) {
+    if (!$course) {
         return '';
     }
 
-    calendar_get_course_cached($coursecache, $courseid);
-    $context = \context_course::instance($courseid);
-    $fullname = format_string($coursecache[$courseid]->fullname, true, array('context' => $context));
-    $url = new \moodle_url('/course/view.php', array('id' => $courseid));
+    if (!is_object($course)) {
+        $course = calendar_get_course_cached($coursecache, $course);
+    }
+    $context = \context_course::instance($course->id);
+    $fullname = format_string($course->fullname, true, array('context' => $context));
+    $url = new \moodle_url('/course/view.php', array('id' => $course->id));
     $link = \html_writer::link($url, $fullname);
 
     return $link;
@@ -1691,6 +1681,9 @@ function calendar_get_courselink($courseid) {
 /**
  * Get current module cache.
  *
+ * Only use this method if you do not know courseid. Otherwise use:
+ * get_fast_modinfo($courseid)->instances[$modulename][$instance]
+ *
  * @param array $modulecache in memory module cache
  * @param string $modulename name of the module
  * @param int $instance module instance number
@@ -1747,26 +1740,25 @@ function calendar_add_event_metadata($event) {
     if (!empty($event->modulename)) { // Activity event.
         // The module name is set. I will assume that it has to be displayed, and
         // also that it is an automatically-generated event. And of course that the
-        // fields for get_coursemodule_from_instance are set correctly.
-        $module = calendar_get_module_cached($coursecache, $event->modulename, $event->instance);
-
-        if ($module === false) {
+        // instace id and modulename are set correctly.
+        $instances = get_fast_modinfo($event->courseid)->get_instances_of($event->modulename);
+        if (!array_key_exists($event->instance, $instances)) {
             return;
         }
+        $module = $instances[$event->instance];
 
-        $modulename = get_string('modulename', $event->modulename);
+        $modulename = $module->get_module_type_name(false);
         if (get_string_manager()->string_exists($event->eventtype, $event->modulename)) {
             // Will be used as alt text if the event icon.
             $eventtype = get_string($event->eventtype, $event->modulename);
         } else {
             $eventtype = '';
         }
-        $icon = $OUTPUT->image_url('icon', $event->modulename) . '';
 
-        $event->icon = '<img src="' . $icon . '" alt="' . $eventtype . '" title="' . $modulename . '" class="icon" />';
-        $event->referer = '<a href="' . $CFG->wwwroot . '/mod/' . $event->modulename . '/view.php?id=' .
-            $module->id . '">' . $event->name . '</a>';
-        $event->courselink = calendar_get_courselink($module->course);
+        $event->icon = '<img src="' . s($module->get_icon_url()) . '" alt="' . s($eventtype) .
+            '" title="' . s($modulename) . '" class="icon" />';
+        $event->referer = html_writer::link($module->url, $event->name);
+        $event->courselink = calendar_get_courselink($module->get_course());
         $event->cmid = $module->id;
     } else if ($event->courseid == SITEID) { // Site event.
         $event->icon = '<img src="' . $OUTPUT->image_url('i/siteevent') . '" alt="' .
index ed4bcef..8abfb03 100644 (file)
@@ -381,8 +381,8 @@ class core_calendar_renderer extends plugin_renderer_base {
             foreach($events as $eventid => $event) {
                 $event = new calendar_event($event);
                 if (!empty($event->modulename)) {
-                    $cm = get_coursemodule_from_instance($event->modulename, $event->instance);
-                    if (!\core_availability\info_module::is_user_visible($cm, 0, false)) {
+                    $instances = get_fast_modinfo($event->courseid)->get_instances_of($event->modulename);
+                    if (empty($instances[$event->instance]->uservisible)) {
                         unset($events[$eventid]);
                     }
                 }
diff --git a/calendar/tests/cm_info_proxy_test.php b/calendar/tests/cm_info_proxy_test.php
new file mode 100644 (file)
index 0000000..95aba86
--- /dev/null
@@ -0,0 +1,59 @@
+<?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/>.
+
+/**
+ * cm_info_proxy tests.
+ *
+ * @package    core_calendar
+ * @copyright  2017 Cameron Ball <cameron@cameron1729.xyz>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+use core_calendar\local\event\proxies\cm_info_proxy;
+
+/**
+ * cm_info_proxy testcase.
+ *
+ * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class core_calendar_cm_info_proxy_testcase extends advanced_testcase {
+
+    /**
+     * Test creating cm_info_std_proxy, using getter and setter.
+     */
+    public function test_proxy() {
+        $this->resetAfterTest(true);
+
+        $course = $this->getDataGenerator()->create_course();
+        $module = $this->getDataGenerator()->create_module('forum',
+            ['course' => $course->id, 'idnumber' => '123456']);
+        $proxy = new cm_info_proxy(
+            'forum',
+            $module->id,
+            $course->id
+        );
+
+        $this->assertEquals('forum', $proxy->get('modname'));
+        $this->assertEquals($module->id, $proxy->get('instance'));
+        $this->assertEquals($course->id, $proxy->get('course'));
+        $this->assertEquals('123456', $proxy->get('idnumber'));
+        $this->assertEquals($module->cmid, $proxy->get('id'));
+        $this->assertEquals('123456', $proxy->get_proxied_instance()->idnumber);
+    }
+}
index 8f4f5a7..23a4108 100644 (file)
@@ -99,15 +99,15 @@ class core_calendar_container_testcase extends advanced_testcase {
         $this->assertEquals($legacyevent->id, $event->get_id());
         $this->assertEquals($dbrow->description, $event->get_description()->get_value());
         $this->assertEquals($dbrow->format, $event->get_description()->get_format());
-        $this->assertEquals($dbrow->courseid, $event->get_course()->get_id());
+        $this->assertEquals($dbrow->courseid, $event->get_course()->get('id'));
 
         if ($dbrow->groupid == 0) {
             $this->assertNull($event->get_group());
         } else {
-            $this->assertEquals($dbrow->groupid, $event->get_group()->get_id());
+            $this->assertEquals($dbrow->groupid, $event->get_group()->get('id'));
         }
 
-        $this->assertEquals($dbrow->userid, $event->get_user()->get_id());
+        $this->assertEquals($dbrow->userid, $event->get_user()->get('id'));
         $this->assertEquals($legacyevent->id, $event->get_repeats()->get_id());
         $this->assertEquals($dbrow->modulename, $event->get_course_module()->get('modname'));
         $this->assertEquals($dbrow->instance, $event->get_course_module()->get('instance'));
@@ -124,7 +124,7 @@ class core_calendar_container_testcase extends advanced_testcase {
         if (!$dbrow->subscriptionid) {
             $this->assertNull($event->get_subscription());
         } else {
-            $this->assertEquals($event->get_subscription()->get_id());
+            $this->assertEquals($event->get_subscription()->get('id'));
         }
     }
 
@@ -233,6 +233,58 @@ class core_calendar_container_testcase extends advanced_testcase {
         $this->assertNull($factory->create_instance($event));
     }
 
+    /**
+     * Test that the event factory only returns an event if the logged in user
+     * is enrolled in the course.
+     */
+    public function test_event_factory_unenrolled_user() {
+        $user = $this->getDataGenerator()->create_user();
+        // Create the course we will be using.
+        $course = $this->getDataGenerator()->create_course();
+
+        // Add the assignment.
+        $generator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
+        $lesson = $generator->create_instance(array('course' => $course->id));
+
+        // Create a user override event for the lesson.
+        $event = new \stdClass();
+        $event->name = 'An event';
+        $event->description = 'Event description';
+        $event->format = FORMAT_HTML;
+        $event->eventtype = 'close';
+        $event->userid = $user->id;
+        $event->modulename = 'lesson';
+        $event->instance = $lesson->id;
+        $event->courseid = $course->id;
+        $event->groupid = 0;
+        $event->timestart = time();
+        $event->timesort = time();
+        $event->timemodified = time();
+        $event->timeduration = 0;
+        $event->subscriptionid = null;
+        $event->repeatid = 0;
+        $legacyevent = $this->create_event($event);
+
+        // Update the id of the event that was created.
+        $event->id = $legacyevent->id;
+
+        // Set the logged in user to the one we created.
+        $this->setUser($user);
+
+        // Create the factory we are going to be testing the behaviour of.
+        $factory = \core_calendar\local\event\container::get_event_factory();
+
+        // The result should be null since the user is not enrolled in the
+        // course the event is for.
+        $this->assertNull($factory->create_instance($event));
+
+        // Now enrol the user in the course.
+        $this->getDataGenerator()->enrol_user($user->id, $course->id);
+
+        // Check that we get the correct instance.
+        $this->assertInstanceOf(event_interface::class, $factory->create_instance($event));
+    }
+
     /**
      * Test getting the event mapper.
      */
index b2f3039..2cd22ea 100644 (file)
@@ -312,7 +312,7 @@ class core_calendar_event_factory_testcase extends advanced_testcase {
                 'name' => 'test',
                 'description' => 'Test description',
                 'format' => 2,
-                'courseid' => $course->id,
+                'courseid' => 0,
                 'groupid' => 1,
                 'userid' => 1,
                 'repeatid' => 0,
index 8d99c57..0071a50 100644 (file)
@@ -382,16 +382,12 @@ class event_mapper_test_proxy implements proxy_interface {
     }
 
     public function get($member) {
+        if ($member === 'id') {
+            return $this->id;
+        }
         return isset($params[$member]) ? $params[$member] : null;
     }
 
-    public function get_id() {
-        return $this->id;
-    }
-
-    public function set($member, $value) {
-    }
-
     public function get_proxied_instance() {
     }
 }
index 62f9336..9912bcc 100644 (file)
@@ -100,7 +100,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
             if (!empty($userid)) {
                 $prop->userid = $userid;
             } else {
-                return false;
+                $prop->userid = 0;
             }
         }
         if (!isset($prop->courseid)) {
@@ -669,6 +669,69 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $this->assertNull($result['lastid']);
     }
 
+    /**
+     * Test retrieving event that was overridden for a user
+     */
+    public function test_get_calendar_events_override() {
+        $user = $this->getDataGenerator()->create_user();
+        $teacher = $this->getDataGenerator()->create_user();
+        $anotheruser = $this->getDataGenerator()->create_user();
+        $course = $this->getDataGenerator()->create_course();
+        $generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
+        $moduleinstance = $generator->create_instance(['course' => $course->id]);
+
+        $this->getDataGenerator()->enrol_user($user->id, $course->id);
+        $this->getDataGenerator()->enrol_user($teacher->id, $course->id, 'editingteacher');
+        $this->resetAfterTest(true);
+        $this->setAdminUser();
+
+        $params = [
+            'type' => CALENDAR_EVENT_TYPE_ACTION,
+            'modulename' => 'assign',
+            'instance' => $moduleinstance->id,
+        ];
+
+        $now = time();
+        $event1 = $this->create_calendar_event('Base event', 0, 'due', 0, $now + DAYSECS, $params + ['courseid' => $course->id]);
+        $event2 = $this->create_calendar_event('User event', $user->id, 'due', 0, $now + 2*DAYSECS, $params + ['courseid' => 0]);
+
+        // Retrieve course events for teacher - only one "Base event" is returned.
+        $this->setUser($teacher);
+        $paramevents = array('courseids' => array($course->id));
+        $options = array ('siteevents' => true, 'userevents' => true);
+        $events = core_calendar_external::get_calendar_events($paramevents, $options);
+        $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
+        $this->assertEquals(1, count($events['events']));
+        $this->assertEquals(0, count($events['warnings']));
+        $this->assertEquals('Base event', $events['events'][0]['name']);
+
+        // Retrieve events for user - both events are returned.
+        $this->setUser($user);
+        $events = core_calendar_external::get_calendar_events($paramevents, $options);
+        $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
+        $this->assertEquals(2, count($events['events']));
+        $this->assertEquals(0, count($events['warnings']));
+        $this->assertEquals('Base event', $events['events'][0]['name']);
+        $this->assertEquals('User event', $events['events'][1]['name']);
+
+        // Retrieve events by id as a teacher, 'User event' should be returned since teacher has access to this course.
+        $this->setUser($teacher);
+        $paramevents = ['eventids' => [$event2->id]];
+        $events = core_calendar_external::get_calendar_events($paramevents, $options);
+        $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
+        $this->assertEquals(1, count($events['events']));
+        $this->assertEquals(0, count($events['warnings']));
+        $this->assertEquals('User event', $events['events'][0]['name']);
+
+        // Retrieve events by id as another user, nothing should be returned.
+        $this->setUser($anotheruser);
+        $paramevents = ['eventids' => [$event2->id, $event1->id]];
+        $events = core_calendar_external::get_calendar_events($paramevents, $options);
+        $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
+        $this->assertEquals(0, count($events['events']));
+        $this->assertEquals(0, count($events['warnings']));
+    }
+
     /**
      * Requesting calendar events within a given time range should return all events with
      * a sort time between the lower and upper time bound (inclusive).
index c990d4d..f8e08fb 100644 (file)
@@ -32,6 +32,7 @@ use core_calendar\local\event\entities\action_event;
 use core_calendar\local\event\entities\event;
 use core_calendar\local\event\entities\repeat_event_collection;
 use core_calendar\local\event\proxies\std_proxy;
+use core_calendar\local\event\proxies\cm_info_proxy;
 use core_calendar\local\event\value_objects\action;
 use core_calendar\local\event\value_objects\event_description;
 use core_calendar\local\event\value_objects\event_times;
@@ -94,14 +95,7 @@ class action_event_test_factory implements event_factory_interface {
         $subscription = null;
 
         if ($record->instance && $record->modulename) {
-            $modulename = $record->modulename;
-            $module = new std_proxy($record->instance, function($id) use ($modulename) {
-                return get_coursemodule_from_instance($modulename, $id);
-            },
-            (object)[
-                'modname' => $modulename,
-                'instance' => $record->instance
-            ]);
+            $module = new cm_info_proxy($record->instance, $record->modulename, $record->courseid);
         }
 
         if ($record->subscriptionid) {
diff --git a/calendar/tests/module_std_proxy_test.php b/calendar/tests/module_std_proxy_test.php
deleted file mode 100644 (file)
index c279eec..0000000
+++ /dev/null
@@ -1,219 +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/>.
-
-/**
- * module_std_proxy tests.
- *
- * @package    core_calendar
- * @copyright  2017 Cameron Ball <cameron@cameron1729.xyz>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-use core_calendar\local\event\proxies\module_std_proxy;
-
-/**
- * std_proxy testcase.
- *
- * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class core_calendar_module_std_proxy_testcase extends advanced_testcase {
-    /**
-     * @var \stdClass[] $objects Array of objects to proxy.
-     */
-    public $objects;
-
-    /**
-     * Sets up the fixture. This method is called before a test is executed.
-     */
-    public function setUp() {
-        $this->objects = [
-            'somemodule_someinstance' => (object) [
-                'member1' => 'Hello',
-                'member2' => 1729,
-                'member3' => 'Something else'
-            ],
-            'anothermodule_anotherinstance' => (object) [
-                'member1' => 'Hej',
-                'member2' => 87539319,
-                'member3' => 'nagot annat'
-            ]
-        ];
-    }
-
-    /**
-     * Test proxying.
-     *
-     * @dataProvider test_proxy_testcases()
-     * @param string $modulename Object module name.
-     * @param string $instance   Object instance.
-     * @param string $member     Object member to retrieve.
-     * @param mixed  $expected   Expected value of member.
-     */
-    public function test_proxy($modulename, $instance, $member, $expected) {
-        $proxy = new module_std_proxy(
-            $modulename,
-            $instance,
-            function($modulename, $instance) {
-                return $this->objects[$modulename . '_' . $instance];
-            }
-        );
-
-        $this->assertEquals($proxy->get($member), $expected);
-
-        // Test changing the value.
-        $proxy->set($member, 'something even more else');
-        $this->assertEquals($proxy->get($member), 'something even more else');
-    }
-
-    /**
-     * Test setting values with a base class.
-     *
-     * @dataProvider test_proxy_testcases()
-     * @param string $modulename  Object module name.
-     * @param string $instance    Object instance.
-     * @param string $member      Object member to retrieve.
-     * @param mixed  $storedvalue Value as would be stored externally.
-     */
-    public function test_base_values($modulename, $instance, $member, $storedvalue) {
-        $proxy = new module_std_proxy(
-            $modulename,
-            $instance,
-            function($module, $instance) {
-                return $this->objects[$module . '_' . $instance];
-            },
-            (object)['member1' => 'should clobber 1']
-        );
-
-        $expected = $member == 'member1' ? 'should clobber 1' : $storedvalue;
-        $this->assertEquals($proxy->get($member), $expected);
-    }
-
-    /**
-     * Test getting a non existant member.
-     *
-     * @dataProvider test_get_set_testcases()
-     * @param string $modulename Object module name.
-     * @param string $instance   Object instance.
-     */
-    public function test_get_invalid_member($modulename, $instance) {
-        $proxy = new module_std_proxy(
-            $modulename,
-            $instance,
-            function($modulename, $instance) {
-                return $this->objects[$modulename . '_' . $instance];
-            }
-        );
-
-        $this->expectException('\core_calendar\local\event\exceptions\member_does_not_exist_exception');
-        $proxy->get('thisdoesnotexist');
-    }
-
-    /**
-     * Test setting a non existant member.
-     *
-     * @dataProvider test_get_set_testcases()
-     * @param string $modulename Object module name.
-     * @param string $instance   Object instance.
-     */
-    public function test_set_invalid_member($modulename, $instance) {
-        $proxy = new module_std_proxy(
-            $modulename,
-            $instance,
-            function($modulename, $instance) {
-                return $this->objects[$modulename . '_' . $instance];
-            }
-        );
-
-        $this->expectException('\core_calendar\local\event\exceptions\member_does_not_exist_exception');
-        $proxy->set('thisdoesnotexist', 'should break');
-    }
-
-    /**
-     * Test get proxied instance.
-     *
-     * @dataProvider test_get_set_testcases()
-     * @param string $modulename Object module name.
-     * @param string $instance   Object instance.
-     */
-    public function test_get_proxied_instance($modulename, $instance) {
-        $proxy = new module_std_proxy(
-            $modulename,
-            $instance,
-            function($modulename, $instance) {
-                return $this->objects[$modulename . '_' . $instance];
-            }
-        );
-
-        $this->assertEquals($proxy->get_proxied_instance(), $this->objects[$modulename . '_' . $instance]);
-    }
-
-    /**
-     * Test cases for&n