Merge branch 'MDL-42167-workshop-update-record' of git://github.com/mudrd8mz/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 14 Oct 2013 04:07:54 +0000 (12:07 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 14 Oct 2013 04:07:54 +0000 (12:07 +0800)
587 files changed:
admin/auth.php
admin/blocks.php
admin/cli/install.php
admin/cli/install_database.php
admin/cli/upgrade.php
admin/courseformats.php
admin/editors.php
admin/enrol.php
admin/filters.php
admin/index.php
admin/localplugins.php
admin/message.php
admin/modules.php
admin/plagiarism.php
admin/plugins.php
admin/portfolio.php
admin/qbehaviours.php
admin/qtypes.php
admin/renderer.php
admin/reports.php
admin/repository.php
admin/repositoryinstance.php
admin/roles/assign.php
admin/roles/permissions.php
admin/settings/courses.php
admin/settings/development.php
admin/settings/plugins.php
admin/settings/security.php
admin/tool/behat/cli/util.php
admin/tool/behat/tests/behat/basic_actions.feature
admin/tool/behat/tests/behat/data_generators.feature
admin/tool/behat/tests/behat/manipulate_forms.feature
admin/tool/dbtransfer/locallib.php
admin/tool/installaddon/classes/installer.php
admin/tool/phpunit/cli/util.php
admin/tool/qeupgradehelper/locallib.php
admin/tool/uploadcourse/classes/course.php
admin/tool/uploadcourse/classes/processor.php
admin/tool/uploadcourse/tests/course_test.php
admin/tool/uploaduser/index.php
admin/tool/uploaduser/locallib.php
admin/tool/uploaduser/user_form.php
admin/tools.php
auth/cas/version.php
auth/db/auth.php
auth/test_settings.php [new file with mode: 0644]
backup/backup.php
backup/cc/cc_lib/gral_lib/cssparser.php
backup/controller/backup_controller.class.php
backup/controller/base_controller.class.php [new file with mode: 0644]
backup/controller/restore_controller.class.php
backup/import.php
backup/moodle2/backup_stepslib.php
backup/moodle2/restore_plan_builder.class.php
backup/moodle2/restore_stepslib.php
backup/restore.php
backup/restorefile.php
backup/util/dbops/backup_controller_dbops.class.php
backup/util/dbops/restore_dbops.class.php
backup/util/helper/backup_cron_helper.class.php
backup/util/helper/backup_general_helper.class.php
backup/util/helper/backup_helper.class.php
backup/util/includes/backup_includes.php
backup/util/includes/restore_includes.php
backup/util/loggers/core_backup_html_logger.class.php [new file with mode: 0644]
backup/util/plan/restore_structure_step.class.php
backup/util/progress/core_backup_progress.class.php
backup/util/ui/backup_ui_stage.class.php
backup/util/ui/renderer.php
backup/util/ui/restore_ui_stage.class.php
backup/util/ui/tests/behat/import_course.feature
backup/util/ui/tests/behat/restore_moodle2_courses.feature
badges/ajax.php
badges/assertion.php
badges/backpackconnect.php
badges/criteria/award_criteria_courseset.php
badges/index.php
badges/newbadge.php
badges/renderer.php
badges/view.php
blocks/calendar_month/block_calendar_month.php
blocks/calendar_upcoming/block_calendar_upcoming.php
blocks/community/communitycourse.php
blocks/community/forms.php
blocks/feedback/version.php
blocks/glossary_random/version.php
blocks/quiz_results/version.php
blocks/search_forums/version.php
blocks/tests/behat/configure_block_throughout_site.feature
blocks/tests/behat/restrict_available_blocks.feature
calendar/classes/type_base.php
calendar/classes/type_factory.php
calendar/delete.php
calendar/event.php
calendar/export.php
calendar/export_execute.php
calendar/lib.php
calendar/preferences.php
calendar/renderer.php
calendar/tests/behat/behat_calendar.php [new file with mode: 0644]
calendar/tests/behat/calendar.feature [new file with mode: 0644]
calendar/tests/calendartype_test.php
calendar/tests/calendartype_test_example.php
calendar/type/gregorian/classes/structure.php
calendar/type/gregorian/version.php
calendar/view.php
calendar/yui/build/moodle-calendar-eventmanager/assets/skins/sam/eventmanager.css [deleted file]
config-dist.php
course/ajax/management.php [new file with mode: 0644]
course/category.php
course/classes/deletecategory_form.php [new file with mode: 0644]
course/classes/editcategory_form.php [new file with mode: 0644]
course/classes/management/helper.php [new file with mode: 0644]
course/classes/management_renderer.php [new file with mode: 0644]
course/delete.php
course/delete_category_form.php
course/edit.php
course/editcategory.php
course/editcategory_form.php
course/format/lib.php
course/format/singleactivity/lib.php
course/format/singleactivity/settingslib.php
course/format/singleactivity/styles.css
course/lib.php
course/manage.php
course/management.php [new file with mode: 0644]
course/moodleform_mod.php
course/renderer.php
course/request.php
course/search.php
course/tests/behat/behat_course.php
course/tests/behat/category_change_visibility.feature [new file with mode: 0644]
course/tests/behat/category_management.feature [new file with mode: 0644]
course/tests/behat/category_resort.feature [new file with mode: 0644]
course/tests/behat/course_category_management_listing.feature [new file with mode: 0644]
course/tests/behat/course_change_visibility.feature [new file with mode: 0644]
course/tests/behat/course_resort.feature [new file with mode: 0644]
course/tests/courselib_test.php
course/tests/fixtures/course_capability_assignment.php [new file with mode: 0644]
course/tests/management_helper_test.php [new file with mode: 0644]
course/yui/build/moodle-course-management/moodle-course-management-debug.js [new file with mode: 0644]
course/yui/build/moodle-course-management/moodle-course-management-min.js [new file with mode: 0644]
course/yui/build/moodle-course-management/moodle-course-management.js [new file with mode: 0644]
course/yui/src/management/build.json [new file with mode: 0644]
course/yui/src/management/js/category.js [new file with mode: 0644]
course/yui/src/management/js/console.js [new file with mode: 0644]
course/yui/src/management/js/course.js [new file with mode: 0644]
course/yui/src/management/js/dd.js [new file with mode: 0644]
course/yui/src/management/js/item.js [new file with mode: 0644]
course/yui/src/management/meta/management.json [new file with mode: 0644]
enrol/cohort/lib.php
enrol/database/lib.php
enrol/imsenterprise/lib.php
enrol/imsenterprise/tests/imsenterprise_test.php
enrol/instances.php
enrol/manual/edit_form.php
enrol/paypal/edit_form.php
enrol/self/edit_form.php
enrol/test_settings.php [new file with mode: 0644]
files/coursefilesedit_form.php
files/tests/behat/course_files.feature [new file with mode: 0644]
filter/censor/settings.php [moved from filter/censor/filtersettings.php with 100% similarity]
filter/emoticon/settings.php [moved from filter/emoticon/filtersettings.php with 100% similarity]
filter/manage.php
filter/multilang/settings.php [moved from filter/multilang/filtersettings.php with 100% similarity]
filter/tex/settings.php [moved from filter/tex/filtersettings.php with 100% similarity]
filter/upgrade.txt
filter/urltolink/settings.php [moved from filter/urltolink/filtersettings.php with 100% similarity]
grade/edit/outcome/course_form.html
grade/edit/tree/grade.php
grade/lib.php
group/lib.php
group/tests/lib_test.php
lang/en/admin.php
lang/en/auth.php
lang/en/backup.php
lang/en/enrol.php
lang/en/error.php
lang/en/moodle.php
lang/en/notes.php
lang/en/question.php
lib/adminlib.php
lib/classes/component.php
lib/classes/event/note_created.php [new file with mode: 0644]
lib/classes/event/note_deleted.php [new file with mode: 0644]
lib/classes/event/note_updated.php [new file with mode: 0644]
lib/classes/event/notes_viewed.php [new file with mode: 0644]
lib/classes/plugin_manager.php [new file with mode: 0644]
lib/classes/plugininfo/auth.php [new file with mode: 0644]
lib/classes/plugininfo/base.php [new file with mode: 0644]
lib/classes/plugininfo/block.php [new file with mode: 0644]
lib/classes/plugininfo/cachelock.php [new file with mode: 0644]
lib/classes/plugininfo/cachestore.php [new file with mode: 0644]
lib/classes/plugininfo/calendartype.php [new file with mode: 0644]
lib/classes/plugininfo/coursereport.php [new file with mode: 0644]
lib/classes/plugininfo/editor.php [new file with mode: 0644]
lib/classes/plugininfo/enrol.php [new file with mode: 0644]
lib/classes/plugininfo/filter.php [new file with mode: 0644]
lib/classes/plugininfo/format.php [new file with mode: 0644]
lib/classes/plugininfo/general.php [new file with mode: 0644]
lib/classes/plugininfo/gradeexport.php [new file with mode: 0644]
lib/classes/plugininfo/gradeimport.php [new file with mode: 0644]
lib/classes/plugininfo/gradereport.php [new file with mode: 0644]
lib/classes/plugininfo/gradingform.php [new file with mode: 0644]
lib/classes/plugininfo/local.php [new file with mode: 0644]
lib/classes/plugininfo/message.php [new file with mode: 0644]
lib/classes/plugininfo/mnetservice.php [new file with mode: 0644]
lib/classes/plugininfo/mod.php [new file with mode: 0644]
lib/classes/plugininfo/plagiarism.php [new file with mode: 0644]
lib/classes/plugininfo/portfolio.php [new file with mode: 0644]
lib/classes/plugininfo/profilefield.php [new file with mode: 0644]
lib/classes/plugininfo/qbehaviour.php [new file with mode: 0644]
lib/classes/plugininfo/qformat.php [new file with mode: 0644]
lib/classes/plugininfo/qtype.php [new file with mode: 0644]
lib/classes/plugininfo/report.php [new file with mode: 0644]
lib/classes/plugininfo/repository.php [new file with mode: 0644]
lib/classes/plugininfo/theme.php [new file with mode: 0644]
lib/classes/plugininfo/tool.php [new file with mode: 0644]
lib/classes/plugininfo/webservice.php [new file with mode: 0644]
lib/classes/session/database.php
lib/classes/shutdown_manager.php [new file with mode: 0644]
lib/classes/text.php
lib/classes/update/checker.php [new file with mode: 0644]
lib/classes/update/checker_exception.php [new file with mode: 0644]
lib/classes/update/deployer.php [new file with mode: 0644]
lib/classes/update/info.php [new file with mode: 0644]
lib/completionlib.php
lib/coursecatlib.php
lib/cronlib.php
lib/db/caches.php
lib/db/install.xml
lib/db/services.php
lib/db/upgrade.php
lib/deprecatedlib.php
lib/dml/moodle_database.php
lib/editor/atto/classes/plugininfo/atto.php [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-debug.js
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-min.js
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button.js
lib/editor/atto/plugins/bold/yui/src/button/js/button.js
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-debug.js
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-min.js
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button.js
lib/editor/atto/plugins/clear/yui/src/button/js/button.js
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js
lib/editor/atto/plugins/image/yui/src/button/js/button.js
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js
lib/editor/atto/plugins/indent/yui/src/button/js/button.js
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-debug.js
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-min.js
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button.js
lib/editor/atto/plugins/italic/yui/src/button/js/button.js
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
lib/editor/atto/plugins/link/yui/src/button/js/button.js
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js
lib/editor/atto/plugins/media/yui/src/button/js/button.js
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-debug.js
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-min.js
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button.js
lib/editor/atto/plugins/orderedlist/yui/src/button/js/button.js
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-debug.js
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-min.js
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button.js
lib/editor/atto/plugins/outdent/yui/src/button/js/button.js
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js
lib/editor/atto/plugins/strike/yui/src/button/js/button.js
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-debug.js
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-min.js
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button.js
lib/editor/atto/plugins/title/yui/src/button/js/button.js
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-debug.js
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-min.js
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button.js
lib/editor/atto/plugins/underline/yui/src/button/js/button.js
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js
lib/editor/atto/plugins/unlink/yui/src/button/js/button.js
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-debug.js
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-min.js
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button.js
lib/editor/atto/plugins/unorderedlist/yui/src/button/js/button.js
lib/editor/atto/styles.css
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js
lib/editor/atto/yui/src/editor/js/editor.js
lib/editor/tinymce/adminlib.php
lib/editor/tinymce/classes/plugininfo/tinymce.php [new file with mode: 0644]
lib/editor/tinymce/settings.php
lib/editor/tinymce/subplugins.php
lib/editorlib.php
lib/enrollib.php
lib/filebrowser/file_info_context_course.php
lib/filelib.php
lib/filestorage/file_packer.php
lib/filestorage/file_progress.php
lib/filestorage/file_storage.php
lib/filestorage/mbz_packer.php [new file with mode: 0644]
lib/filestorage/stored_file.php
lib/filestorage/tests/file_storage_test.php
lib/filestorage/tests/mbz_packer_test.php [new file with mode: 0644]
lib/filestorage/tests/tgz_packer_test.php [new file with mode: 0644]
lib/filestorage/tgz_extractor.php [new file with mode: 0644]
lib/filestorage/tgz_packer.php [new file with mode: 0644]
lib/filterlib.php
lib/form/dateselector.php
lib/form/datetimeselector.php
lib/form/htmleditor.php
lib/moodlelib.php
lib/navigationlib.php
lib/outputfactories.php
lib/outputlib.php
lib/outputrenderers.php
lib/outputrequirementslib.php
lib/pagelib.php
lib/pear/HTML/QuickForm.php
lib/phpmailer/moodle_phpmailer.php
lib/phpunit/classes/advanced_testcase.php
lib/phpunit/classes/util.php
lib/phpunit/tests/advanced_test.php
lib/pluginlib.php
lib/setup.php
lib/setuplib.php
lib/tests/behat/behat_general.php
lib/tests/completionlib_test.php
lib/tests/component_test.php
lib/tests/coursecatlib_test.php
lib/tests/datalib_test.php
lib/tests/editorlib_test.php [new file with mode: 0644]
lib/tests/messagelib_test.php
lib/tests/moodle_page_test.php
lib/tests/moodlelib_test.php
lib/tests/plugin_manager_test.php
lib/tests/setuplib_test.php
lib/tests/text_test.php
lib/tests/update_checker_test.php [moved from lib/tests/available_update_checker_test.php with 97% similarity]
lib/tests/update_deployer_test.php [moved from lib/tests/available_update_deployer_test.php with 91% similarity]
lib/upgrade.txt
lib/upgradelib.php
lib/weblib.php
lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader-debug.js
lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader.js
lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js
lib/yui/build/moodle-core-dock/moodle-core-dock.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js
lib/yui/src/dock/js/block.js
lib/yui/src/dock/js/dock.js
lib/yui/src/dock/js/dockeditem.js
lib/yui/src/dock/js/loader.js
lib/yui/src/dock/js/panel.js
lib/yui/src/dock/js/tabheightmanager.js
lib/yui/src/formautosubmit/js/formautosubmit.js
lib/yui/src/notification/js/dialogue.js
login/forgot_password.php
login/forgot_password_form.php
login/index.php
login/lib.php [new file with mode: 0644]
login/set_password_form.php [new file with mode: 0644]
message/lib.php
message/output/email/lang/en/message_email.php
message/output/email/message_output_email.php
message/output/email/settings.php
message/renderer.php
message/upgrade.txt
mod/assign/adminlib.php
mod/assign/classes/plugininfo/assignfeedback.php [new file with mode: 0644]
mod/assign/classes/plugininfo/assignsubmission.php [new file with mode: 0644]
mod/assign/feedback/editpdf/ajax.php
mod/assign/feedback/editpdf/classes/document_services.php
mod/assign/feedback/editpdf/classes/page_editor.php
mod/assign/feedback/editpdf/settings.php
mod/assign/feedback/editpdf/testgs.php
mod/assign/feedback/editpdf/tests/editpdf_test.php
mod/assign/feedback/file/importziplib.php
mod/assign/lang/en/assign.php
mod/assign/lib.php
mod/assign/locallib.php
mod/assign/settings.php
mod/assign/tests/lib_test.php
mod/assignment/classes/plugininfo/assignment.php [new file with mode: 0644]
mod/assignment/lib.php
mod/assignment/type/online/assignment.class.php
mod/book/classes/event/chapter_created.php [new file with mode: 0644]
mod/book/classes/event/chapter_deleted.php [new file with mode: 0644]
mod/book/classes/event/chapter_updated.php [new file with mode: 0644]
mod/book/classes/event/chapter_viewed.php [new file with mode: 0644]
mod/book/classes/event/course_module_viewed.php [new file with mode: 0644]
mod/book/classes/event/instances_list_viewed.php [new file with mode: 0644]
mod/book/classes/plugininfo/booktool.php [new file with mode: 0644]
mod/book/delete.php
mod/book/edit.php
mod/book/index.php
mod/book/lang/en/book.php
mod/book/move.php
mod/book/show.php
mod/book/tests/events_test.php [new file with mode: 0644]
mod/book/tests/generator/lib.php [new file with mode: 0644]
mod/book/tests/generator_test.php [new file with mode: 0644]
mod/book/tool/exportimscp/classes/event/book_exported.php [new file with mode: 0644]
mod/book/tool/exportimscp/index.php
mod/book/tool/exportimscp/lang/en/booktool_exportimscp.php
mod/book/tool/exportimscp/tests/events_test.php [new file with mode: 0644]
mod/book/tool/importhtml/locallib.php
mod/book/tool/importhtml/tests/fixtures/chapters.zip [new file with mode: 0644]
mod/book/tool/importhtml/tests/locallib_test.php [new file with mode: 0644]
mod/book/tool/print/classes/event/book_printed.php [new file with mode: 0644]
mod/book/tool/print/classes/event/chapter_printed.php [new file with mode: 0644]
mod/book/tool/print/index.php
mod/book/tool/print/lang/en/booktool_print.php
mod/book/tool/print/tests/events_test.php [new file with mode: 0644]
mod/book/view.php
mod/data/classes/plugininfo/datafield.php [new file with mode: 0644]
mod/data/classes/plugininfo/datapreset.php [new file with mode: 0644]
mod/data/field/textarea/field.class.php
mod/data/templates.php
mod/feedback/edit_item.php
mod/feedback/show_nonrespondents.php
mod/folder/mod_form.php
mod/forum/externallib.php
mod/forum/index.php
mod/forum/lang/en/forum.php
mod/forum/lib.php
mod/forum/mod_form.php
mod/forum/post.php
mod/forum/settings.php
mod/forum/tests/behat/edit_post_student.feature
mod/forum/tests/behat/track_read_posts.feature
mod/forum/tests/externallib_test.php
mod/forum/tests/lib_test.php
mod/forum/upgrade.txt
mod/lti/OAuth.php
mod/lti/OAuthBody.php
mod/lti/view.php
mod/page/classes/event/course_module_viewed.php [new file with mode: 0644]
mod/page/classes/event/instances_list_viewed.php [new file with mode: 0644]
mod/page/index.php
mod/page/lang/en/page.php
mod/page/view.php
mod/quiz/attemptlib.php
mod/quiz/classes/plugininfo/quiz.php [moved from mod/quiz/adminlib.php with 85% similarity]
mod/quiz/classes/plugininfo/quizaccess.php [new file with mode: 0644]
mod/quiz/comment.php
mod/quiz/lang/en/quiz.php
mod/quiz/renderer.php
mod/quiz/report/attemptsreport.php
mod/quiz/report/grading/gradingsettings_form.php
mod/quiz/report/grading/lang/en/quiz_grading.php
mod/quiz/report/grading/report.php
mod/quiz/report/reportlib.php
mod/quiz/report/statistics/classes/calculated.php
mod/quiz/report/statistics/classes/calculator.php
mod/quiz/report/statistics/db/install.xml
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/lang/en/quiz_statistics.php
mod/quiz/report/statistics/report.php
mod/quiz/report/statistics/statistics_form.php
mod/quiz/report/statistics/statistics_graph.php
mod/quiz/report/statistics/statisticslib.php
mod/quiz/report/statistics/tests/stats_from_steps_walkthrough_test.php
mod/quiz/report/statistics/version.php
mod/quiz/review.php
mod/quiz/view.php
mod/scorm/classes/plugininfo/scormreport.php [new file with mode: 0644]
mod/wiki/lib.php
mod/workshop/classes/plugininfo/workshopallocation.php [new file with mode: 0644]
mod/workshop/classes/plugininfo/workshopeval.php [new file with mode: 0644]
mod/workshop/classes/plugininfo/workshopform.php [new file with mode: 0644]
notes/index.php
notes/lib.php
notes/tests/events_test.php [new file with mode: 0644]
notes/tests/generator/lib.php [new file with mode: 0644]
notes/tests/generator_test.php [new file with mode: 0644]
question/behaviour/adaptive/behaviourtype.php [new file with mode: 0644]
question/behaviour/adaptivenopenalty/behaviour.php
question/behaviour/adaptivenopenalty/behaviourtype.php [new file with mode: 0644]
question/behaviour/behaviourbase.php
question/behaviour/behaviourtypebase.php [new file with mode: 0644]
question/behaviour/deferredcbm/behaviour.php
question/behaviour/deferredcbm/behaviourtype.php [new file with mode: 0644]
question/behaviour/deferredcbm/lang/en/qbehaviour_deferredcbm.php
question/behaviour/deferredcbm/renderer.php
question/behaviour/deferredcbm/styles.css [new file with mode: 0644]
question/behaviour/deferredcbm/tests/behaviourtype_test.php [new file with mode: 0644]
question/behaviour/deferredcbm/tests/question_cbm_test.php [new file with mode: 0644]
question/behaviour/deferredcbm/tests/walkthrough_test.php
question/behaviour/deferredfeedback/behaviour.php
question/behaviour/deferredfeedback/behaviourtype.php [new file with mode: 0644]
question/behaviour/immediatecbm/behaviour.php
question/behaviour/immediatecbm/behaviourtype.php [new file with mode: 0644]
question/behaviour/immediatecbm/tests/walkthrough_test.php
question/behaviour/immediatefeedback/behaviourtype.php [new file with mode: 0644]
question/behaviour/informationitem/behaviour.php
question/behaviour/informationitem/behaviourtype.php [new file with mode: 0644]
question/behaviour/interactive/behaviour.php
question/behaviour/interactive/behaviourtype.php [new file with mode: 0644]
question/behaviour/interactivecountback/behaviour.php
question/behaviour/interactivecountback/behaviourtype.php [new file with mode: 0644]
question/behaviour/manualgraded/behaviour.php
question/behaviour/manualgraded/behaviourtype.php [new file with mode: 0644]
question/behaviour/manualgraded/tests/walkthrough_test.php
question/behaviour/missing/behaviour.php
question/behaviour/missing/behaviourtype.php [new file with mode: 0644]
question/behaviour/missing/tests/missingbehaviour_test.php
question/behaviour/rendererbase.php
question/behaviour/upgrade.txt
question/editlib.php
question/engine/datalib.php
question/engine/lib.php
question/engine/questionattempt.php
question/engine/questionattemptstep.php
question/engine/questionusage.php
question/engine/renderer.php
question/engine/tests/helpers.php
question/engine/tests/questionattempt_db_test.php
question/engine/tests/questionattempt_with_steps_test.php
question/engine/tests/questioncbm_test.php [deleted file]
question/engine/tests/questionusagebyactivity_test.php
question/engine/tests/unitofwork_test.php
question/engine/upgrade.txt [new file with mode: 0644]
question/engine/upgrade/behaviourconverters.php
question/preview.php
question/type/calculated/tests/upgradelibnewqe_test.php
question/type/calculatedmulti/tests/upgradelibnewqe_test.php
question/type/calculatedsimple/tests/upgradelibnewqe_test.php
question/type/description/tests/upgradelibnewqe_test.php
question/type/essay/question.php
question/type/essay/tests/upgradelibnewqe_test.php
question/type/essay/tests/walkthrough_test.php
question/type/match/tests/upgradelibnewqe_test.php
question/type/multianswer/question.php
question/type/multianswer/tests/upgradelibnewqe_test.php
question/type/multichoice/tests/upgradelibnewqe_test.php
question/type/numerical/tests/upgradelibnewqe_test.php
question/type/questionbase.php
question/type/random/tests/upgradelibnewqe_test.php
question/type/shortanswer/tests/upgradelibnewqe_test.php
question/type/truefalse/tests/upgradelibnewqe_test.php
repository/boxnet/lib.php
repository/coursefiles/lib.php
repository/dropbox/lib.php
repository/equella/lib.php
repository/filesystem/lib.php
repository/lib.php
repository/local/lib.php
repository/tests/behat/delete_files.feature
repository/upgrade.txt
repository/user/lib.php
tag/edit.php
theme/base/style/core.css
theme/base/style/course.css
theme/base/style/filemanager.css
theme/base/style/grade.css
theme/bootstrapbase/less/moodle/backup-restore.less
theme/bootstrapbase/less/moodle/bootstrapoverride.less
theme/bootstrapbase/less/moodle/core.less
theme/bootstrapbase/less/moodle/course.less
theme/bootstrapbase/less/moodle/filemanager.less
theme/bootstrapbase/less/moodle/forms.less
theme/bootstrapbase/less/moodle/responsive.less
theme/bootstrapbase/style/moodle.css
theme/bootstrapbase/yui/build/moodle-theme_bootstrap-bootstrap/moodle-theme_bootstrap-bootstrap-debug.js [deleted file]
theme/bootstrapbase/yui/build/moodle-theme_bootstrap-bootstrap/moodle-theme_bootstrap-bootstrap-min.js [deleted file]
theme/bootstrapbase/yui/build/moodle-theme_bootstrap-bootstrap/moodle-theme_bootstrap-bootstrap.js [deleted file]
theme/upgrade.txt
user/editlib.php
user/externallib.php
user/message.html
user/messageselect.php
user/portfolio.php
user/tests/externallib_test.php
version.php

index 4310901..c83e848 100644 (file)
@@ -10,7 +10,6 @@
 require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 require_login();
 require_capability('moodle/site:config', context_system::instance());
@@ -53,7 +52,7 @@ switch ($action) {
             set_config('registerauth', '');
         }
         \core\session\manager::gc(); // Remove stale sessions.
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         break;
 
     case 'enable':
@@ -64,7 +63,7 @@ switch ($action) {
             set_config('auth', implode(',', $authsenabled));
         }
         \core\session\manager::gc(); // Remove stale sessions.
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         break;
 
     case 'down':
index 1e37dd2..a37af21 100644 (file)
@@ -5,7 +5,6 @@
     require_once('../config.php');
     require_once($CFG->libdir.'/adminlib.php');
     require_once($CFG->libdir.'/tablelib.php');
-    require_once($CFG->libdir.'/pluginlib.php');
 
     admin_externalpage_setup('manageblocks');
 
@@ -37,7 +36,7 @@
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '0', array('id'=>$block->id));      // Hide block
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
 
@@ -46,7 +45,7 @@
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '1', array('id'=>$block->id));      // Show block
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
 
@@ -97,8 +96,8 @@
 
     $table = new flexible_table('admin-blocks-compatible');
 
-    $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'uninstall', 'settings'));
-    $table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $struninstall, $strsettings));
+    $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'settings', 'uninstall'));
+    $table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strsettings, $struninstall));
     $table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
     $table->set_attribute('class', 'admintable blockstable generaltable');
     $table->set_attribute('id', 'compatibleblockstable');
             }
         }
 
-        if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('block_'.$blockname)) {
+        if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$blockname, 'manage')) {
             $uninstall = html_writer::link($uninstallurl, $struninstall);
         } else {
             $uninstall = '';
         } else {
             $visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
                        '<img src="'.$OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="'.$strshow.'" /></a>';
-            $class = ' class="dimmed_text"'; // Leading space required!
+            $class = 'dimmed_text';
         }
 
         if ($dbversion == $plugin->version) {
         }
 
         $row = array(
-            '<span'.$class.'>'.$strblockname.'</span>',
+            $strblockname,
             $blocklist,
-            '<span'.$class.'>'.$version.'</span>',
+            $version,
             $visible,
             $undeletable,
+            $settings,
             $uninstall,
-            $settings
         );
-        $table->add_data($row);
+        $table->add_data($row, $class);
     }
 
     $table->print_html();
         $table->setup();
 
         foreach ($incompatible as $block) {
-            if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('block_'.$block->name)) {
+            if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$block->name, 'manage')) {
                 $uninstall = html_writer::link($uninstallurl, $struninstall);
             } else {
                 $uninstall = '';
index 0a5ce9b..a6c3873 100644 (file)
@@ -753,9 +753,8 @@ if (!$envstatus) {
 }
 
 // Test plugin dependencies.
-require_once($CFG->libdir . '/pluginlib.php');
 $failed = array();
-if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
     cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
     cli_error(get_string('pluginschecktodo', 'admin'));
 }
index 7a4f288..3ab6279 100644 (file)
@@ -167,9 +167,8 @@ if (!$envstatus) {
 }
 
 // Test plugin dependencies.
-require_once($CFG->libdir . '/pluginlib.php');
 $failed = array();
-if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
     cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
     cli_error(get_string('pluginschecktodo', 'admin'));
 }
index 28d7c8d..be2ba8b 100644 (file)
@@ -43,7 +43,6 @@ require_once($CFG->libdir.'/adminlib.php');       // various admin-only function
 require_once($CFG->libdir.'/upgradelib.php');     // general upgrade/install related functions
 require_once($CFG->libdir.'/clilib.php');         // cli only functions
 require_once($CFG->libdir.'/environmentlib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 // now get cli options
 list($options, $unrecognized) = cli_get_params(
@@ -117,7 +116,7 @@ if (!$envstatus) {
 
 // Test plugin dependencies.
 $failed = array();
-if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
     cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
     cli_error(get_string('pluginschecktodo', 'admin'));
 }
index f86c4be..80f7680 100644 (file)
@@ -24,7 +24,6 @@
 
 require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 $action  = required_param('action', PARAM_ALPHANUMEXT);
 $formatname   = required_param('format', PARAM_PLUGIN);
@@ -39,7 +38,7 @@ require_sesskey();
 
 $return = new moodle_url('/admin/settings.php', array('section' => 'manageformats'));
 
-$formatplugins = plugin_manager::instance()->get_plugins_of_type('format');
+$formatplugins = core_plugin_manager::instance()->get_plugins_of_type('format');
 $sortorder = array_flip(array_keys($formatplugins));
 
 if (!isset($formatplugins[$formatname])) {
@@ -53,13 +52,13 @@ switch ($action) {
                 print_error('cannotdisableformat', 'error', $return);
             }
             set_config('disabled', 1, 'format_'. $formatname);
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
         }
         break;
     case 'enable':
         if (!$formatplugins[$formatname]->is_enabled()) {
             unset_config('disabled', 'format_'. $formatname);
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
         }
         break;
     case 'up':
index 50ee7a5..e1be31f 100644 (file)
@@ -7,7 +7,6 @@
 require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 $action  = required_param('action', PARAM_ALPHANUMEXT);
 $editor  = required_param('editor', PARAM_PLUGIN);
@@ -94,7 +93,7 @@ if (empty($active_editors)) {
 }
 
 set_config('texteditors', implode(',', $active_editors));
-plugin_manager::reset_caches();
+core_plugin_manager::reset_caches();
 
 if ($return) {
     redirect ($returnurl);
index 14a7649..642d93b 100644 (file)
@@ -27,7 +27,6 @@ define('NO_OUTPUT_BUFFERING', true);
 
 require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 $action  = required_param('action', PARAM_ALPHANUMEXT);
 $enrol   = required_param('enrol', PARAM_PLUGIN);
@@ -51,7 +50,7 @@ switch ($action) {
     case 'disable':
         unset($enabled[$enrol]);
         set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         $syscontext->mark_dirty(); // resets all enrol caches
         break;
 
@@ -62,7 +61,7 @@ switch ($action) {
         $enabled = array_keys($enabled);
         $enabled[] = $enrol;
         set_config('enrol_plugins_enabled', implode(',', $enabled));
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         $syscontext->mark_dirty(); // resets all enrol caches
         break;
 
@@ -122,7 +121,7 @@ switch ($action) {
 
         echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
 
-        if (!$return = plugin_manager::instance()->get_uninstall_url('enrol_'.$enrol)) {
+        if (!$return = core_plugin_manager::instance()->get_uninstall_url('enrol_'.$enrol, 'manage')) {
             $return = new moodle_url('/admin/plugins.php');
         }
         echo $OUTPUT->continue_button($return);
index 05c463a..ae64944 100644 (file)
@@ -33,7 +33,6 @@
 
     require_once(dirname(__FILE__) . '/../config.php');
     require_once($CFG->libdir . '/adminlib.php');
-    require_once($CFG->libdir . '/pluginlib.php');
 
     $action = optional_param('action', '', PARAM_ALPHANUMEXT);
     $filterpath = optional_param('filterpath', '', PARAM_SAFEDIR);
 
     // Reset caches and return
     if ($action) {
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         reset_text_filters_cache();
         redirect($returnurl);
     }
 
     $table = new html_table();
     $table->head  = array(get_string('filter'), get_string('isactive', 'filters'),
-            get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('delete'));
+            get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('uninstallplugin', 'core_admin'));
     $table->colclasses = array ('leftalign', 'leftalign', 'centeralign', 'leftalign', 'leftalign', 'leftalign');
     $table->attributes['class'] = 'admintable generaltable';
     $table->id = 'filterssetting';
 
 function filters_action_url($filterpath, $action) {
     if ($action === 'delete') {
-        return new moodle_url('/admin/plugins.php', array('sesskey'=>sesskey(), 'uninstall'=>'filter_'.$filterpath));
+        return core_plugin_manager::instance()->get_uninstall_url('filter_'.$filterpath, 'manage');
     }
     return new moodle_url('/admin/filters.php', array('sesskey'=>sesskey(), 'filterpath'=>$filterpath, 'action'=>$action));
 }
@@ -233,7 +232,7 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings)
     }
 
     // Delete
-    $row[] = '<a href="' . filters_action_url($filter, 'delete') . '">' . get_string('delete') . '</a>';
+    $row[] = '<a href="' . filters_action_url($filter, 'delete') . '">' . get_string('uninstallplugin', 'core_admin') . '</a>';
 
     return $row;
 }
index cf2e78a..ea9f37d 100644 (file)
@@ -78,7 +78,6 @@ core_component::get_core_subsystems();
 
 require_once($CFG->libdir.'/adminlib.php');    // various admin-only functions
 require_once($CFG->libdir.'/upgradelib.php');  // general upgrade/install related functions
-require_once($CFG->libdir.'/pluginlib.php');   // available updates notifications
 
 $id             = optional_param('id', '', PARAM_TEXT);
 $confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
@@ -196,7 +195,7 @@ if (!core_tables_exist()) {
 
     // check plugin dependencies
     $failed = array();
-    if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+    if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
         $PAGE->navbar->add(get_string('pluginscheck', 'admin'));
         $PAGE->set_title($strinstallation);
         $PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release);
@@ -323,7 +322,7 @@ if (!$cache and $version > $CFG->version) {  // upgrade
 
         // check plugin dependencies first
         $failed = array();
-        if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+        if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
             echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
             die();
         }
@@ -332,12 +331,12 @@ if (!$cache and $version > $CFG->version) {  // upgrade
         if ($fetchupdates) {
             // no sesskey support guaranteed here
             if (empty($CFG->disableupdatenotifications)) {
-                available_update_checker::instance()->fetch();
+                \core\update\checker::instance()->fetch();
             }
             redirect($reloadurl);
         }
 
-        $deployer = available_update_deployer::instance();
+        $deployer = \core\update\deployer::instance();
         if ($deployer->enabled()) {
             $deployer->initialize($reloadurl, $reloadurl);
 
@@ -348,7 +347,7 @@ if (!$cache and $version > $CFG->version) {  // upgrade
             }
         }
 
-        echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(),
+        echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(),
                 $version, $showallplugins, $reloadurl,
                 new moodle_url('/admin/index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)));
         die();
@@ -386,13 +385,13 @@ if (!$cache and moodle_needs_upgrading()) {
 
             if ($fetchupdates) {
                 // no sesskey support guaranteed here
-                available_update_checker::instance()->fetch();
+                \core\update\checker::instance()->fetch();
                 redirect($PAGE->url);
             }
 
             $output = $PAGE->get_renderer('core', 'admin');
 
-            $deployer = available_update_deployer::instance();
+            $deployer = \core\update\deployer::instance();
             if ($deployer->enabled()) {
                 $deployer->initialize($PAGE->url, $PAGE->url);
 
@@ -405,14 +404,14 @@ if (!$cache and moodle_needs_upgrading()) {
 
             // check plugin dependencies first
             $failed = array();
-            if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
+            if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
                 echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
                 die();
             }
             unset($failed);
 
             // dependencies check passed, let's rock!
-            echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(),
+            echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(),
                     $version, $showallplugins,
                     new moodle_url($PAGE->url),
                     new moodle_url('/admin/index.php', array('confirmplugincheck'=>1)));
@@ -514,6 +513,15 @@ if (any_new_admin_settings($adminroot)){
     redirect('upgradesettings.php');
 }
 
+// Return to original page that started the plugin uninstallation if necessary.
+if (isset($SESSION->pluginuninstallreturn)) {
+    $return = $SESSION->pluginuninstallreturn;
+    unset($SESSION->pluginuninstallreturn);
+    if ($return) {
+        redirect($return);
+    }
+}
+
 // Everything should now be set up, and the user is an admin
 
 // Print default admin page with notifications.
@@ -525,13 +533,13 @@ $dbproblems = $DB->diagnose();
 $maintenancemode = !empty($CFG->maintenance_enabled);
 
 // Available updates for Moodle core
-$updateschecker = available_update_checker::instance();
+$updateschecker = \core\update\checker::instance();
 $availableupdates = array();
 $availableupdates['core'] = $updateschecker->get_update_info('core',
     array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
 
 // Available updates for contributed plugins
-$pluginman = plugin_manager::instance();
+$pluginman = core_plugin_manager::instance();
 foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
     foreach ($plugintypeinstances as $pluginname => $plugininfo) {
         if (!empty($plugininfo->availableupdates)) {
index 8286e96..fb5c4cf 100644 (file)
@@ -30,7 +30,6 @@
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 admin_externalpage_setup('managelocalplugins');
 
@@ -60,7 +59,7 @@ core_collator::asort($plugins);
 
 foreach ($plugins as $plugin => $name) {
     $uninstall = '';
-    if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('local_'.$plugin)) {
+    if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('local_'.$plugin, 'manage')) {
         $uninstall = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'));
     }
 
index f9fee27..270a230 100644 (file)
@@ -24,7 +24,6 @@
 require_once(dirname(__FILE__) . '/../config.php');
 require_once($CFG->dirroot . '/message/lib.php');
 require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 // This is an admin page
 admin_externalpage_setup('managemessageoutputs');
@@ -43,7 +42,7 @@ if (!empty($disable) && confirm_sesskey()) {
         print_error('outputdoesnotexist', 'message');
     }
     $DB->set_field('message_processors', 'enabled', '0', array('id'=>$processor->id));      // Disable output
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
 }
 
 if (!empty($enable) && confirm_sesskey()) {
@@ -51,7 +50,7 @@ if (!empty($enable) && confirm_sesskey()) {
         print_error('outputdoesnotexist', 'message');
     }
     $DB->set_field('message_processors', 'enabled', '1', array('id'=>$processor->id));      // Enable output
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
 }
 
 if ($disable || $enable) {
index a964c73..4cca569 100644 (file)
@@ -5,7 +5,6 @@
     require_once('../course/lib.php');
     require_once($CFG->libdir.'/adminlib.php');
     require_once($CFG->libdir.'/tablelib.php');
-    require_once($CFG->libdir.'/pluginlib.php');
 
     // defines
     define('MODULE_TABLE','module_administration_table');
@@ -48,7 +47,7 @@
                                 FROM {course_modules}
                                WHERE visibleold=1 AND module=?)",
                 array($module->id));
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
 
@@ -65,7 +64,7 @@
                                 FROM {course_modules}
                                WHERE visible=1 AND module=?)",
                 array($module->id));
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
 
     // construct the flexible table ready to display
     $table = new flexible_table(MODULE_TABLE);
     $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'uninstall', 'settings'));
-    $table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $struninstall, $strsettings));
+    $table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strsettings, $struninstall));
     $table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
     $table->set_attribute('id', 'modules');
-    $table->set_attribute('class', 'generaltable');
+    $table->set_attribute('class', 'admintable generaltable');
     $table->setup();
 
     foreach ($modules as $module) {
         }
 
         $uninstall = '';
-        if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('mod_'.$module->name)) {
+        if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('mod_'.$module->name, 'manage')) {
             $uninstall = html_writer::link($uninstallurl, $struninstall);
         }
 
         } else {
             $visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=".sesskey()."\" title=\"$strshow\">".
                        "<img src=\"" . $OUTPUT->pix_url('t/show') . "\" class=\"iconsmall\" alt=\"$strshow\" /></a>";
-            $class =   ' class="dimmed_text"';
+            $class =   'dimmed_text';
         }
         if ($module->name == "forum") {
             $uninstall = "";
         $version = get_config('mod_'.$module->name, 'version');
 
         $table->add_data(array(
-            '<span'.$class.'>'.$strmodulename.'</span>',
+            $strmodulename,
             $countlink,
-            '<span'.$class.'>'.$version.'</span>',
+            $version,
             $visible,
+            $settings,
             $uninstall,
-            $settings
-        ));
+        ), $class);
     }
 
     $table->print_html();
index d5fc85a..d004869 100644 (file)
@@ -29,7 +29,6 @@
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 
 admin_externalpage_setup('manageplagiarismplugins');
@@ -74,7 +73,7 @@ foreach ($plagiarismplugins as $plugin => $dir) {
         }
         // uninstall link.
         $uninstall = '';
-        if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin)) {
+        if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin, 'manage')) {
             $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
         }
         $table->data[] = array($displayname, $version, $uninstall, $settings);
index a092e00..c156f9d 100644 (file)
 
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 require_once($CFG->libdir . '/filelib.php');
 
 $fetchremote = optional_param('fetchremote', false, PARAM_BOOL);
 $updatesonly = optional_param('updatesonly', false, PARAM_BOOL);
 $contribonly = optional_param('contribonly', false, PARAM_BOOL);
-$uninstall = optional_param('uninstall', '', PARAM_COMPONENT);
-$delete = optional_param('delete', '', PARAM_COMPONENT);
-$confirmed = optional_param('confirm', false, PARAM_BOOL);
+$uninstall   = optional_param('uninstall', '', PARAM_COMPONENT);
+$delete      = optional_param('delete', '', PARAM_COMPONENT);
+$confirmed   = optional_param('confirm', false, PARAM_BOOL);
+$return      = optional_param('return', 'overview', PARAM_ALPHA);
 
 // NOTE: do not use admin_externalpage_setup() here because it loads
 //       full admin tree which is not possible during uninstallation.
@@ -52,7 +52,7 @@ require_login();
 $syscontext = context_system::instance();
 require_capability('moodle/site:config', $syscontext);
 
-$pluginman = plugin_manager::instance();
+$pluginman = core_plugin_manager::instance();
 
 if ($uninstall) {
     require_sesskey();
@@ -74,7 +74,7 @@ if ($uninstall) {
     // Make sure we know the plugin.
     if (is_null($pluginfo)) {
         throw new moodle_exception('err_uninstalling_unknown_plugin', 'core_plugin', '', array('plugin' => $uninstall),
-            'plugin_manager::get_plugin_info() returned null for the plugin to be uninstalled');
+            'core_plugin_manager::get_plugin_info() returned null for the plugin to be uninstalled');
     }
 
     $pluginname = $pluginman->plugin_name($pluginfo->component);
@@ -84,15 +84,17 @@ if ($uninstall) {
     if (!$pluginman->can_uninstall_plugin($pluginfo->component)) {
         throw new moodle_exception('err_cannot_uninstall_plugin', 'core_plugin', '',
             array('plugin' => $pluginfo->component),
-            'plugin_manager::can_uninstall_plugin() returned false');
+            'core_plugin_manager::can_uninstall_plugin() returned false');
     }
 
     if (!$confirmed) {
-        $continueurl = new moodle_url($PAGE->url, array('uninstall' => $pluginfo->component, 'sesskey' => sesskey(), 'confirm' => 1));
-        echo $output->plugin_uninstall_confirm_page($pluginman, $pluginfo, $continueurl);
+        $continueurl = new moodle_url($PAGE->url, array('uninstall' => $pluginfo->component, 'sesskey' => sesskey(), 'confirm' => 1, 'return'=>$return));
+        $cancelurl = $pluginfo->get_return_url_after_uninstall($return);
+        echo $output->plugin_uninstall_confirm_page($pluginman, $pluginfo, $continueurl, $cancelurl);
         exit();
 
     } else {
+        $SESSION->pluginuninstallreturn = $pluginfo->get_return_url_after_uninstall($return);
         $progress = new progress_trace_buffer(new text_progress_trace(), false);
         $pluginman->uninstall_plugin($pluginfo->component, $progress);
         $progress->finished();
@@ -133,7 +135,7 @@ if ($delete and $confirmed) {
     // Make sure we know the plugin.
     if (is_null($pluginfo)) {
         throw new moodle_exception('err_removing_unknown_plugin', 'core_plugin', '', array('plugin' => $delete),
-            'plugin_manager::get_plugin_info() returned null for the plugin to be deleted');
+            'core_plugin_manager::get_plugin_info() returned null for the plugin to be deleted');
     }
 
     $pluginname = $pluginman->plugin_name($pluginfo->component);
@@ -144,7 +146,7 @@ if ($delete and $confirmed) {
     if (!is_null($pluginfo->versiondb)) {
         throw new moodle_exception('err_removing_installed_plugin', 'core_plugin', '',
             array('plugin' => $pluginfo->component, 'versiondb' => $pluginfo->versiondb),
-            'plugin_manager::get_plugin_info() returned not-null versiondb for the plugin to be deleted');
+            'core_plugin_manager::get_plugin_info() returned not-null versiondb for the plugin to be deleted');
     }
 
     // Make sure the folder is removable.
@@ -176,7 +178,7 @@ admin_externalpage_setup('pluginsoverview');
 /** @var core_admin_renderer $output */
 $output = $PAGE->get_renderer('core', 'admin');
 
-$checker = available_update_checker::instance();
+$checker = \core\update\checker::instance();
 
 // Filtering options.
 $options = array(
@@ -190,7 +192,7 @@ if ($fetchremote) {
     redirect(new moodle_url($PAGE->url, $options));
 }
 
-$deployer = available_update_deployer::instance();
+$deployer = \core\update\deployer::instance();
 if ($deployer->enabled()) {
     $myurl = new moodle_url($PAGE->url, array('updatesonly' => $updatesonly, 'contribonly' => $contribonly));
     $deployer->initialize($myurl, new moodle_url('/admin'));
index 3b460fd..48237bb 100644 (file)
@@ -4,7 +4,6 @@ require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->libdir . '/portfoliolib.php');
 require_once($CFG->libdir . '/portfolio/forms.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 
 $portfolio     = optional_param('pf', '', PARAM_ALPHANUMEXT);
 $action        = optional_param('action', '', PARAM_ALPHA);
@@ -89,7 +88,7 @@ if (($action == 'edit') || ($action == 'new')) {
         } else {
             portfolio_static_function($plugin, 'create_instance', $plugin, $fromform->name, $fromform);
         }
-        plugin_manager::reset_caches();
+        core_plugin_manager::reset_caches();
         $savedstr = get_string('instancesaved', 'portfolio');
         redirect($baseurl, $savedstr, 1);
         exit;
@@ -118,7 +117,7 @@ if (($action == 'edit') || ($action == 'new')) {
 
     $instance->set('visible', $visible);
     $instance->save();
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     $return = true;
 } else if ($action == 'delete') {
     $instance = portfolio_instance($portfolio);
index 8e98af4..7cd027e 100644 (file)
@@ -28,7 +28,6 @@
 require_once(dirname(__FILE__) . '/../config.php');
 require_once($CFG->libdir . '/questionlib.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 require_once($CFG->libdir . '/tablelib.php');
 
 // Check permissions.
@@ -40,7 +39,7 @@ admin_externalpage_setup('manageqbehaviours');
 $thispageurl = new moodle_url('/admin/qbehaviours.php');
 
 $behaviours = core_component::get_plugin_list('qbehaviour');
-$pluginmanager = plugin_manager::instance();
+$pluginmanager = core_plugin_manager::instance();
 
 // Get some data we will need - question counts and which types are needed.
 $counts = $DB->get_records_sql_menu("
@@ -92,7 +91,7 @@ if (($disable = optional_param('disable', '', PARAM_PLUGIN)) && confirm_sesskey(
         $disabledbehaviours[] = $disable;
         set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
     }
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     redirect($thispageurl);
 }
 
@@ -110,7 +109,7 @@ if (($enable = optional_param('enable', '', PARAM_PLUGIN)) && confirm_sesskey())
         unset($disabledbehaviours[$key]);
         set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
     }
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     redirect($thispageurl);
 }
 
@@ -138,65 +137,6 @@ if (($down = optional_param('down', '', PARAM_PLUGIN)) && confirm_sesskey()) {
     redirect($thispageurl);
 }
 
-// Delete.
-if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) {
-    // Check it is OK to delete this question type.
-    if ($delete == 'missing') {
-        print_error('cannotdeletemissingbehaviour', 'question', $thispageurl);
-    }
-
-    if (!isset($behaviours[$delete]) && !get_config('qbehaviour_' . $delete, 'version')) {
-        print_error('unknownbehaviour', 'question', $thispageurl, $delete);
-    }
-
-    $behaviourname = $sortedbehaviours[$delete];
-    if ($counts[$delete] > 0) {
-        print_error('cannotdeletebehaviourinuse', 'question', $thispageurl, $behaviourname);
-    }
-    if ($needed[$delete] > 0) {
-        print_error('cannotdeleteneededbehaviour', 'question', $thispageurl, $behaviourname);
-    }
-
-    // If not yet confirmed, display a confirmation message.
-    if (!optional_param('confirm', '', PARAM_BOOL)) {
-        echo $OUTPUT->header();
-        echo $OUTPUT->heading(get_string('deletebehaviourareyousure', 'question', $behaviourname));
-        echo $OUTPUT->confirm(
-                get_string('deletebehaviourareyousuremessage', 'question', $behaviourname),
-                new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
-                $thispageurl);
-        echo $OUTPUT->footer();
-        exit;
-    }
-
-    // Do the deletion.
-    echo $OUTPUT->header();
-    echo $OUTPUT->heading(get_string('deletingbehaviour', 'question', $behaviourname));
-
-    // Remove this behaviour from configurations where it might appear.
-    if (($key = array_search($delete, $disabledbehaviours)) !== false) {
-        unset($disabledbehaviours[$key]);
-        set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
-    }
-    $behaviourorder = array_keys($sortedbehaviours);
-    if (($key = array_search($delete, $behaviourorder)) !== false) {
-        unset($behaviourorder[$key]);
-        set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
-    }
-
-    // Then uninstall the plugin.
-    uninstall_plugin('qbehaviour', $delete);
-
-    // Display a message.
-    $a = new stdClass();
-    $a->behaviour = $behaviourname;
-    $a->directory = core_component::get_plugin_directory('qbehaviour', $delete);
-    echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice');
-    echo $OUTPUT->continue_button($thispageurl);
-    echo $OUTPUT->footer();
-    exit;
-}
-
 // End of process actions ==================================================
 
 // Print the page heading.
@@ -207,12 +147,12 @@ echo $OUTPUT->heading(get_string('manageqbehaviours', 'admin'));
 $table = new flexible_table('qbehaviouradmintable');
 $table->define_baseurl($thispageurl);
 $table->define_columns(array('behaviour', 'numqas', 'version', 'requires',
-        'available', 'delete'));
+        'available', 'uninstall'));
 $table->define_headers(array(get_string('behaviour', 'question'), get_string('numqas', 'question'),
         get_string('version'), get_string('requires', 'admin'),
-        get_string('availableq', 'question'), get_string('delete')));
+        get_string('availableq', 'question'), get_string('uninstallplugin', 'core_admin')));
 $table->set_attribute('id', 'qbehaviours');
-$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
+$table->set_attribute('class', 'generaltable admintable');
 $table->setup();
 
 // Add a row for each question type.
@@ -267,9 +207,11 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
     if ($needed[$behaviour]) {
         $row[] = '';
     } else {
-        $row[] = html_writer::link(new moodle_url($thispageurl,
-                array('delete' => $behaviour, 'sesskey' => sesskey())), get_string('delete'),
+        $uninstallurl = core_plugin_manager::instance()->get_uninstall_url('qbehaviour_'.$behaviour, 'manage');
+        if ($uninstallurl) {
+            $row[] = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'),
                 array('title' => get_string('uninstallbehaviour', 'question')));
+        }
     }
 
     $table->add_data($row, $rowclass);
index 3e865d1..80c6c6d 100644 (file)
@@ -28,7 +28,6 @@
 require_once(dirname(__FILE__) . '/../config.php');
 require_once($CFG->libdir . '/questionlib.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 require_once($CFG->libdir . '/tablelib.php');
 
 // Check permissions.
@@ -41,7 +40,7 @@ admin_externalpage_setup('manageqtypes');
 $thispageurl = new moodle_url('/admin/qtypes.php');
 
 $qtypes = question_bank::get_all_qtypes();
-$pluginmanager = plugin_manager::instance();
+$pluginmanager = core_plugin_manager::instance();
 
 // Get some data we will need - question counts and which types are needed.
 $counts = $DB->get_records_sql("
@@ -122,58 +121,6 @@ if (($down = optional_param('down', '', PARAM_PLUGIN)) && confirm_sesskey()) {
     redirect($thispageurl);
 }
 
-// Delete.
-if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) {
-    // Check it is OK to delete this question type.
-    if ($delete == 'missingtype') {
-        print_error('cannotdeletemissingqtype', 'question', $thispageurl);
-    }
-
-    if (!isset($qtypes[$delete]) && !get_config('qtype_' . $delete, 'version')) {
-        print_error('unknownquestiontype', 'question', $thispageurl, $delete);
-    }
-
-    $qtypename = $qtypes[$delete]->local_name();
-    if ($counts[$delete]->numquestions + $counts[$delete]->numhidden > 0) {
-        print_error('cannotdeleteqtypeinuse', 'question', $thispageurl, $qtypename);
-    }
-
-    if ($needed[$delete] > 0) {
-        print_error('cannotdeleteqtypeneeded', 'question', $thispageurl, $qtypename);
-    }
-
-    // If not yet confirmed, display a confirmation message.
-    if (!optional_param('confirm', '', PARAM_BOOL)) {
-        $qtypename = $qtypes[$delete]->local_name();
-        echo $OUTPUT->header();
-        echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'question', $qtypename));
-        echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'question', $qtypename),
-                new moodle_url($thispageurl, array('delete' => $delete, 'confirm' => 1)),
-                $thispageurl);
-        echo $OUTPUT->footer();
-        exit;
-    }
-
-    // Do the deletion.
-    echo $OUTPUT->header();
-    echo $OUTPUT->heading(get_string('deletingqtype', 'question', $qtypename));
-
-    // Delete any questoin configuration records mentioning this plugin.
-    unset_config($delete . '_disabled', 'question');
-    unset_config($delete . '_sortorder', 'question');
-
-    // Then uninstall the plugin.
-    uninstall_plugin('qtype', $delete);
-
-    $a = new stdClass();
-    $a->qtype = $qtypename;
-    $a->directory = $qtypes[$delete]->plugin_dir();
-    echo $OUTPUT->box(get_string('qtypedeletefiles', 'question', $a), 'generalbox', 'notice');
-    echo $OUTPUT->continue_button($thispageurl);
-    echo $OUTPUT->footer();
-    exit;
-}
-
 // End of process actions ==================================================
 
 // Print the page heading.
@@ -184,10 +131,10 @@ echo $OUTPUT->heading(get_string('manageqtypes', 'admin'));
 $table = new flexible_table('qtypeadmintable');
 $table->define_baseurl($thispageurl);
 $table->define_columns(array('questiontype', 'numquestions', 'version', 'requires',
-        'availableto', 'delete', 'settings'));
+        'availableto', 'uninstall', 'settings'));
 $table->define_headers(array(get_string('questiontype', 'question'), get_string('numquestions', 'question'),
         get_string('version'), get_string('requires', 'admin'), get_string('availableq', 'question'),
-        get_string('delete'), get_string('settings')));
+        get_string('settings'), get_string('uninstallplugin', 'core_admin')));
 $table->set_attribute('id', 'qtypes');
 $table->set_attribute('class', 'admintable generaltable');
 $table->setup();
@@ -259,15 +206,6 @@ foreach ($sortedqtypes as $qtypename => $localname) {
     $icons .= question_type_icon_html('down', $qtypename, 't/down', get_string('down'), '');
     $row[] = $icons;
 
-    // Delete link, if available.
-    if ($needed[$qtypename]) {
-        $row[] = '';
-    } else {
-        $row[] = html_writer::link(new moodle_url($thispageurl,
-                array('delete' => $qtypename, 'sesskey' => sesskey())), get_string('delete'),
-                array('title' => get_string('uninstallqtype', 'question')));
-    }
-
     // Settings link, if available.
     $settings = admin_get_root()->locate('qtypesetting' . $qtypename);
     if ($settings instanceof admin_externalpage) {
@@ -279,6 +217,17 @@ foreach ($sortedqtypes as $qtypename => $localname) {
         $row[] = '';
     }
 
+    // Uninstall link, if available.
+    if ($needed[$qtypename]) {
+        $row[] = '';
+    } else {
+        $uninstallurl = core_plugin_manager::instance()->get_uninstall_url('qtype_'.$qtypename, 'manage');
+        if ($uninstallurl) {
+            $row[] = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'),
+                array('title' => get_string('uninstallqtype', 'question')));
+        }
+    }
+
     $table->add_data($row, $rowclass);
 }
 
index ca1a28c..0f84e00 100644 (file)
@@ -25,7 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-require_once($CFG->libdir . '/pluginlib.php');
 
 /**
  * Standard HTML output renderer for core_admin subsystem
@@ -121,7 +120,7 @@ class core_admin_renderer extends plugin_renderer_base {
         $output .= $this->header();
         $output .= $this->heading(get_string('pluginscheck', 'admin'));
         $output .= $this->warning(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
-        $output .= $this->plugins_check_table(plugin_manager::instance(), $version, array('xdep' => true));
+        $output .= $this->plugins_check_table(core_plugin_manager::instance(), $version, array('xdep' => true));
         $output .= $this->warning(get_string('pluginschecktodo', 'admin'));
         $output .= $this->continue_button($reloadurl);
 
@@ -190,15 +189,15 @@ class core_admin_renderer extends plugin_renderer_base {
 
     /**
      * Display the upgrade page that lists all the plugins that require attention.
-     * @param plugin_manager $pluginman provides information about the plugins.
-     * @param available_update_checker $checker provides information about available updates.
+     * @param core_plugin_manager $pluginman provides information about the plugins.
+     * @param \core\update\checker $checker provides information about available updates.
      * @param int $version the version of the Moodle code from version.php.
      * @param bool $showallplugins
      * @param moodle_url $reloadurl
      * @param moodle_url $continueurl
      * @return string HTML to output.
      */
-    public function upgrade_plugin_check_page(plugin_manager $pluginman, available_update_checker $checker,
+    public function upgrade_plugin_check_page(core_plugin_manager $pluginman, \core\update\checker $checker,
             $version, $showallplugins, $reloadurl, $continueurl) {
         global $CFG;
 
@@ -240,11 +239,11 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Prints a page with a summary of plugin deployment to be confirmed.
      *
-     * @param available_update_deployer $deployer
-     * @param array $data deployer's data package as returned by {@link available_update_deployer::submitted_data()}
+     * @param \core\update\deployer $deployer
+     * @param array $data deployer's data package as returned by {@link \core\update\deployer::submitted_data()}
      * @return string
      */
-    public function upgrade_plugin_confirm_deploy_page(available_update_deployer $deployer, array $data) {
+    public function upgrade_plugin_confirm_deploy_page(\core\update\deployer $deployer, array $data) {
 
         if (!$deployer->initialized()) {
             throw new coding_exception('Unable to render a page for non-initialized deployer.');
@@ -302,7 +301,7 @@ class core_admin_renderer extends plugin_renderer_base {
      * @param bool $dbproblems warn db has problems
      * @param bool $maintenancemode warn in maintenance mode
      * @param bool $buggyiconvnomb warn iconv problems
-     * @param array|null $availableupdates array of available_update_info objects or null
+     * @param array|null $availableupdates array of \core\update\info objects or null
      * @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
      *
      * @return string HTML to output.
@@ -341,12 +340,12 @@ class core_admin_renderer extends plugin_renderer_base {
      *  bool contribonly - show only contributed extensions
      *  bool updatesonly - show only plugins with an available update
      *
-     * @param plugin_manager $pluginman
-     * @param available_update_checker $checker
+     * @param core_plugin_manager $pluginman
+     * @param \core\update\checker $checker
      * @param array $options filtering options
      * @return string HTML to output.
      */
-    public function plugin_management_page(plugin_manager $pluginman, available_update_checker $checker, array $options = array()) {
+    public function plugin_management_page(core_plugin_manager $pluginman, \core\update\checker $checker, array $options = array()) {
         global $CFG;
 
         $output = '';
@@ -377,12 +376,13 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Display a page to confirm the plugin uninstallation.
      *
-     * @param plugin_manager $pluginman
-     * @param plugininfo_base $pluginfo
+     * @param core_plugin_manager $pluginman
+     * @param \core\plugininfo\base $pluginfo
      * @param moodle_url $continueurl URL to continue after confirmation
+     * @param moodle_url $cancelurl URL to to go if cancelled
      * @return string
      */
-    public function plugin_uninstall_confirm_page(plugin_manager $pluginman, plugininfo_base $pluginfo, moodle_url $continueurl) {
+    public function plugin_uninstall_confirm_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, moodle_url $continueurl, moodle_url $cancelurl) {
         $output = '';
 
         $pluginname = $pluginman->plugin_name($pluginfo->component);
@@ -394,7 +394,7 @@ class core_admin_renderer extends plugin_renderer_base {
 
         $output .= $this->output->header();
         $output .= $this->output->heading(get_string('uninstalling', 'core_plugin', array('name' => $pluginname)));
-        $output .= $this->output->confirm($confirm, $continueurl, $this->page->url);
+        $output .= $this->output->confirm($confirm, $continueurl, $cancelurl);
         $output .= $this->output->footer();
 
         return $output;
@@ -403,13 +403,13 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Display a page with results of plugin uninstallation and offer removal of plugin files.
      *
-     * @param plugin_manager $pluginman
-     * @param plugininfo_base $pluginfo
+     * @param core_plugin_manager $pluginman
+     * @param \core\plugininfo\base $pluginfo
      * @param progress_trace_buffer $progress
      * @param moodle_url $continueurl URL to continue to remove the plugin folder
      * @return string
      */
-    public function plugin_uninstall_results_removable_page(plugin_manager $pluginman, plugininfo_base $pluginfo,
+    public function plugin_uninstall_results_removable_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo,
                                                             progress_trace_buffer $progress, moodle_url $continueurl) {
         $output = '';
 
@@ -442,12 +442,12 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Display a page with results of plugin uninstallation and inform about the need to remove plugin files manually.
      *
-     * @param plugin_manager $pluginman
-     * @param plugininfo_base $pluginfo
+     * @param core_plugin_manager $pluginman
+     * @param \core\plugininfo\base $pluginfo
      * @param progress_trace_buffer $progress
      * @return string
      */
-    public function plugin_uninstall_results_page(plugin_manager $pluginman, plugininfo_base $pluginfo, progress_trace_buffer $progress) {
+    public function plugin_uninstall_results_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, progress_trace_buffer $progress) {
         $output = '';
 
         $pluginname = $pluginfo->component;
@@ -676,7 +676,7 @@ class core_admin_renderer extends plugin_renderer_base {
      * The structure of the $updates param has changed since 2.4. It contains not only updates
      * for the core itself, but also for all other installed plugins.
      *
-     * @param array|null $updates array of (string)component => array of available_update_info objects or null
+     * @param array|null $updates array of (string)component => array of \core\update\info objects or null
      * @param int|null $fetch timestamp of the most recent updates fetch or null (unknown)
      * @return string
      */
@@ -748,9 +748,9 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Helper method to render the information about the available Moodle update
      *
-     * @param available_update_info $updateinfo information about the available Moodle core update
+     * @param \core\update\info $updateinfo information about the available Moodle core update
      */
-    protected function moodle_available_update_info(available_update_info $updateinfo) {
+    protected function moodle_available_update_info(\core\update\info $updateinfo) {
 
         $boxclasses = 'moodleupdateinfo';
         $info = array();
@@ -817,12 +817,12 @@ class core_admin_renderer extends plugin_renderer_base {
      *     (bool)full = false: whether to display up-to-date plugins, too
      *     (bool)xdep = false: display the plugins with unsatisified dependecies only
      *
-     * @param plugin_manager $pluginman provides information about the plugins.
+     * @param core_plugin_manager $pluginman provides information about the plugins.
      * @param int $version the version of the Moodle code from version.php.
      * @param array $options rendering options
      * @return string HTML code
      */
-    public function plugins_check_table(plugin_manager $pluginman, $version, array $options = array()) {
+    public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array()) {
         global $CFG;
 
         $plugininfo = $pluginman->get_plugins();
@@ -915,7 +915,7 @@ class core_admin_renderer extends plugin_renderer_base {
                 $requires = new html_table_cell($this->required_column($plugin, $pluginman, $version));
 
                 $statusisboring = in_array($statuscode, array(
-                        plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE));
+                        core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE));
 
                 $coredependency = $plugin->is_core_dependency_satisfied($version);
                 $otherpluginsdependencies = $pluginman->are_dependencies_satisfied($plugin->get_other_required_plugins());
@@ -991,12 +991,12 @@ class core_admin_renderer extends plugin_renderer_base {
 
     /**
      * Formats the information that needs to go in the 'Requires' column.
-     * @param plugininfo_base $plugin the plugin we are rendering the row for.
-     * @param plugin_manager $pluginman provides data on all the plugins.
+     * @param \core\plugininfo\base $plugin the plugin we are rendering the row for.
+     * @param core_plugin_manager $pluginman provides data on all the plugins.
      * @param string $version
      * @return string HTML code
      */
-    protected function required_column(plugininfo_base $plugin, plugin_manager $pluginman, $version) {
+    protected function required_column(\core\plugininfo\base $plugin, core_plugin_manager $pluginman, $version) {
         $requires = array();
 
         if (!empty($plugin->versionrequires)) {
@@ -1048,11 +1048,11 @@ class core_admin_renderer extends plugin_renderer_base {
     /**
      * Prints an overview about the plugins - number of installed, number of extensions etc.
      *
-     * @param plugin_manager $pluginman provides information about the plugins
+     * @param core_plugin_manager $pluginman provides information about the plugins
      * @param array $options filtering options
      * @return string as usually
      */
-    public function plugins_overview_panel(plugin_manager $pluginman, array $options = array()) {
+    public function plugins_overview_panel(core_plugin_manager $pluginman, array $options = array()) {
         global $CFG;
 
         $plugininfo = $pluginman->get_plugins();
@@ -1061,7 +1061,7 @@ class core_admin_renderer extends plugin_renderer_base {
 
         foreach ($plugininfo as $type => $plugins) {
             foreach ($plugins as $name => $plugin) {
-                if ($plugin->get_status() === plugin_manager::PLUGIN_STATUS_MISSING) {
+                if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
                     continue;
                 }
                 $numtotal++;
@@ -1128,11 +1128,11 @@ class core_admin_renderer extends plugin_renderer_base {
      *
      * This default implementation renders all plugins into one big table.
      *
-     * @param plugin_manager $pluginman provides information about the plugins.
+     * @param core_plugin_manager $pluginman provides information about the plugins.
      * @param array $options filtering options
      * @return string HTML code
      */
-    public function plugins_control_panel(plugin_manager $pluginman, array $options = array()) {
+    public function plugins_control_panel(core_plugin_manager $pluginman, array $options = array()) {
         global $CFG;
 
         $plugininfo = $pluginman->get_plugins();
@@ -1186,8 +1186,12 @@ class core_admin_renderer extends plugin_renderer_base {
         );
 
         foreach ($plugininfo as $type => $plugins) {
-
-            $header = new html_table_cell($pluginman->plugintype_name_plural($type));
+            $heading = $pluginman->plugintype_name_plural($type);
+            $pluginclass = core_plugin_manager::resolve_plugininfo_class($type);
+            if ($manageurl = $pluginclass::get_manage_url()) {
+                $heading = html_writer::link($manageurl, $heading);
+            }
+            $header = new html_table_cell(html_writer::tag('span', $heading, array('id'=>'plugin_type_cell_'.$type)));
             $header->header = true;
             $header->colspan = array_sum($table->headspan);
             $header = new html_table_row(array($header));
@@ -1214,9 +1218,9 @@ class core_admin_renderer extends plugin_renderer_base {
                 }
                 $status = $plugin->get_status();
                 $row->attributes['class'] .= ' status-'.$status;
-                if ($status === plugin_manager::PLUGIN_STATUS_MISSING) {
+                if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
                     $msg = html_writer::tag('span', get_string('status_missing', 'core_plugin'), array('class' => 'statusmsg'));
-                } else if ($status === plugin_manager::PLUGIN_STATUS_NEW) {
+                } else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
                     $msg = html_writer::tag('span', get_string('status_new', 'core_plugin'), array('class' => 'statusmsg'));
                 } else {
                     $msg = '';
@@ -1254,8 +1258,7 @@ class core_admin_renderer extends plugin_renderer_base {
                 }
                 $settings = new html_table_cell($settings);
 
-                if ($pluginman->can_uninstall_plugin($plugin->component)) {
-                    $uninstallurl = $plugin->get_uninstall_url();
+                if ($uninstallurl = $pluginman->get_uninstall_url($plugin->component, 'overview')) {
                     $uninstall = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'));
                 } else {
                     $uninstall = '';
@@ -1295,9 +1298,9 @@ class core_admin_renderer extends plugin_renderer_base {
      * The passed objects always provides at least the 'version' property containing
      * the (higher) version of the plugin available.
      *
-     * @param available_update_info $updateinfo information about the available update for the plugin
+     * @param \core\update\info $updateinfo information about the available update for the plugin
      */
-    protected function plugin_available_update_info(available_update_info $updateinfo) {
+    protected function plugin_available_update_info(\core\update\info $updateinfo) {
 
         $boxclasses = 'pluginupdateinfo';
         $info = array();
@@ -1326,7 +1329,7 @@ class core_admin_renderer extends plugin_renderer_base {
         $box .= html_writer::tag('div', get_string('updateavailable', 'core_plugin', $updateinfo->version), array('class' => 'version'));
         $box .= $this->output->box(implode(html_writer::tag('span', ' ', array('class' => 'separator')), $info), '');
 
-        $deployer = available_update_deployer::instance();
+        $deployer = \core\update\deployer::instance();
         if ($deployer->initialized()) {
             $impediments = $deployer->deployment_impediments($updateinfo);
             if (empty($impediments)) {
index 879497c..46c244f 100644 (file)
@@ -30,7 +30,6 @@
 require_once(dirname(__FILE__) . '/../config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 
 admin_externalpage_setup('managereports');
 
@@ -46,7 +45,7 @@ $table->define_columns(array('name', 'version', 'uninstall'));
 $table->define_headers(array(get_string('plugin'), get_string('version'), $struninstall));
 $table->define_baseurl($PAGE->url);
 $table->set_attribute('id', 'reportplugins');
-$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
+$table->set_attribute('class', 'admintable generaltable');
 $table->setup();
 
 $plugins = array();
@@ -74,7 +73,7 @@ foreach ($installed as $config) {
 
 foreach ($plugins as $plugin => $name) {
     $uninstall = '';
-    if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('report_'.$plugin)) {
+    if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('report_'.$plugin, 'manage')) {
         $uninstall = html_writer::link($uninstallurl, $struninstall);
     }
 
index 05fc755..1e991e4 100644 (file)
@@ -17,7 +17,6 @@
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->dirroot . '/repository/lib.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 
 $repository       = optional_param('repos', '', PARAM_ALPHANUMEXT);
 $action           = optional_param('action', '', PARAM_ALPHANUMEXT);
@@ -149,7 +148,7 @@ if (($action == 'edit') || ($action == 'new')) {
         }
         if ($success) {
             // configs saved
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
             redirect($baseurl);
         } else {
             print_error('instancenotsaved', 'repository', $baseurl);
@@ -190,7 +189,7 @@ if (($action == 'edit') || ($action == 'new')) {
         print_error('invalidplugin', 'repository', '', $repository);
     }
     $repositorytype->update_visibility(true);
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     $return = true;
 } else if ($action == 'hide') {
     if (!confirm_sesskey()) {
@@ -201,7 +200,7 @@ if (($action == 'edit') || ($action == 'new')) {
         print_error('invalidplugin', 'repository', '', $repository);
     }
     $repositorytype->update_visibility(false);
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     $return = true;
 } else if ($action == 'delete') {
     $repositorytype = repository::get_type_by_typename($repository);
@@ -212,7 +211,7 @@ if (($action == 'edit') || ($action == 'new')) {
         }
 
         if ($repositorytype->delete($downloadcontents)) {
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
             redirect($baseurl);
         } else {
             print_error('instancenotdeleted', 'repository', $baseurl);
index 3def4f3..0373857 100644 (file)
@@ -17,7 +17,6 @@
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->dirroot . '/repository/lib.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->libdir . '/pluginlib.php');
 
 require_sesskey();
 
@@ -103,7 +102,7 @@ if (!empty($edit) || !empty($new)) {
             $data = data_submitted();
         }
         if ($success) {
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
             redirect($parenturl);
         } else {
             print_error('instancenotsaved', 'repository', $parenturl);
@@ -120,7 +119,7 @@ if (!empty($edit) || !empty($new)) {
 } else if (!empty($hide)) {
     $instance = repository::get_type_by_typename($hide);
     $instance->hide();
-    plugin_manager::reset_caches();
+    core_plugin_manager::reset_caches();
     $return = true;
 } else if (!empty($delete)) {
     $instance = repository::get_instance($delete);
@@ -133,7 +132,7 @@ if (!empty($edit) || !empty($new)) {
     if ($sure) {
         if ($instance->delete($downloadcontents)) {
             $deletedstr = get_string('instancedeleted', 'repository');
-            plugin_manager::reset_caches();
+            core_plugin_manager::reset_caches();
             redirect($parenturl, $deletedstr, 3);
         } else {
             print_error('instancenotdeleted', 'repository', $parenturl);
index cce2334..980e2ae 100644 (file)
@@ -29,6 +29,7 @@ define("MAX_USERS_TO_LIST_PER_ROLE", 10);
 
 $contextid = required_param('contextid', PARAM_INT);
 $roleid    = optional_param('roleid', 0, PARAM_INT);
+$returnto  = optional_param('return', null, PARAM_ALPHANUMEXT);
 
 list($context, $course, $cm) = get_context_info_array($contextid);
 
@@ -181,6 +182,9 @@ if ($roleid) {
 
     // Print the form.
     $assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
+    if ($returnto !== null) {
+        $assignurl->param('return', $returnto);
+    }
 ?>
 <form id="assignform" method="post" action="<?php echo $assignurl ?>"><div>
   <input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
@@ -225,10 +229,17 @@ if ($roleid) {
     // Print a form to swap roles, and a link back to the all roles list.
     echo '<div class="backlink">';
 
-    $select = new single_select($PAGE->url, 'roleid', $nameswithcounts, $roleid, null);
+    $newroleurl = new moodle_url($PAGE->url);
+    if ($returnto !== null) {
+        $newroleurl->param('return', $returnto);
+    }
+    $select = new single_select($newroleurl, 'roleid', $nameswithcounts, $roleid, null);
     $select->label = get_string('assignanotherrole', 'core_role');
     echo $OUTPUT->render($select);
     $backurl = new moodle_url('/admin/roles/assign.php', array('contextid' => $contextid));
+    if ($returnto !== null) {
+        $backurl->param('return', $returnto);
+    }
     echo '<p><a href="' . $backurl->out() . '">' . get_string('backtoallroles', 'core_role') . '</a></p>';
     echo '</div>';
 
@@ -255,7 +266,8 @@ if ($roleid) {
     foreach ($assignableroles as $roleid => $notused) {
         $roleusers = '';
         if (0 < $assigncounts[$roleid] && $assigncounts[$roleid] <= MAX_USERS_TO_LIST_PER_ROLE) {
-            $roleusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname');
+            $userfields = 'u.id, u.username, ' . get_all_user_name_fields(true, 'u');
+            $roleusers = get_role_users($roleid, $context, false, $userfields);
             if (!empty($roleusers)) {
                 $strroleusers = array();
                 foreach ($roleusers as $user) {
@@ -266,6 +278,9 @@ if ($roleid) {
             }
         } else if ($assigncounts[$roleid] > MAX_USERS_TO_LIST_PER_ROLE) {
             $assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
+            if ($returnto !== null) {
+                $assignurl->param('return', $returnto);
+            }
             $roleholdernames[$roleid] = '<a href="'.$assignurl.'">'.$strmorethanmax.'</a>';
         } else {
             $roleholdernames[$roleid] = '';
@@ -286,6 +301,9 @@ if ($roleid) {
     foreach ($assignableroles as $roleid => $rolename) {
         $description = format_string($DB->get_field('role', 'description', array('id'=>$roleid)));
         $assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid));
+        if ($returnto !== null) {
+            $assignurl->param('return', $returnto);
+        }
         $row = array('<a href="'.$assignurl.'">'.$rolename.'</a>',
                 $description, $assigncounts[$roleid]);
         if ($showroleholders) {
@@ -297,8 +315,15 @@ if ($roleid) {
     echo html_writer::table($table);
 
     if ($context->contextlevel > CONTEXT_USER) {
+
+        if ($context->contextlevel === CONTEXT_COURSECAT && $returnto === 'management') {
+            $url = new moodle_url('/course/management.php', array('categoryid' => $context->instanceid));
+        } else {
+            $url = $context->get_url();
+        }
+
         echo html_writer::start_tag('div', array('class'=>'backlink'));
-        echo html_writer::tag('a', get_string('backto', '', $contextname), array('href'=>$context->get_url()));
+        echo html_writer::tag('a', get_string('backto', '', $contextname), array('href' => $url));
         echo html_writer::end_tag('div');
     }
 }
index cfff956..8af137a 100644 (file)
@@ -33,6 +33,7 @@ $prevent    = optional_param('prevent', 0, PARAM_BOOL);
 $allow      = optional_param('allow', 0, PARAM_BOOL);
 $unprohibit = optional_param('unprohibit', 0, PARAM_BOOL);
 $prohibit   = optional_param('prohibit', 0, PARAM_BOOL);
+$return     = optional_param('return', null, PARAM_ALPHANUMEXT);
 
 list($context, $course, $cm) = get_context_info_array($contextid);
 
@@ -201,8 +202,15 @@ echo $OUTPUT->box_end();
 
 
 if ($context->contextlevel > CONTEXT_USER) {
+
+    if ($context->contextlevel === CONTEXT_COURSECAT && $return === 'management') {
+        $url = new moodle_url('/course/management.php', array('categoryid' => $context->instanceid));
+    } else {
+        $url = $context->get_url();
+    }
+
     echo html_writer::start_tag('div', array('class'=>'backlink'));
-    echo html_writer::tag('a', get_string('backto', '', $contextname), array('href'=>$context->get_url()));
+    echo html_writer::tag('a', get_string('backto', '', $contextname), array('href' => $url));
     echo html_writer::end_tag('div');
 }
 
index 4005c7c..d69b8e2 100644 (file)
@@ -1,20 +1,51 @@
 <?php
-
-// This file defines settingpages and externalpages under the "courses" category
-
-if ($hassiteconfig
- or has_capability('moodle/backup:backupcourse', $systemcontext)
- or has_capability('moodle/category:manage', $systemcontext)
- or has_capability('moodle/course:create', $systemcontext)
- or has_capability('moodle/site:approvecourse', $systemcontext)) { // speedup for non-admins, add all caps used on this page
-
-    $ADMIN->add('courses', new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/manage.php',
-            array('moodle/category:manage', 'moodle/course:create')));
+// 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 defines settingpages and externalpages under the "courses" category
+ *
+ * @package core
+ * @copyright 2002 onwards Martin Dougiamas (http://dougiamas.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$capabilities = array(
+    'moodle/backup:backupcourse',
+    'moodle/category:manage',
+    'moodle/course:create',
+    'moodle/site:approvecourse'
+);
+if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
+    // Speedup for non-admins, add all caps used on this page.
+    $ADMIN->add('courses',
+        new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'),
+            $CFG->wwwroot . '/course/management.php',
+            array('moodle/category:manage', 'moodle/course:create')
+        )
+    );
+    $ADMIN->add('courses',
+        new admin_externalpage('addcategory', new lang_string('addcategory', 'admin'),
+            new moodle_url('/course/editcategory.php', array('parent' => 0)),
+            array('moodle/category:manage')
+        )
+    );
 
     // Course Default Settings Page.
     // NOTE: these settings must be applied after all other settings because they depend on them.
 
-
     // Main course settings.
     $temp = new admin_settingpage('coursesettings', new lang_string('coursesettings'));
     require_once($CFG->dirroot.'/course/lib.php');
@@ -25,7 +56,6 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'),
         1, $choices));
 
-
     // Course format.
     $temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
 
@@ -55,7 +85,6 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'),
         new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices));
 
-
     // Appearance.
     $temp->add(new admin_setting_heading('appearancehdr', new lang_string('appearance'), ''));
 
@@ -73,7 +102,6 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,
         array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
 
-
     // Files and uploads.
     $temp->add(new admin_setting_heading('filesanduploadshdr', new lang_string('filesanduploads'), ''));
 
@@ -92,13 +120,11 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', new lang_string('maximumupload'),
         new lang_string('coursehelpmaximumupload'), key($choices), $choices));
 
-
     // Completion tracking.
     $temp->add(new admin_setting_heading('progress', new lang_string('completion','completion'), ''));
     $temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion', 'completion'),
         new lang_string('enablecompletion_help', 'completion'), 0, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
 
-
     // Groups.
     $temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), ''));
     $choices = array();
@@ -119,13 +145,13 @@ if ($hassiteconfig
     $temp->add(new admin_setting_users_with_capability('courserequestnotify', new lang_string('courserequestnotify', 'admin'), new lang_string('configcourserequestnotify2', 'admin'), array(), 'moodle/site:approvecourse'));
     $ADMIN->add('courses', $temp);
 
-/// Pending course requests.
+    // Pending course requests.
     if (!empty($CFG->enablecourserequests)) {
         $ADMIN->add('courses', new admin_externalpage('coursespending', new lang_string('pendingrequests'),
                 $CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
     }
 
-    // Add a category for backups
+    // Add a category for backups.
     $ADMIN->add('courses', new admin_category('backups', new lang_string('backups','admin')));
 
     // Create a page for general backups configuration and defaults.
@@ -239,10 +265,8 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), 0));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), 1));
 
-
     //$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
     //$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
 
     $ADMIN->add('backups', $temp);
-
-} // end of speedup
+}
index 44d2546..6be22df 100644 (file)
@@ -19,6 +19,15 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $enablecssoptimiser->set_updatedcallback('theme_reset_all_caches');
     $temp->add($enablecssoptimiser);
 
+    // Backup archive .mbz format: switching to .tar.gz enables larger files, better
+    // progress reporting and possibly better performance. This is an experimental
+    // setting but if successful, should be removed and enabled by default in a future
+    // version. Note: this setting controls newly-created backups only; restore always
+    // supports both formats.
+    $temp->add(new admin_setting_configcheckbox('enabletgzbackups',
+            new lang_string('enabletgzbackups', 'admin'),
+            new lang_string('enabletgzbackups_desc', 'admin'), 0));
+
     $ADMIN->add('experimental', $temp);
 
     // "debugging" settingpage
index 19bace3..63d39ab 100644 (file)
@@ -1,23 +1,38 @@
 <?php
-
-/*
- * Please note that is file is always loaded last - it means that you can inject entries into other categories too.
- */
+// 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/>.
+
+/**
+ * Load all plugins into the admin tree.
+ *
+* Please note that is file is always loaded last - it means that you can inject entries into other categories too.
+*
+* @package    core
+* @copyright  2007 Petr Skoda {@link http://skodak.org}
+* @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+*/
 
 if ($hassiteconfig) {
-    require_once("$CFG->libdir/pluginlib.php");
-    $allplugins = plugin_manager::instance()->get_plugins();
-
     $ADMIN->add('modules', new admin_page_pluginsoverview());
 
     // activity modules
     $ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
     $ADMIN->add('modsettings', new admin_page_managemods());
-    foreach ($allplugins['mod'] as $module) {
-        if (!$module->is_updated()) {
-            continue;
-        }
-        $module->load_settings($ADMIN, 'modsettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('mod') as $plugin) {
+        /** @var \core\plugininfo\mod $plugin */
+        $plugin->load_settings($ADMIN, 'modsettings', $hassiteconfig);
     }
 
     // course formats
@@ -25,32 +40,26 @@ if ($hassiteconfig) {
     $temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin'));
     $temp->add(new admin_setting_manageformats());
     $ADMIN->add('formatsettings', $temp);
-    foreach ($allplugins['format'] as $format) {
-        if (!$format->is_updated()) {
-            continue;
-        }
-        $format->load_settings($ADMIN, 'formatsettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('format') as $plugin) {
+        /** @var \core\plugininfo\format $plugin */
+        $plugin->load_settings($ADMIN, 'formatsettings', $hassiteconfig);
     }
 
     // blocks
     $ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
     $ADMIN->add('blocksettings', new admin_page_manageblocks());
-    foreach ($allplugins['block'] as $block) {
-        if (!$block->is_updated()) {
-            continue;
-        }
-        $block->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('block') as $plugin) {
+        /** @var \core\plugininfo\block $plugin */
+        $plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
     }
 
     // message outputs
     $ADMIN->add('modules', new admin_category('messageoutputs', new lang_string('messageoutputs', 'message')));
     $ADMIN->add('messageoutputs', new admin_page_managemessageoutputs());
     $ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs());
-    foreach ($allplugins['message'] as $processor) {
-        if (!$processor->is_updated()) {
-            continue;
-        }
-        $processor->load_settings($ADMIN, 'messageoutputs', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('message') as $plugin) {
+        /** @var \core\plugininfo\message $plugin */
+        $plugin->load_settings($ADMIN, 'messageoutputs', $hassiteconfig);
     }
 
     // authentication plugins
@@ -78,11 +87,12 @@ if ($hassiteconfig) {
     $temp->add(new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS));
     $ADMIN->add('authsettings', $temp);
 
-    foreach ($allplugins['auth'] as $auth) {
-        if (!$auth->is_updated()) {
-            continue;
-        }
-        $auth->load_settings($ADMIN, 'authsettings', $hassiteconfig);
+    $temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true);
+    $ADMIN->add('authsettings', $temp);
+
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('auth') as $plugin) {
+        /** @var \core\plugininfo\auth $plugin */
+        $plugin->load_settings($ADMIN, 'authsettings', $hassiteconfig);
     }
 
     // Enrolment plugins
@@ -90,11 +100,13 @@ if ($hassiteconfig) {
     $temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol'));
     $temp->add(new admin_setting_manageenrols());
     $ADMIN->add('enrolments', $temp);
-    foreach($allplugins['enrol'] as $enrol) {
-        if (!$enrol->is_updated()) {
-            continue;
-        }
-        $enrol->load_settings($ADMIN, 'enrolments', $hassiteconfig);
+
+    $temp = new admin_externalpage('enroltestsettings', get_string('testsettings', 'core_enrol'), new moodle_url("/enrol/test_settings.php"), 'moodle/site:config', true);
+    $ADMIN->add('enrolments', $temp);
+
+    foreach(core_plugin_manager::instance()->get_plugins_of_type('enrol') as $plugin) {
+        /** @var \core\plugininfo\enrol $plugin */
+        $plugin->load_settings($ADMIN, 'enrolments', $hassiteconfig);
     }
 
 
@@ -103,11 +115,9 @@ if ($hassiteconfig) {
     $temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor'));
     $temp->add(new admin_setting_manageeditors());
     $ADMIN->add('editorsettings', $temp);
-    foreach ($allplugins['editor'] as $editor) {
-        if (!$editor->is_updated()) {
-            continue;
-        }
-        $editor->load_settings($ADMIN, 'editorsettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('editor') as $plugin) {
+        /** @var \core\plugininfo\editor $plugin */
+        $plugin->load_settings($ADMIN, 'editorsettings', $hassiteconfig);
     }
 
 /// License types
@@ -168,11 +178,9 @@ if ($hassiteconfig) {
     }
     $ADMIN->add('filtersettings', $temp);
 
-    foreach ($allplugins['filter'] as $filter) {
-        if (!$filter->is_updated()) {
-            continue;
-        }
-        $filter->load_settings($ADMIN, 'filtersettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('filter') as $plugin) {
+        /** @var \core\plugininfo\filter $plugin */
+        $plugin->load_settings($ADMIN, 'filtersettings', $hassiteconfig);
     }
 
 
@@ -251,6 +259,7 @@ if ($hassiteconfig) {
     $temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120));
     $temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1));
     $temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0));
+    $temp->add(new admin_setting_configcheckbox('legacyfilesaddallowed', new lang_string('legacyfilesaddallowed', 'admin'), new lang_string('legacyfilesaddallowed_help', 'admin'), 1));
     $ADMIN->add('repositorysettings', $temp);
     $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew',
         new lang_string('addplugin', 'repository'), $url, 'moodle/site:config', true));
@@ -262,11 +271,9 @@ if ($hassiteconfig) {
         new lang_string('createrepository', 'repository'), $url, 'moodle/site:config', true));
     $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit',
         new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true));
-    foreach ($allplugins['repository'] as $repositorytype) {
-        if (!$repositorytype->is_updated()) {
-            continue;
-        }
-        $repositorytype->load_settings($ADMIN, 'repositorysettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('repository') as $plugin) {
+        /** @var \core\plugininfo\repository $plugin */
+        $plugin->load_settings($ADMIN, 'repositorysettings', $hassiteconfig);
     }
 
 /// Web services
@@ -314,11 +321,9 @@ if ($hassiteconfig) {
                         'admin'), new lang_string('configenablewsdocumentation', 'admin', $wsdoclink), false));
     $ADMIN->add('webservicesettings', $temp);
     /// links to protocol pages
-    foreach ($allplugins['webservice'] as $webservice) {
-        if (!$webservice->is_updated()) {
-            continue;
-        }
-        $webservice->load_settings($ADMIN, 'webservicesettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('webservice') as $plugin) {
+        /** @var \core\plugininfo\webservice $plugin */
+        $plugin->load_settings($ADMIN, 'webservicesettings', $hassiteconfig);
     }
     /// manage token page link
     $ADMIN->add('webservicesettings', new admin_externalpage('addwebservicetoken', new lang_string('managetokens', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/tokens.php", 'moodle/site:config', true));
@@ -332,10 +337,6 @@ if ($hassiteconfig) {
 
 // Question type settings
 if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
-    if (!$hassiteconfig) {
-        require_once("$CFG->libdir/pluginlib.php");
-        $allplugins = plugin_manager::instance()->get_plugins();
-    }
 
     // Question behaviour settings.
     $ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin')));
@@ -392,11 +393,9 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
             get_string('responsehistory', 'question'), '', 0, $hiddenofvisible));
 
     // Settings for particular question types.
-    foreach ($allplugins['qtype'] as $qtype) {
-        if (!$qtype->is_updated()) {
-            continue;
-        }
-        $qtype->load_settings($ADMIN, 'qtypesettings', $hassiteconfig);
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('qtype') as $plugin) {
+        /** @var \core\plugininfo\qtype $plugin */
+        $plugin->load_settings($ADMIN, 'qtypesettings', $hassiteconfig);
     }
 }
 
@@ -406,10 +405,8 @@ if ($hassiteconfig && !empty($CFG->enableplagiarism)) {
     $ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'),
         $CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php'));
 
-    foreach ($allplugins['plagiarism'] as $plugin) {
-        if (!$plugin->is_updated()) {
-            continue;
-        }
+    foreach (core_plugin_manager::instance()->get_plugins_of_type('plagiarism') as $plugin) {
+        /** @var \core\plugininfo\plagiarism $plugin */
         $plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig);
     }
 }
@@ -466,12 +463,10 @@ if ($hassiteconfig) {
                                                      $CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
 }
 
-// Now add various admin tools
-foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
-    $settings_path = "$plugindir/settings.php";
-    if (file_exists($settings_path)) {
-        include($settings_path);
-    }
+// Now add various admin tools.
+foreach (core_plugin_manager::instance()->get_plugins_of_type('tool') as $plugin) {
+    /** @var \core\plugininfo\tool $plugin */
+    $plugin->load_settings($ADMIN, null, $hassiteconfig);
 }
 
 // Now add the Cache plugins
@@ -497,12 +492,9 @@ if ($hassiteconfig) {
                                                         $CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php'));
 }
 
-// extend settings for each local plugin. Note that their settings may be in any part of the
-// settings tree and may be visible not only for administrators. We can not use $allplugins here
-foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
-    $settings_path = "$plugindir/settings.php";
-    if (file_exists($settings_path)) {
-        include($settings_path);
-        continue;
-    }
+// Extend settings for each local plugin. Note that their settings may be in any part of the
+// settings tree and may be visible not only for administrators.
+foreach (core_plugin_manager::instance()->get_plugins_of_type('local') as $plugin) {
+    /** @var \core\plugininfo\local $plugin */
+    $plugin->load_settings($ADMIN, null, $hassiteconfig);
 }
index 3d63ce6..62712e3 100644 (file)
@@ -70,6 +70,22 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $temp->add(new admin_setting_configtext('minpasswordupper', new lang_string('minpasswordupper', 'admin'), new lang_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
     $temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
     $temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
+    $pwresetoptions = array(
+        300 => new lang_string('numminutes', '', 5),
+        900 => new lang_string('numminutes', '', 15),
+        1800 => new lang_string('numminutes', '', 30),
+        2700 => new lang_string('numminutes', '', 45),
+        3600 => new lang_string('numminutes', '', 60),
+        7200 => new lang_string('numminutes', '', 120),
+        14400 => new lang_string('numminutes', '', 240)
+    );
+    $adminsetting = new admin_setting_configselect(
+            'pwresettime',
+            new lang_string('passwordresettime','admin'),
+            new lang_string('configpasswordresettime','admin'),
+            1800,
+            $pwresetoptions);
+    $temp->add($adminsetting);
     $temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
     $temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
index ab41e3d..287a535 100644 (file)
@@ -164,7 +164,6 @@ require("$CFG->dirroot/lib/setup.php");
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/upgradelib.php');
 require_once($CFG->libdir.'/clilib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 require_once($CFG->libdir.'/installlib.php');
 require_once($CFG->libdir.'/testing/classes/test_lock.php');
 
index 4ec803d..364b54e 100644 (file)
@@ -36,7 +36,7 @@ Feature: Page contents assertions
     And I log in as "admin"
     And I follow "Course 1"
     When I click on "Move this to the dock" "button" in the "Administration" "block"
-    Then I should not see "Question bank"
+    Then I should not see "Question bank" in the "region-pre" "region"
     And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
 
   @javascript
@@ -46,4 +46,4 @@ Feature: Page contents assertions
       | Course 1 | C1 | 0 |
     And I log in as "admin"
     When I click on "Move this to the dock" "button" in the "Administration" "block"
-    Then I should not see "Turn editing on"
+    Then I should not see "Turn editing on" in the "region-pre" "region"
index c0d3665..45d1ed6 100644 (file)
@@ -37,9 +37,9 @@ Feature: Set up contextual data for tests
     And I follow "Cat 3"
     And I should see "Course 1"
     And I should see "Course 2"
-    And I select "Cat 1 / Cat 2" from "Course categories:"
+    And I follow "Cat 2"
     And I should see "No courses in this category"
-    And I select "Miscellaneous" from "Course categories:"
+    And I follow "Miscellaneous"
     And I should see "Course 3"
 
   @javascript
index 4bf47d0..9aa1c88 100644 (file)
@@ -10,10 +10,10 @@ Feature: Forms manipulation
     And I follow "Admin User"
     And I follow "Edit profile"
     When I fill in "First name" with "Field value"
-    And I select "Use standard web forms" from "When editing text"
+    And I select "Plain text area" from "Text editor"
     And I check "Unmask"
     Then the "First name" field should match "Field value" value
-    And the "When editing text" select box should contain "Use standard web forms"
+    And the "Text editor" select box should contain "Plain text area"
     And the "Unmask" checkbox should be checked
     And I uncheck "Unmask"
     And the "Unmask" checkbox should not be checked
@@ -32,5 +32,5 @@ Feature: Forms manipulation
     Then I should see "Close the quiz"
     And I should see "Group mode"
     And I should see "Grouping"
-    And I should not see "Show more..."
+    And I should not see "Show more..." in the "region-main-box" "region"
     And I should see "Show less..."
index 3357365..c7e622f 100644 (file)
@@ -165,7 +165,7 @@ function tool_dbtransfer_get_drivers() {
 function tool_dbtransfer_create_maintenance_file() {
     global $CFG;
 
-    register_shutdown_function('tool_dbtransfer_maintenance_callback');
+    core_shutdown_manager::register_function('tool_dbtransfer_maintenance_callback');
 
     $options = new stdClass();
     $options->trusted = false;
index 37c3600..1a1866c 100644 (file)
@@ -158,9 +158,8 @@ class tool_installaddon_installer {
      */
     public function get_plugin_types_menu() {
         global $CFG;
-        require_once($CFG->libdir.'/pluginlib.php');
 
-        $pluginman = plugin_manager::instance();
+        $pluginman = core_plugin_manager::instance();
 
         $menu = array('' => get_string('choosedots'));
         foreach (array_keys($pluginman->get_plugin_types()) as $plugintype) {
index be593a2..13dcacc 100644 (file)
@@ -90,7 +90,6 @@ require(__DIR__ . '/../../../../lib/phpunit/bootstrap.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->libdir.'/upgradelib.php');
 require_once($CFG->libdir.'/clilib.php');
-require_once($CFG->libdir.'/pluginlib.php');
 require_once($CFG->libdir.'/installlib.php');
 
 if ($unrecognized) {
index eda56a8..f471b23 100644 (file)
@@ -572,6 +572,7 @@ function tool_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffix
             'variant' => 1,
             'maxmark' => {$question->maxmark},
             'minfraction' => 0,
+            'maxfraction' => 1,
             'flagged' => 0,
             'questionsummary' => '',
             'rightanswer' => '',
index 782e1e8..4691ead 100644 (file)
@@ -347,7 +347,8 @@ class tool_uploadcourse_course {
     /**
      * Get the directory of the object to restore.
      *
-     * @return string|false subdirectory in $CFG->tempdir/backup/...
+     * @return string|false|null subdirectory in $CFG->tempdir/backup/..., false when an error occured
+     *                           and null when there is simply nothing.
      */
     protected function get_restore_content_dir() {
         $backupfile = null;
@@ -366,6 +367,9 @@ class tool_uploadcourse_course {
                 $this->error($key, $message);
             }
             return false;
+        } else if ($dir === false) {
+            // We want to return null when nothing was wrong, but nothing was found.
+            $dir = null;
         }
 
         if (empty($dir) && !empty($this->importoptions['restoredir'])) {
@@ -656,8 +660,12 @@ class tool_uploadcourse_course {
         $this->enrolmentdata = tool_uploadcourse_helper::get_enrolment_data($this->rawdata);
 
         // Restore data.
-        // TODO log warnings.
+        // TODO Speed up things by not really extracting the backup just yet, but checking that
+        // the backup file or shortname passed are valid. Extraction should happen in proceed().
         $this->restoredata = $this->get_restore_content_dir();
+        if ($this->restoredata === false) {
+            return false;
+        }
 
         // We can only reset courses when allowed and we are updating the course.
         if ($this->importoptions['reset'] || $this->options['reset']) {
index 79b10ed..7113ded 100644 (file)
@@ -194,6 +194,10 @@ class tool_uploadcourse_processor {
         $deleted = 0;
         $errors = 0;
 
+        // We will most certainly need extra time and memory to process big files.
+        @set_time_limit(0);
+        raise_memory_limit(MEMORY_EXTRA);
+
         // Loop over the CSV lines.
         while ($line = $this->cir->next()) {
             $this->linenb++;
@@ -330,6 +334,10 @@ class tool_uploadcourse_processor {
         }
         $tracker->start();
 
+        // We might need extra time and memory depending on the number of rows to preview.
+        @set_time_limit(0);
+        raise_memory_limit(MEMORY_EXTRA);
+
         // Loop over the CSV lines.
         $preview = array();
         while (($line = $this->cir->next()) && $rows > $this->linenb) {
index 3459c4a..8f86212 100644 (file)
@@ -708,6 +708,46 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
         set_time_limit(0);
     }
 
+    public function test_restore_invalid_file() {
+        $this->resetAfterTest();
+
+        // Restore from a non-existing file should not be allowed.
+        $mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
+        $updatemode = tool_uploadcourse_processor::UPDATE_ALL_WITH_DATA_ONLY;
+        $data = array('shortname' => 'A1', 'backupfile' => '/lead/no/where',
+            'category' => 1, 'fullname' => 'A1');
+        $co = new tool_uploadcourse_course($mode, $updatemode, $data);
+        $this->assertFalse($co->prepare());
+        $this->assertArrayHasKey('cannotreadbackupfile', $co->get_errors());
+
+        // Restore from an invalid file should not be allowed.
+        $mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
+        $updatemode = tool_uploadcourse_processor::UPDATE_ALL_WITH_DATA_ONLY;
+        $data = array('shortname' => 'A1', 'backupfile' => __FILE__,
+            'category' => 1, 'fullname' => 'A1');
+        $co = new tool_uploadcourse_course($mode, $updatemode, $data);
+
+        $this->assertFalse($co->prepare());
+        $this->assertArrayHasKey('invalidbackupfile', $co->get_errors());
+
+        // Zip packer throws a debugging message, this assertion is only here to prevent
+        // the message from being displayed.
+        $this->assertDebuggingCalled();
+    }
+
+    public function test_restore_invalid_course() {
+        $this->resetAfterTest();
+
+        // Restore from an invalid file should not be allowed.
+        $mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
+        $updatemode = tool_uploadcourse_processor::UPDATE_ALL_WITH_DATA_ONLY;
+        $data = array('shortname' => 'A1', 'templatecourse' => 'iamnotavalidcourse',
+            'category' => 1, 'fullname' => 'A1');
+        $co = new tool_uploadcourse_course($mode, $updatemode, $data);
+        $this->assertFalse($co->prepare());
+        $this->assertArrayHasKey('coursetorestorefromdoesnotexist', $co->get_errors());
+    }
+
     /**
      * Testing the reset on groups, group members and enrolments.
      */
index 509374c..a9f7afa 100644 (file)
@@ -100,12 +100,16 @@ $STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email',
 
 $PRF_FIELDS = array();
 
-if ($prof_fields = $DB->get_records('user_info_field')) {
-    foreach ($prof_fields as $prof_field) {
-        $PRF_FIELDS[] = 'profile_field_'.$prof_field->shortname;
+if ($proffields = $DB->get_records('user_info_field')) {
+    foreach ($proffields as $key => $proffield) {
+        $profilefieldname = 'profile_field_'.$proffield->shortname;
+        $PRF_FIELDS[] = $profilefieldname;
+        // Re-index $proffields with key as shortname. This will be
+        // used while checking if profile data is key and needs to be converted (eg. menu profile field)
+        $proffields[$profilefieldname] = $proffield;
+        unset($proffields[$key]);
     }
 }
-unset($prof_fields);
 
 if (empty($iid)) {
     $mform1 = new admin_uploaduser_form1();
@@ -372,6 +376,16 @@ if ($formdata = $mform2->is_cancelled()) {
             if (isset($formdata->$field)) {
                 // process templates
                 $user->$field = uu_process_template($formdata->$field, $user);
+
+                // Form contains key and later code expects value.
+                // Convert key to value for required profile fields.
+                require_once($CFG->dirroot.'/user/profile/field/'.$proffields[$field]->datatype.'/field.class.php');
+                $profilefieldclass = 'profile_field_'.$proffields[$field]->datatype;
+                $profilefield = new $profilefieldclass($proffields[$field]->id);
+                if (method_exists($profilefield, 'convert_external_data')) {
+                    $user->$field = $profilefield->edit_save_data_preprocess($user->$field, null);
+                }
+
                 $formdefaults[$field] = true;
             }
         }
@@ -945,8 +959,23 @@ if ($formdata = $mform2->is_cancelled()) {
                 }
 
                 if ($rid) {
-                    // find duration
-                    $timeend   = 0;
+                    // Find duration and/or enrol status.
+                    $timeend = 0;
+                    $status = null;
+
+                    if (isset($user->{'enrolstatus'.$i})) {
+                        $enrolstatus = trim($user->{'enrolstatus'.$i});
+                        if ($enrolstatus == '') {
+                            $status = null;
+                        } else if ($enrolstatus === (string)ENROL_USER_ACTIVE) {
+                            $status = ENROL_USER_ACTIVE;
+                        } else if ($enrolstatus === (string)ENROL_USER_SUSPENDED) {
+                            $status = ENROL_USER_SUSPENDED;
+                        } else {
+                            debugging('Unknown enrolment status.');
+                        }
+                    }
+
                     if (!empty($user->{'enrolperiod'.$i})) {
                         $duration = (int)$user->{'enrolperiod'.$i} * 60*60*24; // convert days to seconds
                         if ($duration > 0) { // sanity check
@@ -956,7 +985,7 @@ if ($formdata = $mform2->is_cancelled()) {
                         $timeend = $today + $manualcache[$courseid]->enrolperiod;
                     }
 
-                    $manual->enrol_user($manualcache[$courseid], $user->id, $rid, $today, $timeend);
+                    $manual->enrol_user($manualcache[$courseid], $user->id, $rid, $today, $timeend, $status);
 
                     $a = new stdClass();
                     $a->course = $shortname;
index 01863f9..e5f2a61 100644 (file)
@@ -196,7 +196,7 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
             // hack: somebody wrote uppercase in csv file, but the system knows only lowercase profile field
             $newfield = $lcfield;
 
-        } else if (preg_match('/^(cohort|course|group|type|role|enrolperiod)\d+$/', $lcfield)) {
+        } else if (preg_match('/^(cohort|course|group|type|role|enrolperiod|enrolstatus)\d+$/', $lcfield)) {
             // special fields for enrolments
             $newfield = $lcfield;
 
index 26876ce..9dfc288 100644 (file)
@@ -237,19 +237,6 @@ class admin_uploaduser_form2 extends moodleform {
         $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
         $mform->setDefault('autosubscribe', 1);
 
-        $editors = editors_get_enabled();
-        if (count($editors) > 1) {
-            $choices = array();
-            $choices['0'] = get_string('texteditor');
-            $choices['1'] = get_string('htmleditor');
-            $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
-            $mform->setDefault('htmleditor', 1);
-        } else {
-            $mform->addElement('hidden', 'htmleditor');
-            $mform->setDefault('htmleditor', 1);
-            $mform->setType('htmleditor', PARAM_INT);
-        }
-
         $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="25"');
         $mform->setType('city', PARAM_TEXT);
         if (empty($CFG->defaultcity)) {
index 5f6a468..d4223b6 100644 (file)
@@ -45,7 +45,7 @@ $table->define_columns(array('name', 'version', 'uninstall'));
 $table->define_headers(array(get_string('plugin'), get_string('version'), $struninstall));
 $table->define_baseurl($PAGE->url);
 $table->set_attribute('id', 'toolplugins');
-$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
+$table->set_attribute('class', 'admintable generaltable');
 $table->setup();
 
 $plugins = array();
@@ -73,7 +73,7 @@ foreach ($installed as $config) {
 
 foreach ($plugins as $plugin => $name) {
     $uninstall = '';
-    if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('tool_'.$plugin)) {
+    if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('tool_'.$plugin, 'manage')) {
         $uninstall = html_writer::link($uninstallurl, $struninstall);
     }
 
index b18fa1a..3155958 100644 (file)
@@ -29,3 +29,5 @@ defined('MOODLE_INTERNAL') || die();
 $plugin->version   = 2013052100;        // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2013050100;        // Requires this Moodle version
 $plugin->component = 'auth_cas';        // Full name of the plugin (used for diagnostics)
+
+$plugin->dependencies = array('auth_ldap' => 2013052100);
index a01fc6e..333142a 100644 (file)
@@ -134,6 +134,11 @@ class auth_plugin_db extends auth_plugin_base {
         }
     }
 
+    /**
+     * Connect to external database.
+     *
+     * @return ADOConnection
+     */
     function db_init() {
         // Connect to the external database (forcing new connection).
         $authdb = ADONewConnection($this->config->type);
@@ -781,6 +786,76 @@ class auth_plugin_db extends auth_plugin_base {
         }
         return $text;
     }
+
+    /**
+     * Test if settings are ok, print info to output.
+     * @private
+     */
+    public function test_settings() {
+        global $CFG, $OUTPUT;
+
+        // NOTE: this is not localised intentionally, admins are supposed to understand English at least a bit...
+
+        raise_memory_limit(MEMORY_HUGE);
+
+        if (empty($this->config->table)) {
+            echo $OUTPUT->notification('External table not specified.', 'notifyproblem');
+            return;
+        }
+
+        if (empty($this->config->fielduser)) {
+            echo $OUTPUT->notification('External user field not specified.', 'notifyproblem');
+            return;
+        }
+
+        $olddebug = $CFG->debug;
+        $olddisplay = ini_get('display_errors');
+        ini_set('display_errors', '1');
+        $CFG->debug = DEBUG_DEVELOPER;
+        $olddebugauthdb = $this->config->debugauthdb;
+        $this->config->debugauthdb = 1;
+        error_reporting($CFG->debug);
+
+        $adodb = $this->db_init();
+
+        if (!$adodb or !$adodb->IsConnected()) {
+            $this->config->debugauthdb = $olddebugauthdb;
+            $CFG->debug = $olddebug;
+            ini_set('display_errors', $olddisplay);
+            error_reporting($CFG->debug);
+            ob_end_flush();
+
+            echo $OUTPUT->notification('Cannot connect the database.', 'notifyproblem');
+            return;
+        }
+
+        $rs = $adodb->Execute("SELECT *
+                                 FROM {$this->config->table}
+                                WHERE {$this->config->fielduser} <> 'random_unlikely_username'"); // Any unlikely name is ok here.
+
+        if (!$rs) {
+            echo $OUTPUT->notification('Can not read external table.', 'notifyproblem');
+
+        } else if ($rs->EOF) {
+            echo $OUTPUT->notification('External table is empty.', 'notifyproblem');
+            $rs->close();
+
+        } else {
+            $fields_obj = $rs->FetchObj();
+            $columns = array_keys((array)$fields_obj);
+
+            echo $OUTPUT->notification('External table contains following columns:<br />'.implode(', ', $columns), 'notifysuccess');
+            $rs->close();
+        }
+
+        $adodb->Close();
+
+        $this->config->debugauthdb = $olddebugauthdb;
+        $CFG->debug = $olddebug;
+        ini_set('display_errors', $olddisplay);
+        error_reporting($CFG->debug);
+        ob_end_flush();
+    }
 }
 
 
diff --git a/auth/test_settings.php b/auth/test_settings.php
new file mode 100644 (file)
index 0000000..a0ff227
--- /dev/null
@@ -0,0 +1,78 @@
+<?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/>.
+
+/**
+ * Test auth settings.
+ *
+ * @package    core_auth
+ * @copyright  2013 Petr Skoda {@link http://skodak.org}
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require(__DIR__.'../../config.php');
+require_once("$CFG->libdir/adminlib.php");
+
+$auth = optional_param('auth', '', PARAM_RAW);
+if (!core_component::is_valid_plugin_name('auth', $auth)) {
+    $auth = '';
+} else if (!file_exists("$CFG->dirroot/auth/$auth/auth.php")) {
+    $auth = '';
+}
+
+require_login();
+require_capability('moodle/site:config', context_system::instance());
+
+navigation_node::override_active_url(new moodle_url('/admin/settings.php', array('section'=>'manageauths')));
+admin_externalpage_setup('authtestsettings');
+
+$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
+
+echo $OUTPUT->header();
+
+if (!$auth) {
+    $options = array();
+    $plugins = core_component::get_plugin_list('auth');
+    foreach ($plugins as $name => $fulldir) {
+        $plugin = get_auth_plugin($name);
+        if (!$plugin or !method_exists($plugin, 'test_settings')) {
+            continue;
+        }
+        $options[$name] = get_string('pluginname', 'auth_'.$name);
+    }
+
+    if (!$options) {
+        redirect($returnurl);
+    }
+
+    echo $OUTPUT->heading(get_string('testsettings', 'core_auth'));
+
+    $url = new moodle_url('/auth/test_settings.php', array('sesskey'=>sesskey()));
+    echo $OUTPUT->single_select($url, 'auth', $options);
+
+    echo $OUTPUT->footer();
+}
+
+$plugin = get_auth_plugin($auth);
+if (!$plugin or !method_exists($plugin, 'test_settings')) {
+    redirect($returnurl);
+}
+
+echo $OUTPUT->heading(get_string('testsettingsheading', 'core_auth', get_string('pluginname', 'auth_'.$auth)));
+
+$plugin->test_settings();
+
+echo $OUTPUT->continue_button($returnurl);
+echo $OUTPUT->footer();
index cf7d3be..1c1cf29 100644 (file)
@@ -88,32 +88,74 @@ if (!($bc = backup_ui::load_controller($backupid))) {
                             backup::INTERACTIVE_YES, backup::MODE_GENERAL, $USER->id);
 }
 $backup = new backup_ui($bc);
-$backup->process();
 
-$PAGE->set_title($heading.': '.$backup->get_stage_name());
+$PAGE->set_title($heading);
 $PAGE->set_heading($heading);
-$PAGE->navbar->add($backup->get_stage_name());
 
 $renderer = $PAGE->get_renderer('core','backup');
 echo $OUTPUT->header();
+
+// Prepare a progress bar which can display optionally during long-running
+// operations while setting up the UI.
+$slowprogress = new core_backup_display_progress_if_slow(get_string('preparingui', 'backup'));
+
+$previous = optional_param('previous', false, PARAM_BOOL);
+if ($backup->get_stage() == backup_ui::STAGE_SCHEMA && !$previous) {
+    // After schema stage, we are probably going to get to the confirmation stage,
+    // The confirmation stage has 2 sets of progress, so this is needed to prevent
+    // it showing 2 progress bars.
+    $twobars = true;
+    $slowprogress->start_progress('', 2);
+} else {
+    $twobars = false;
+}
+$backup->get_controller()->set_progress($slowprogress);
+$backup->process();
+
 if ($backup->enforce_changed_dependencies()) {
     debugging('Your settings have been altered due to unmet dependencies', DEBUG_DEVELOPER);
 }
 
+$loghtml = '';
 if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
-    // Display an extra progress bar so that we can show the progress first.
+    // Display an extra backup step bar so that we can show the 'processing' step first.
     echo html_writer::start_div('', array('id' => 'executionprogress'));
     echo $renderer->progress_bar($backup->get_progress_bar());
     $backup->get_controller()->set_progress(new core_backup_display_progress());
+
+    // Prepare logger and add to end of chain.
+    $logger = new core_backup_html_logger($CFG->debugdeveloper ? backup::LOG_DEBUG : backup::LOG_INFO);
+    $backup->get_controller()->add_logger($logger);
+
+    // Carry out actual backup.
     $backup->execute();
+
+    // Get HTML from logger.
+    $loghtml = $logger->get_html();
+
+    // Hide the progress display and first backup step bar (the 'finished' step will show next).
     echo html_writer::end_div();
     echo html_writer::script('document.getElementById("executionprogress").style.display = "none";');
 } else {
     $backup->save_controller();
 }
 
+// Displaying UI can require progress reporting, so do it here before outputting
+// the backup stage bar (as part of the existing progress bar, if required).
+$ui = $backup->display($renderer);
+if ($twobars) {
+    $slowprogress->end_progress();
+}
+
 echo $renderer->progress_bar($backup->get_progress_bar());
-echo $backup->display($renderer);
+
+echo $ui;
 $backup->destroy();
 unset($backup);
-echo $OUTPUT->footer();
\ No newline at end of file
+
+// Display log data if there was any.
+if ($loghtml != '') {
+    echo $renderer->log_display($loghtml);
+}
+
+echo $OUTPUT->footer();
index 1dcbee8..3d5653f 100644 (file)
@@ -20,7 +20,7 @@ class cssparser {
 
   function cssparser($html = true) {
     // Register "destructor"
-    register_shutdown_function(array(&$this, "finalize"));
+    core_shutdown_manager::register_function(array(&$this, "finalize"));
     $this->html = ($html != false);
     $this->Clear();
   }
index b7b87d2..f38d263 100644 (file)
@@ -40,7 +40,7 @@
  *
  * TODO: Finish phpdocs
  */
-class backup_controller extends backup implements loggable {
+class backup_controller extends base_controller {
 
     protected $backupid; // Unique identificator for this backup
 
@@ -62,12 +62,6 @@ class backup_controller extends backup implements loggable {
     protected $executiontime; // epoch time when we want the backup to be executed (requires cron to run)
 
     protected $destination; // Destination chain object (fs_moodle, fs_os, db, email...)
-    protected $logger;      // Logging chain object (moodle, inline, fs, db, syslog)
-
-    /**
-     * @var core_backup_progress Progress reporting object.
-     */
-    protected $progress;
 
     protected $checksum; // Cache @checksumable results for lighter @is_checksum_correct() uses
 
@@ -307,29 +301,6 @@ class backup_controller extends backup implements loggable {
         return $this->plan;
     }
 
-    public function get_logger() {
-        return $this->logger;
-    }
-
-    /**
-     * Gets the progress reporter, which can be used to report progress within
-     * the backup or restore process.
-     *
-     * @return core_backup_progress Progress reporting object
-     */
-    public function get_progress() {
-        return $this->progress;
-    }
-
-    /**
-     * Sets the progress reporter.
-     *
-     * @param core_backup_progress $progress Progress reporting object
-     */
-    public function set_progress(core_backup_progress $progress) {
-        $this->progress = $progress;
-    }
-
     /**
      * Executes the backup
      * @return void Throws and exception of completes
@@ -353,10 +324,6 @@ class backup_controller extends backup implements loggable {
         return $this->plan->get_results();
     }
 
-    public function log($message, $level, $a = null, $depth = null, $display = false) {
-        backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
-    }
-
     /**
      * Save controller information
      *
diff --git a/backup/controller/base_controller.class.php b/backup/controller/base_controller.class.php
new file mode 100644 (file)
index 0000000..4b017b7
--- /dev/null
@@ -0,0 +1,85 @@
+<?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/>.
+
+/**
+ * Base class with shared stuff between backup controller and restore
+ * controller.
+ *
+ * @package core_backup
+ * @copyright 2013 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class base_controller extends backup implements loggable {
+    /**
+     * @var core_backup_progress Progress reporting object.
+     */
+    protected $progress;
+
+    /**
+     * @var base_logger Logging chain object (moodle, inline, fs, db, syslog)
+     */
+    protected $logger;
+
+    /**
+     * Gets the progress reporter, which can be used to report progress within
+     * the backup or restore process.
+     *
+     * @return core_backup_progress Progress reporting object
+     */
+    public function get_progress() {
+        return $this->progress;
+    }
+
+    /**
+     * Sets the progress reporter.
+     *
+     * @param core_backup_progress $progress Progress reporting object
+     */
+    public function set_progress(core_backup_progress $progress) {
+        $this->progress = $progress;
+    }
+
+    /**
+     * Gets first logger in logging chain.
+     *
+     * @return base_logger Logger
+     */
+    public function get_logger() {
+        return $this->logger;
+    }
+
+    /**
+     * Inserts a new logger at end of logging chain.
+     *
+     * @param base_logger $logger New logger to add
+     */
+    public function add_logger(base_logger $logger) {
+        $existing = $this->logger;
+        while ($existing->get_next()) {
+            $existing = $existing->get_next();
+        }
+        $existing->set_next($logger);
+    }
+
+    /**
+     * Logs data to the logger chain.
+     *
+     * @see loggable::log()
+     */
+    public function log($message, $level, $a = null, $depth = null, $display = false) {
+        backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
+    }
+}
\ No newline at end of file
index 00b36e0..b2859f6 100644 (file)
@@ -30,7 +30,7 @@
  *
  * TODO: Finish phpdocs
  */
-class restore_controller extends backup implements loggable {
+class restore_controller extends base_controller {
 
     protected $tempdir;   // Directory under tempdir/backup awaiting restore
     protected $restoreid; // Unique identificator for this restore
@@ -55,16 +55,14 @@ class restore_controller extends backup implements loggable {
     protected $execution;     // inmediate/delayed
     protected $executiontime; // epoch time when we want the restore to be executed (requires cron to run)
 
-    protected $logger;      // Logging chain object (moodle, inline, fs, db, syslog)
-
-    /**
-     * @var core_backup_progress Progress reporting object.
-     */
-    protected $progress;
-
     protected $checksum; // Cache @checksumable results for lighter @is_checksum_correct() uses
 
     /**
+     * Constructor.
+     *
+     * If you specify a progress monitor, this will be used to report progress
+     * while loading the plan, as well as for future use. (You can change it
+     * for a different one later using set_progress.)
      *
      * @param string $tempdir Directory under tempdir/backup awaiting restore
      * @param int $courseid Course id where restore is going to happen
@@ -72,8 +70,10 @@ class restore_controller extends backup implements loggable {
      * @param int $mode backup::MODE_[ GENERAL | HUB | IMPORT | SAMESITE ]
      * @param int $userid
      * @param int $target backup::TARGET_[ NEW_COURSE | CURRENT_ADDING | CURRENT_DELETING | EXISTING_ADDING | EXISTING_DELETING ]
+     * @param core_backup_progress $progress Optional progress monitor
      */
-    public function __construct($tempdir, $courseid, $interactive, $mode, $userid, $target){
+    public function __construct($tempdir, $courseid, $interactive, $mode, $userid, $target,
+            core_backup_progress $progress = null) {
         $this->tempdir = $tempdir;
         $this->courseid = $courseid;
         $this->interactive = $interactive;
@@ -106,9 +106,14 @@ class restore_controller extends backup implements loggable {
         // Default logger chain (based on interactive/execution)
         $this->logger = backup_factory::get_logger_chain($this->interactive, $this->execution, $this->restoreid);
 
-        // By default there is no progress reporter. Interfaces that wish to
-        // display progress must set it.
-        $this->progress = new core_backup_null_progress();
+        // By default there is no progress reporter unless you specify one so it
+        // can be used during loading of the plan.
+        if ($progress) {
+            $this->progress = $progress;
+        } else {
+            $this->progress = new core_backup_null_progress();
+        }
+        $this->progress->start_progress('Constructing restore_controller');
 
         // Instantiate the output_controller singleton and active it if interactive and inmediate
         $oc = output_controller::get_instance();
@@ -142,6 +147,9 @@ class restore_controller extends backup implements loggable {
                 $this->set_status(backup::STATUS_NEED_PRECHECK);
             }
         }
+
+        // Tell progress monitor that we finished loading.
+        $this->progress->end_progress();
     }
 
     /**
@@ -305,29 +313,6 @@ class restore_controller extends backup implements loggable {
         return $this->info;
     }
 
-    public function get_logger() {
-        return $this->logger;
-    }
-
-    /**
-     * Gets the progress reporter, which can be used to report progress within
-     * the backup or restore process.
-     *
-     * @return core_backup_progress Progress reporting object
-     */
-    public function get_progress() {
-        return $this->progress;
-    }
-
-    /**
-     * Sets the progress reporter.
-     *
-     * @param core_backup_progress $progress Progress reporting object
-     */
-    public function set_progress(core_backup_progress $progress) {
-        $this->progress = $progress;
-    }
-
     public function execute_plan() {
         // Basic/initial prevention against time/memory limits
         set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
@@ -395,10 +380,6 @@ class restore_controller extends backup implements loggable {
         return $this->precheck;
     }
 
-    public function log($message, $level, $a = null, $depth = null, $display = false) {
-        backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
-    }
-
     /**
      * Save controller information
      *
index 0bb9e6a..7a32057 100644 (file)
@@ -99,6 +99,10 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
     $progress->start_progress('', 2);
     $backup->get_controller()->set_progress($progress);
 
+    // Prepare logger for backup.
+    $logger = new core_backup_html_logger($CFG->debugdeveloper ? backup::LOG_DEBUG : backup::LOG_INFO);
+    $backup->get_controller()->add_logger($logger);
+
     // First execute the backup
     $backup->execute();
     $backup->destroy();
@@ -123,6 +127,10 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
     // (the precheck and then the actual restore).
     $progress->start_progress('Restore process', 2);
     $rc->set_progress($progress);
+
+    // Set logger for restore.
+    $rc->add_logger($logger);
+
     // Convert the backup if required.... it should NEVER happed
     if ($rc->get_status() == backup::STATUS_REQUIRE_CONV) {
         $rc->convert();
@@ -178,6 +186,13 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
     }
     echo $OUTPUT->notification(get_string('importsuccess', 'backup'), 'notifysuccess');
     echo $OUTPUT->continue_button(new moodle_url('/course/view.php', array('id'=>$course->id)));
+
+    // Get and display log data if there was any.
+    $loghtml = $logger->get_html();
+    if ($loghtml != '') {
+        echo $renderer->log_display($loghtml);
+    }
+
     echo $OUTPUT->footer();
 
     die();
index 922318c..6dbe073 100644 (file)
@@ -34,10 +34,13 @@ defined('MOODLE_INTERNAL') || die();
 class create_and_clean_temp_stuff extends backup_execution_step {
 
     protected function define_execution() {
+        $progress = $this->task->get_progress();
+        $progress->start_progress('Deleting backup directories');
         backup_helper::check_and_create_backup_dir($this->get_backupid());// Create backup temp dir
-        backup_helper::clear_backup_dir($this->get_backupid());           // Empty temp dir, just in case
-        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));    // Delete > 4 hours temp dirs
+        backup_helper::clear_backup_dir($this->get_backupid(), $progress);           // Empty temp dir, just in case
+        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60), $progress);    // Delete > 4 hours temp dirs
         backup_controller_dbops::create_backup_ids_temp_table($this->get_backupid()); // Create ids temp table
+        $progress->end_progress();
     }
 }
 
@@ -61,7 +64,10 @@ class drop_and_clean_temp_stuff extends backup_execution_step {
         // 1) If $CFG->keeptempdirectoriesonbackup is not enabled
         // 2) If backup temp dir deletion has been marked to be avoided
         if (empty($CFG->keeptempdirectoriesonbackup) && !$this->skipcleaningtempdir) {
-            backup_helper::delete_backup_dir($this->get_backupid()); // Empty backup dir
+            $progress = $this->task->get_progress();
+            $progress->start_progress('Deleting backup dir');
+            backup_helper::delete_backup_dir($this->get_backupid(), $progress); // Empty backup dir
+            $progress->end_progress();
         }
     }
 
@@ -209,7 +215,7 @@ abstract class backup_questions_activity_structure_step extends backup_activity_
 
         $qas = new backup_nested_element($nameprefix . 'question_attempts');
         $qa = new backup_nested_element($nameprefix . 'question_attempt', array('id'), array(
-                'slot', 'behaviour', 'questionid', 'maxmark', 'minfraction',
+                'slot', 'behaviour', 'questionid', 'maxmark', 'minfraction', 'maxfraction',
                 'flagged', 'questionsummary', 'rightanswer', 'responsesummary',
                 'timemodified'));
 
@@ -1191,7 +1197,7 @@ class backup_users_structure_step extends backup_structure_step {
             'confirmed', 'policyagreed', 'deleted',
             'lang', 'theme', 'timezone', 'firstaccess',
             'lastaccess', 'lastlogin', 'currentlogin',
-            'mailformat', 'maildigest', 'maildisplay', 'htmleditor',
+            'mailformat', 'maildigest', 'maildisplay',
             'autosubscribe', 'trackforums', 'timecreated',
             'timemodified', 'trustbitmask');
 
@@ -1589,7 +1595,8 @@ class backup_main_structure_step extends backup_structure_step {
         $info['original_system_contextid'] = context_system::instance()->id;
 
         // Get more information from controller
-        list($dinfo, $cinfo, $sinfo) = backup_controller_dbops::get_moodle_backup_information($this->get_backupid());
+        list($dinfo, $cinfo, $sinfo) = backup_controller_dbops::get_moodle_backup_information(
+                $this->get_backupid(), $this->get_task()->get_progress());
 
         // Define elements
 
@@ -1704,7 +1711,7 @@ class backup_zip_contents extends backup_execution_step implements file_progress
         $zipfile = $basepath . '/backup.mbz';
 
         // Get the zip packer
-        $zippacker = get_file_packer('application/zip');
+        $zippacker = get_file_packer('application/vnd.moodle.backup');
 
         // Zip files
         $zippacker->archive_to_pathname($files, $zipfile, true, $this);
@@ -1753,7 +1760,8 @@ class backup_store_backup_file extends backup_execution_step {
         $has_file_references = backup_controller_dbops::backup_includes_file_references($this->get_backupid());
         // Perform storage and return it (TODO: shouldn't be array but proper result object)
         return array(
-            'backup_destination' => backup_helper::store_backup_file($this->get_backupid(), $zipfile),
+            'backup_destination' => backup_helper::store_backup_file($this->get_backupid(), $zipfile,
+                    $this->task->get_progress()),
             'include_file_references_to_external_content' => $has_file_references
         );
     }
index 1f830ac..b7c65ef 100644 (file)
@@ -97,6 +97,7 @@ abstract class restore_plan_builder {
         // preloading information to temp table
         // and other init tasks
         $plan->add_task(new restore_root_task('root_task'));
+        $controller->get_progress()->progress();
 
         switch ($controller->get_type()) {
             case backup::TYPE_1ACTIVITY:
@@ -115,6 +116,7 @@ abstract class restore_plan_builder {
         // conversion...)
         // and perform other various final actions.
         $plan->add_task(new restore_final_task('final_task'));
+        $controller->get_progress()->progress();
     }
 
 
@@ -134,6 +136,7 @@ abstract class restore_plan_builder {
         // as far as the module can be missing on restore
         if ($task = restore_factory::get_restore_activity_task($infoactivity)) { // can be missing
             $plan->add_task($task);
+            $controller->get_progress()->progress();
 
             // For the given activity path, add as many block tasks as necessary
             // TODO: Add blocks, we need to introspect xml here
@@ -141,6 +144,7 @@ abstract class restore_plan_builder {
             foreach ($blocks as $basepath => $name) {
                 if ($task = restore_factory::get_restore_block_task($name, $basepath)) {
                     $plan->add_task($task);
+                    $controller->get_progress()->progress();
                 } else {
                     // TODO: Debug information about block not supported
                 }
@@ -163,6 +167,7 @@ abstract class restore_plan_builder {
         // Add the section task, responsible for restoring
         // all the section related information
         $plan->add_task(restore_factory::get_restore_section_task($infosection));
+        $controller->get_progress()->progress();
         // For the given section, add as many activity tasks as necessary
         foreach ($info->activities as $activityid => $activity) {
             if ($activity->sectionid != $infosection->sectionid) {
@@ -188,6 +193,7 @@ abstract class restore_plan_builder {
         // all the course related information
         $task = restore_factory::get_restore_course_task($info->course, $courseid);
         $plan->add_task($task);
+        $controller->get_progress()->progress();
 
         // For the given course path, add as many block tasks as necessary
         // TODO: Add blocks, we need to introspect xml here
@@ -195,6 +201,7 @@ abstract class restore_plan_builder {
         foreach ($blocks as $basepath => $name) {
             if ($task = restore_factory::get_restore_block_task($name, $basepath)) {
                 $plan->add_task($task);
+                $controller->get_progress()->progress();
             } else {
                 // TODO: Debug information about block not supported
             }
index 1afa523..9fa8a9b 100644 (file)
@@ -65,10 +65,13 @@ class restore_drop_and_clean_temp_stuff extends restore_execution_step {
     protected function define_execution() {
         global $CFG;
         restore_controller_dbops::drop_restore_temp_tables($this->get_restoreid()); // Drop ids temp table
-        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));              // Delete > 4 hours temp dirs
+        $progress = $this->task->get_progress();
+        $progress->start_progress('Deleting backup dir');
+        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60), $progress);              // Delete > 4 hours temp dirs
         if (empty($CFG->keeptempdirectoriesonbackup)) { // Conditionally
-            backup_helper::delete_backup_dir($this->task->get_tempdir()); // Empty restore dir
+            backup_helper::delete_backup_dir($this->task->get_tempdir(), $progress); // Empty restore dir
         }
+        $progress->end_progress();
     }
 }
 
@@ -726,7 +729,8 @@ class restore_create_included_users extends restore_execution_step {
 
     protected function define_execution() {
 
-        restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(), $this->task->get_userid());
+        restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(),
+                $this->task->get_userid(), $this->task->get_progress());
     }
 }
 
@@ -3547,6 +3551,10 @@ class restore_create_question_files extends restore_execution_step {
     protected function define_execution() {
         global $DB;
 
+        // Track progress, as this task can take a long time.
+        $progress = $this->task->get_progress();
+        $progress->start_progress($this->get_name(), core_backup_progress::INDETERMINATE);
+
         // Let's process only created questions
         $questionsrs = $DB->get_recordset_sql("SELECT bi.itemid, bi.newitemid, bi.parentitemid, q.qtype
                                                FROM {backup_ids_temp} bi
@@ -3554,6 +3562,9 @@ class restore_create_question_files extends restore_execution_step {
                                               WHERE bi.backupid = ?
                                                 AND bi.itemname = 'question_created'", array($this->get_restoreid()));
         foreach ($questionsrs as $question) {
+            // Report progress for each question.
+            $progress->progress();
+
             // Get question_category mapping, it contains the target context for the question
             if (!$qcatmapping = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'question_category', $question->parentitemid)) {
                 // Something went really wrong, cannot find the question_category for the question
@@ -3566,21 +3577,22 @@ class restore_create_question_files extends restore_execution_step {
 
             // Add common question files (question and question_answer ones)
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'questiontext',
-                                              $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'generalfeedback',
-                                              $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'answer',
-                                              $oldctxid, $this->task->get_userid(), 'question_answer', null, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_answer', null, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'answerfeedback',
-                                              $oldctxid, $this->task->get_userid(), 'question_answer', null, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_answer', null, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'hint',
-                                              $oldctxid, $this->task->get_userid(), 'question_hint', null, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_hint', null, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'correctfeedback',
-                                              $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'partiallycorrectfeedback',
-                                              $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true, $progress);
             restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), 'question', 'incorrectfeedback',
-                                              $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true);
+                    $oldctxid, $this->task->get_userid(), 'question_created', $question->itemid, $newctxid, true, $progress);
+
             // Add qtype dependent files
             $components = backup_qtype_plugin::get_components_and_fileareas($question->qtype);
             foreach ($components as $component => $fileareas) {
@@ -3588,11 +3600,12 @@ class restore_create_question_files extends restore_execution_step {
                     // Use itemid only if mapping is question_created
                     $itemid = ($mapping == 'question_created') ? $question->itemid : null;
                     restore_dbops::send_files_to_pool($this->get_basepath(), $this->get_restoreid(), $component, $filearea,
-                                                      $oldctxid, $this->task->get_userid(), $mapping, $itemid, $newctxid, true);
+                            $oldctxid, $this->task->get_userid(), $mapping, $itemid, $newctxid, true, $progress);
                 }
             }
         }
         $questionsrs->close();
+        $progress->end_progress();
     }
 }
 
@@ -3625,7 +3638,7 @@ class restore_process_file_aliases_queue extends restore_execution_step {
     protected function define_execution() {
         global $DB;
 
-        $this->log('processing file aliases queue', backup::LOG_INFO);
+        $this->log('processing file aliases queue', backup::LOG_DEBUG);
 
         $fs = get_file_storage();
 
@@ -4047,6 +4060,10 @@ abstract class restore_questions_activity_structure_step extends restore_activit
         $data->questionid      = $question->newitemid;
         $data->timemodified    = $this->apply_date_offset($data->timemodified);
 
+        if (!property_exists($data, 'maxfraction')) {
+            $data->maxfraction = 1;
+        }
+
         $newitemid = $DB->insert_record('question_attempts', $data);
 
         $this->set_mapping($nameprefix . 'question_attempt', $oldid, $newitemid);
index d844f9f..6e19ef9 100644 (file)
@@ -17,6 +17,23 @@ $PAGE->set_pagelayout('standard');
 require_login($course, null, $cm);
 require_capability('moodle/restore:restorecourse', $context);
 
+// Show page header.
+$PAGE->set_title($course->shortname . ': ' . get_string('restore'));
+$PAGE->set_heading($course->fullname);
+
+$renderer = $PAGE->get_renderer('core','backup');
+echo $OUTPUT->header();
+
+// Prepare a progress bar which can display optionally during long-running
+// operations while setting up the UI.
+$slowprogress = new core_backup_display_progress_if_slow(get_string('preparingui', 'backup'));
+
+// Overall, allow 10 units of progress.
+$slowprogress->start_progress('', 10);
+
+// This progress section counts for loading the restore controller.
+$slowprogress->start_progress('', 1, 1);
+
 // Restore of large courses requires extra memory. Use the amount configured
 // in admin settings.
 raise_memory_limit(MEMORY_EXTRA);
@@ -43,15 +60,12 @@ if ($stage & restore_ui::STAGE_CONFIRM + restore_ui::STAGE_DESTINATION) {
     }
 }
 
-$PAGE->set_title($course->shortname . ': ' . get_string('restore'));
-$PAGE->set_heading($course->fullname);
+// End progress section for loading restore controller.
+$slowprogress->end_progress();
 
-$renderer = $PAGE->get_renderer('core','backup');
-echo $OUTPUT->header();
+// This progress section is for the 'process' function below.
+$slowprogress->start_progress('', 1, 9);
 
-// Prepare a progress bar which can display optionally during long-running
-// operations while setting up the UI.
-$slowprogress = new core_backup_display_progress_if_slow(get_string('preparingui', 'backup'));
 // Depending on the code branch above, $restore may be a restore_ui or it may
 // be a restore_ui_independent_stage. Either way, this function exists.
 $restore->set_progress_reporter($slowprogress);
@@ -61,6 +75,11 @@ if (!$restore->is_independent() && $restore->enforce_changed_dependencies()) {
     debugging('Your settings have been altered due to unmet dependencies', DEBUG_DEVELOPER);
 }
 
+$loghtml = '';
+// Finish the 'process' progress reporting section, and the overall count.
+$slowprogress->end_progress();
+$slowprogress->end_progress();
+
 if (!$restore->is_independent()) {
     // Use a temporary (disappearing) progress bar to show the precheck progress if any.
     $precheckprogress = new core_backup_display_progress_if_slow(get_string('preparingdata', 'backup'));
@@ -72,9 +91,14 @@ if (!$restore->is_independent()) {
             // Show the current restore state (header with bolded item).
             echo $renderer->progress_bar($restore->get_progress_bar());
             // Start displaying the actual progress bar percentage.
-            $restore->get_controller()->set_progress(new core_backup_display_progress(true));
+            $restore->get_controller()->set_progress(new core_backup_display_progress());
+            // Prepare logger.
+            $logger = new core_backup_html_logger($CFG->debugdeveloper ? backup::LOG_DEBUG : backup::LOG_INFO);
+            $restore->get_controller()->add_logger($logger);
             // Do actual restore.
             $restore->execute();
+            // Get HTML from logger.
+            $loghtml = $logger->get_html();
             // Hide this section because we are now going to make the page show 'finished'.
             echo html_writer::end_div();
             echo html_writer::script('document.getElementById("executionprogress").style.display = "none";');
@@ -91,4 +115,10 @@ echo $renderer->progress_bar($restore->get_progress_bar());
 echo $restore->display($renderer);
 $restore->destroy();
 unset($restore);
+
+// Display log data if there was any.
+if ($loghtml != '') {
+    echo $renderer->log_display($loghtml);
+}
+
 echo $OUTPUT->footer();
index 0c4095b..1d12d0d 100644 (file)
@@ -72,10 +72,23 @@ if (!check_dir_exists($tmpdir, true, true)) {
 // choose the backup file from backup files tree
 if ($action == 'choosebackupfile') {
     if ($fileinfo = $browser->get_file_info($filecontext, $component, $filearea, $itemid, $filepath, $filename)) {
-        $filename = restore_controller::get_tempdir_name($course->id, $USER->id);
-        $pathname = $tmpdir . '/' . $filename;
-        $fileinfo->copy_to_pathname($pathname);
-        $restore_url = new moodle_url('/backup/restore.php', array('contextid'=>$contextid, 'filename'=>$filename));
+        if (is_a($fileinfo, 'file_info_stored')) {
+            // Use the contenthash rather than copying the file where possible,
+            // to improve performance and avoid timeouts with large files.
+            $fs = get_file_storage();
+            $params = $fileinfo->get_params();
+            $file = $fs->get_file($params['contextid'], $params['component'], $params['filearea'],
+                    $params['itemid'], $params['filepath'], $params['filename']);
+            $restore_url = new moodle_url('/backup/restore.php', array('contextid' => $contextid,
+                    'pathnamehash' => $file->get_pathnamehash(), 'contenthash' => $file->get_contenthash()));
+        } else {
+            // If it's some weird other kind of file then use old code.
+            $filename = restore_controller::get_tempdir_name($course->id, $USER->id);
+            $pathname = $tmpdir . '/' . $filename;
+            $fileinfo->copy_to_pathname($pathname);
+            $restore_url = new moodle_url('/backup/restore.php', array(
+                    'contextid' => $contextid, 'filename' => $filename));
+        }
         redirect($restore_url);
     } else {
         redirect($url, get_string('filenotfound', 'error'));
index 9fd95ac..cb4577c 100644 (file)
@@ -350,15 +350,32 @@ abstract class backup_controller_dbops extends backup_dbops {
 
     /**
      * Get details information for main moodle_backup.xml file, extracting it from
-     * the specified controller
+     * the specified controller.
+     *
+     * If you specify the progress monitor, this will start a new progress section
+     * to track progress in processing (in case this task takes a long time).
+     *
+     * @param string $backupid Backup ID
+     * @param core_backup_progress $progress Optional progress monitor
      */
-    public static function get_moodle_backup_information($backupid) {
+    public static function get_moodle_backup_information($backupid,
+            core_backup_progress $progress = null) {
+
+  &nbs