diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 7b7c64fe0a9..347c93a0f06 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1779,5 +1779,12 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2013032600.03); } + if ($oldversion < 2013032600.04) { + // MDL-31983 broke the quiz version number. Fix it. + $DB->set_field('modules', 'version', '2013021500', + array('name' => 'quiz', 'version' => '2013310100')); + upgrade_main_savepoint(true, 2013032600.04); + } + return true; } diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 604eb129eb9..42f45fab13b 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -395,6 +395,13 @@ function xmldb_quiz_upgrade($oldversion) { // Moodle v2.4.0 release upgrade line // Put any upgrade step following this + if ($oldversion < 2013031900) { + // Quiz manual grading UI should be controlled by mod/quiz:grade, not :viewreports. + $DB->set_field('quiz_reports', 'capability', 'mod/quiz:grade', array('name' => 'grading')); + + // Mod quiz savepoint reached. + upgrade_mod_savepoint(true, 2013031900, 'quiz'); + } return true; } diff --git a/mod/quiz/report/grading/db/install.php b/mod/quiz/report/grading/db/install.php new file mode 100644 index 00000000000..bcded6c27ad --- /dev/null +++ b/mod/quiz/report/grading/db/install.php @@ -0,0 +1,40 @@ +. + +/** + * Post-install script for the quiz manual grading report. + * @package quiz_grading + * @copyright 2013 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + + +defined('MOODLE_INTERNAL') || die(); + + +/** + * Post-install script + */ +function xmldb_quiz_grading_install() { + global $DB; + + $record = new stdClass(); + $record->name = 'grading'; + $record->displayorder = '6000'; + $record->capability = 'mod/quiz:grade'; + + $DB->insert_record('quiz_reports', $record); +} diff --git a/mod/quiz/db/install.php b/mod/quiz/report/overview/db/install.php similarity index 60% rename from mod/quiz/db/install.php rename to mod/quiz/report/overview/db/install.php index 68be5cb4611..3b8878f92a7 100644 --- a/mod/quiz/db/install.php +++ b/mod/quiz/report/overview/db/install.php @@ -15,12 +15,10 @@ // along with Moodle. If not, see . /** - * Post-install code for the quiz module. - * - * @package mod - * @subpackage quiz - * @copyright 2009 Petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Post-install script for the quiz grades report. + * @package quiz_overview + * @copyright 2013 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -28,23 +26,14 @@ defined('MOODLE_INTERNAL') || die(); /** - * Code run after the quiz module database tables have been created. + * Post-install script */ -function xmldb_quiz_install() { +function xmldb_quiz_overview_install() { global $DB; $record = new stdClass(); $record->name = 'overview'; $record->displayorder = '10000'; - $DB->insert_record('quiz_reports', $record); - $record = new stdClass(); - $record->name = 'responses'; - $record->displayorder = '9000'; - $DB->insert_record('quiz_reports', $record); - - $record = new stdClass(); - $record->name = 'grading'; - $record->displayorder = '6000'; $DB->insert_record('quiz_reports', $record); } diff --git a/mod/quiz/report/responses/db/install.php b/mod/quiz/report/responses/db/install.php new file mode 100644 index 00000000000..01988275522 --- /dev/null +++ b/mod/quiz/report/responses/db/install.php @@ -0,0 +1,39 @@ +. + +/** + * Post-install script for the quiz responses report. + * @package quiz_responses + * @copyright 2013 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + + +defined('MOODLE_INTERNAL') || die(); + + +/** + * Post-install script + */ +function xmldb_quiz_responses_install() { + global $DB; + + $record = new stdClass(); + $record->name = 'responses'; + $record->displayorder = '9000'; + + $DB->insert_record('quiz_reports', $record); +} diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 6c683b0a82d..1d24466766f 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2013310100; // The current module version (Date: YYYYMMDDXX). -$module->requires = 2012112900; // Requires this Moodle version. -$module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics). +$module->version = 2013031900; // The current module version (Date: YYYYMMDDXX). +$module->requires = 2012112900; // Requires this Moodle version. +$module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics). $module->cron = 60; diff --git a/version.php b/version.php index 6235f246a80..a449c2cf0a1 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2013032600.03; // YYYYMMDD = weekly release date of this DEV branch +$version = 2013032600.04; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes