Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
6e56da83
Commit
6e56da83
authored
Jun 06, 2011
by
Tim Hunt
Browse files
MDL-20636 Fix quiz_statistics upgrade (Eloy review comment A3).
parent
cc5937f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
mod/quiz/report/statistics/db/upgrade.php
View file @
6e56da83
...
...
@@ -36,11 +36,20 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
$dbman
=
$DB
->
get_manager
();
// In Moodle 2.0, this table was incorrectly called quiz_report, which breaks
// the moodle coding guidelines. In 2.1 it was renamed to quiz_reports. This
// bit of code lets us handle all the various upgrade paths without problems.
if
(
$dbman
->
table_exists
(
'quiz_reports'
))
{
$quizreportstablename
=
'quiz_reports'
;
}
else
{
$quizreportstablename
=
'quiz_report'
;
}
//===== 1.9.0 upgrade line ======//
if
(
$oldversion
<
2008072401
)
{
//register cron to run every 5 hours.
$DB
->
set_field
(
'
quiz
_
report
'
,
'cron'
,
HOURSECS
*
5
,
array
(
'name'
=>
'statistics'
));
$DB
->
set_field
(
$
quizreport
stablename
,
'cron'
,
HOURSECS
*
5
,
array
(
'name'
=>
'statistics'
));
// statistics savepoint reached
upgrade_plugin_savepoint
(
true
,
2008072401
,
'quiz'
,
'statistics'
);
...
...
@@ -198,7 +207,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
}
if
(
$oldversion
<
2008112100
)
{
$DB
->
set_field
(
'
quiz
_
report
'
,
'capability'
,
'quizreport/statistics:view'
,
$DB
->
set_field
(
$
quizreport
stablename
,
'capability'
,
'quizreport/statistics:view'
,
array
(
'name'
=>
'statistics'
));
// statistics savepoint reached
...
...
@@ -364,13 +373,8 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
}
if
(
$oldversion
<
2011021500
)
{
if
(
$dbman
->
table_exists
(
'quiz_reports'
))
{
$DB
->
set_field
(
'quiz_reports'
,
'capability'
,
'quiz/statistics:view'
,
array
(
'name'
=>
'statistics'
));
}
else
{
$DB
->
set_field
(
'quiz_report'
,
'capability'
,
'quiz/statistics:view'
,
array
(
'name'
=>
'statistics'
));
}
$DB
->
set_field
(
$quizreportstablename
,
'capability'
,
'quiz/statistics:view'
,
array
(
'name'
=>
'statistics'
));
// statistics savepoint reached
upgrade_plugin_savepoint
(
true
,
2011021500
,
'quiz'
,
'statistics'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment