-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz.install
793 lines (772 loc) · 25.3 KB
/
quiz.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
<?php
/**
* @file
* Quiz install schema for installing the quiz module.
*/
/**
* Implements hook_install().
*/
function quiz_install() {
$types = node_type_get_types();
node_add_body_field($types['quiz']);
$config = config('quiz.settings');
// Default the "Show Author and Date" for quiz nodes to OFF.
$temp_array = $config->get('theme_settings');
$temp_array['toggle_node_info_quiz'] = 0;
$config->set('theme_settings', $temp_array);
// Default the comment settings to disabled.
$config->set('comment_quiz', '0');
backdrop_set_message(t('Quiz module has been enabled. To !create_a_quiz go to Create Content -> Quiz.', array('!create_a_quiz' => l(t('create a quiz'), 'node/add/quiz'))));
// Grant default permissions.
user_role_grant_permissions(BACKDROP_AUTHENTICATED_ROLE, array('view own quiz results'));
user_role_grant_permissions(BACKDROP_AUTHENTICATED_ROLE, array('access quiz'));
// TODO: REVIEW AND THESE GO AWAY.
// Set up default admin feedback review options.
// quiz_update_7514();
// Set up default quiz result answer display.
// quiz_update_7521();
// Install a default bundle.
try {
db_insert('quiz_result_type')
->fields(array('label' => 'Quiz result', 'type' => 'quiz_result'))
->execute();
}
catch (FieldsOverlapException $e) {
// TODO: Watchdog
}
catch (NoFieldsException $e) {
// TODO: Watchdog
}
}
/**
* Implements hook_schema().
*/
function quiz_schema() {
$schema = array();
/*
* Connect all the quiz specific properties to the correct version of a quiz.
*/
// Create the quiz node properties table.
$schema['quiz_node_properties'] = array(
'description' => 'The base table for quiz nodes',
'fields' => array(
'qnp_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary identifier of a Quiz, or Quiz default settings object.',
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The current {quiz}.vid version identifier.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The primary identifier for the Quiz node.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'User ID of the Quiz default settings object.',
),
'number_of_random_questions' => array(
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Number of random questions to pull from the pool.',
),
'max_score_for_random' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
'description' => 'Maximum score per random question.',
),
'pass_rate' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => FALSE,
'description' => 'Passing rate out of 100.',
),
'summary_pass' => array(
'type' => 'text',
'description' => 'Summary text for a passing grade.',
),
'summary_pass_format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'Input format for the passing summary text.',
),
'summary_default' => array(
'type' => 'text',
'description' => 'Summary text for any grade.',
),
'summary_default_format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Input format for the default summary text.',
),
'randomization' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => 'Enumerated field indicating if this Quiz has random questions. 0=none, 1=random order, 2=random questions, 3=random taxonomy',
),
'backwards_navigation' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
'description' => 'Boolean indicating whether a quiz taker can navigate backwards.',
),
'keep_results' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 2,
'description' => 'Enumerated field indicating if this Quiz should prune old results. 0=only keep best, 1=only keep newest, 2=keep all',
),
'repeat_until_correct' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether a quiz taker must repeat the question until selecting the correct answer.',
),
'quiz_open' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp when the quiz will open.',
),
'quiz_close' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp when the quiz will close.',
),
'takes' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Limit the number of times this Quiz can be taken by a learner. 0 for unlimited.',
),
'show_attempt_stats' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 1,
'description' => 'Boolean indicating whether or not to show the allowed attempts on the Quiz node.',
),
'time_limit' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Number of seconds for a user to complete an attempt.',
),
'quiz_always' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether the quiz will ignore the quiz open and close dates.',
),
'time_left' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => 'Deprecated field, no longer used.',
),
'max_score' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The max score of this Quiz.',
),
'allow_skipping' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether the user can skip a question.',
),
'allow_resume' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 1,
'description' => 'Boolean indicating whether a user can resume a Quiz after logging out and in.',
),
'allow_jumping' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether a user can skip to any question.',
),
'allow_change' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
'description' => 'Boolean indicating whether a user can change the answer to an already answered question.',
),
'allow_change_blank' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether a user can change the answer to a skipped question.',
),
'build_on_last' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'Enumerated field indicating whether a user can build on the last attempt. "" for none, "correct" for correct answers only, "all" for all answers.',
),
'show_passed' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 1,
'description' => 'Boolean indicating whether a message should display when the user has already passed this quiz.',
),
'mark_doubtful' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether a user can mark a question as doubtful.',
),
'review_options' => array(
'type' => 'text',
'serialize' => TRUE,
'description' => 'Serialized field containing feedback times and options.',
),
'result_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The result bundle to use.',
),
),
'primary key' => array('qnp_id'),
'indexes' => array('quiz_id' => array('vid', 'nid')),
);
/*
* Both a quiz and a quiz question are nodes with versions. A quiz is a parent
* node of a quiz question, making the quiz question the child.
*
* The quiz_node_relationship table stores this relationship in a way that
* allows a quiz question to be the child of multiple quizzes without losing
* version history.
*/
// Create the quiz node relationship table.
$schema['quiz_node_relationship'] = array(
'description' => 'Table storing what questions belong to what quizzes',
'fields' => array(
'qnr_id' => array(
'type' => 'serial',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The primary identifier of this relationship.',
),
'qnr_pid' => array(
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
'description' => 'The parent relationship of this relationship.',
),
'parent_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The quiz that this question belongs to.',
),
'parent_vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The quiz version that this question belongs to.',
),
'child_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The question node ID.',
),
'child_vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The question node version ID.',
),
'question_status' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
'description' => 'The status of the question in this quiz. 0=random, 1=always, 2=never',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The weight of this question in the Quiz.',
),
'max_score' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The max score of the question in this Quiz.',
),
'auto_update_max_score' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether updates to the question will update the max score of the question in the Quiz.',
),
),
'primary key' => array('qnr_id'),
'unique keys' => array(
'parent_child' => array('parent_nid', 'parent_vid', 'child_nid', 'child_vid'),
),
'indexes' => array(
'parent_id' => array('parent_vid'),
'child_id' => array('child_vid'),
'parent_nid' => array('parent_nid'),
'child_nid' => array('child_nid'),
'qnr_pid' => array('qnr_pid'),
),
);
/*
* Quiz specific options concerning availability and access to scores.
*/
// Create the quiz node results table.
$schema['quiz_node_results'] = array(
'description' => 'Table storing the total results for a quiz',
'fields' => array(
'result_id' => array(
'type' => 'serial',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The primary identifier for this result.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The quiz ID associated with this result.',
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The quiz version ID associated with this result.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The user associated with this result.',
),
'time_start' => array(
'type' => 'int',
'unsigned' => FALSE,
'description' => 'Unix timestamp when this result started.',
),
'time_end' => array(
'type' => 'int',
'unsigned' => FALSE,
'description' => 'Unix timestamp when this result ended. A NULL value indicates a quiz result not completed.',
),
'released' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'description' => 'This field is not referenced.',
),
'score' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The score of this result from 0 to 100.',
),
'is_invalid' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating if this result is marked for deletion.',
),
'is_evaluated' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating if this quiz requires manual grading and if it has been graded.',
),
'time_left' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => 'Deprecated field, no longer used.',
),
'attempt' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'description' => 'The number of this attempt.',
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The result bundle.',
),
),
'primary key' => array('result_id'),
'indexes' => array(
'user_results' => array('uid', 'vid', 'nid'),
'vid' => array('vid'),
),
);
/*
* Information about a particular question in a result.
*/
$schema['quiz_node_results_answers'] = array(
'description' => 'Table storing information about each question response in an attempt.',
'fields' => array(
'result_answer_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The primary identifier for this result answer.',
),
'result_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The result ID associated with this answer.',
),
'question_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The question ID of the answer.',
),
'question_vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The question version ID of the answer.',
),
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'description' => 'The taxonomy ID this question response was answered within, if this Quiz contained categorized random questions.',
),
'is_correct' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether this answer was correct.',
),
'is_skipped' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Boolean indicating whether this question was skipped.',
),
'points_awarded' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
'description' => 'Points awarded for this response.',
),
'answer_timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
'description' => 'Unix timestamp when this question was answered.',
),
'number' => array(
'type' => 'int',
'size' => 'small',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 1,
'description' => 'The number of the question in the result.',
),
'display_number' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
'description' => 'The display number of the question in the result.',
),
'is_doubtful' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Boolean indicating whether the user marked this answer as doubtful.',
),
),
'primary key' => array('result_answer_id'),
'unique keys' => array(
'result_answer' => array('result_id', 'question_nid', 'question_vid'),
),
'indexes' => array(
'result_id' => array('result_id'),
),
);
/*
* Allows custom feedback based on the results of a user completing a quiz.
*/
// Create the quiz node result options table.
$schema['quiz_node_result_options'] = array(
'description' => 'Table storing result options for quizzes. Several result options may belong to a single quiz.',
'fields' => array(
'option_id' => array(
'type' => 'serial',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The primary identifier for the range.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Quiz ID associated with this range.',
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Quiz version ID associated with this range.',
),
'option_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The name of this range.',
),
'option_summary' => array(
'type' => 'text',
'description' => 'The text to show when this range is met.',
),
'option_summary_format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Text format of the range text.',
),
'option_start' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'description' => 'Score range low value.',
),
'option_end' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'description' => 'Score range high value.',
),
),
'primary key' => array('option_id'),
'indexes' => array(
'quiz_id' => array('vid', 'nid'),
),
);
$schema['quiz_terms'] = array(
'description' => 'Table storing what terms belongs to what quiz for categorized random quizzes',
'fields' => array(
'nid' => array(
'description' => 'The quiz ID of this quiz term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => 'The quiz version ID of this quiz term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'weight' => array(
'description' => 'The terms weight decides the order of the terms',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'tid' => array(
'description' => 'Taxonomy term ID from which to pull questions.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'max_score' => array(
'description' => 'Max score for each question marked with this term.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
'number' => array(
'description' => 'Number of questions to be drawn from this term.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('vid', 'tid'),
'indexes' => array(
'version' => array('vid'),
),
);
$schema['quiz_result_type'] = array(
'description' => 'Stores information about all defined quiz result types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Unique result type ID.',
),
'type' => array(
'description' => 'The machine-readable name of this result type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this result type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x01,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
return $schema;
}
/**
* Move Quiz settings from Drupal 7 variables in the database to the Backdrop way of using config.
*/
function quiz_update_1000() {
// Migrate variables to config.
$config = config('quiz.settings');
$config->set('quiz_max_result_options', update_variable_get('quiz_max_result_options', 5));
$config->set('quiz_default_close', update_variable_get('quiz_default_close', 30));
$config->set('quiz_use_passfail', update_variable_get('quiz_use_passfail', 1));
$config->set('quiz_auto_revisioning', update_variable_get('quiz_auto_revisioning', 1));
$config->set('quiz_durod', update_variable_get('quiz_durod', 0));
$config->set('quiz_pager_start', update_variable_get('quiz_pager_start', 100));
$config->set('quiz_has_timer', update_variable_get('quiz_has_timer', 0));
$config->set('quiz_name', update_variable_get('quiz_name', 'Quix'));
$config->set('quiz_remove_partial_quiz_record', update_variable_get('quiz_remove_partial_quiz_record', 0));
$config->set('quiz_remove_invalid_quiz_record', update_variable_get('quiz_remove_invalid_quiz_record', 86400));
$config->set('quiz_index_questions', update_variable_get('quiz_index_questions', 1));
$config->set('quiz_autotitle_length', update_variable_get('quiz_autotitle_length', 50));
$config->set('quiz_pager_siblings', update_variable_get('quiz_pager_siblings', 5));
$config->set('quiz_time_limit_buffer', update_variable_get('quiz_time_limit_buffer', 5));
$config->set('node_options_quiz', update_variable_get('node_options_quiz', array()));
$config->save();
// Delete variables.
update_variable_del('quiz_max_result_options');
update_variable_del('quiz_default_close');
update_variable_del('quiz_use_passfail');
update_variable_del('quiz_auto_revisioning');
update_variable_del('quiz_durod');
update_variable_del('quiz_pager_start');
update_variable_del('quiz_has_timer');
update_variable_del('quiz_name');
update_variable_del('quiz_remove_partial_quiz_record');
update_variable_del('quiz_remove_invalid_quiz_record');
update_variable_del('quiz_index_questions');
update_variable_del('quiz_autotitle_length');
update_variable_del('quiz_pager_siblings');
update_variable_del('quiz_time_limit_buffer');
update_variable_del('node_options_quiz');
}
/**
* Implements hook_update_last_removed().
*/
function quiz_update_last_removed() {
return 7525;
}
/**
* Implements hook_uninstall().
*/
function quiz_uninstall() {
/* DEPRECATED because Backdrop doesn't use variables in the same way.
db_delete('variable')
->condition('name', "quiz_%", 'like')
->execute();
*/
}