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
b0ec60f1
Commit
b0ec60f1
authored
Jun 03, 2009
by
stronk7
Browse files
MDL-19350 upgrade blocks - adding missing savepoints to mod/quiz/reports
parent
3e179763
Changes
2
Hide whitespace changes
Inline
Side-by-side
mod/quiz/report/overview/db/upgrade.php
View file @
b0ec60f1
...
...
@@ -29,6 +29,9 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
if
(
!
$dbman
->
table_exists
(
$table
))
{
$dbman
->
create_table
(
$table
);
}
/// overview savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008062700
,
'quizreport'
,
'overview'
);
}
if
(
$result
&&
$oldversion
<
2009030500
)
{
...
...
@@ -45,6 +48,9 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
/// Launch change of precision for field newgrade
$dbman
->
change_field_precision
(
$table
,
$field
);
/// overview savepoint reached
upgrade_plugin_savepoint
(
$result
,
2009030500
,
'quizreport'
,
'overview'
);
}
return
$result
;
...
...
mod/quiz/report/statistics/db/upgrade.php
View file @
b0ec60f1
...
...
@@ -3,7 +3,7 @@
function
xmldb_quizreport_statistics_upgrade
(
$oldversion
)
{
global
$DB
;
$dbman
=
$DB
->
get_manager
();
$result
=
true
;
...
...
@@ -13,7 +13,11 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
if
(
$result
&&
$oldversion
<
2008072401
)
{
//register cron to run every 5 hours.
$result
=
$result
&&
$DB
->
set_field
(
'quiz_report'
,
'cron'
,
HOURSECS
*
5
,
array
(
'name'
=>
'statistics'
));
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008072401
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008072500
)
{
/// Define field s to be added to quiz_question_statistics
...
...
@@ -25,7 +29,10 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
$dbman
->
add_field
(
$table
,
$field
);
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008072500
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008072800
)
{
/// Define field maxgrade to be added to quiz_question_statistics
...
...
@@ -37,6 +44,8 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
$dbman
->
add_field
(
$table
,
$field
);
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008072800
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008072801
)
{
...
...
@@ -50,6 +59,8 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
$dbman
->
add_field
(
$table
,
$field
);
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008072801
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008081500
)
{
...
...
@@ -59,6 +70,9 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
/// Launch change of type for field maxgrade
$dbman
->
change_field_type
(
$table
,
$field
);
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008081500
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008082600
)
{
...
...
@@ -83,8 +97,10 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
$dbman
->
create_table
(
$table
);
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008082600
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008090500
)
{
//delete all cached results first
$result
=
$result
&&
$DB
->
delete_records
(
'quiz_statistics'
);
...
...
@@ -94,29 +110,33 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
/// Define field anssubqid to be dropped from quiz_question_response_stats
$table
=
new
xmldb_table
(
'quiz_question_response_stats'
);
$field
=
new
xmldb_field
(
'anssubqid'
);
/// Conditionally launch drop field subqid
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
/// Define field subqid to be added to quiz_question_response_stats
$field
=
new
xmldb_field
(
'subqid'
,
XMLDB_TYPE_INTEGER
,
'10'
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
,
null
,
null
,
'questionid'
);
/// Conditionally launch add field subqid
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
/// Define field aid to be added to quiz_question_response_stats
$field
=
new
xmldb_field
(
'aid'
,
XMLDB_TYPE_INTEGER
,
'10'
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
,
null
,
null
,
'subqid'
);
/// Conditionally launch add field aid
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008090500
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008111000
)
{
//delete all cached results first
$result
=
$result
&&
$DB
->
delete_records
(
'quiz_statistics'
);
...
...
@@ -127,18 +147,24 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
$table
=
new
xmldb_table
(
'quiz_question_statistics'
);
/// Define field subqid to be added to quiz_question_response_stats
$field
=
new
xmldb_field
(
'negcovar'
,
XMLDB_TYPE_INTEGER
,
'2'
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
,
null
,
'0'
,
'effectiveweight'
);
/// Conditionally launch add field subqid
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008111000
,
'quizreport'
,
'statistics'
);
}
if
(
$result
&&
$oldversion
<
2008112100
)
{
$result
=
$result
&&
$DB
->
set_field
(
'quiz_report'
,
'capability'
,
'quizreport/statistics:view'
,
array
(
'name'
=>
'statistics'
));
}
/// statistics savepoint reached
upgrade_plugin_savepoint
(
$result
,
2008112100
,
'quizreport'
,
'statistics'
);
}
return
$result
;
}
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