You are here

function quiz_update_6413 in Quiz 6.4

Implementation of hook_update_N

Make display feedback a quiz option, and not a global variable

File

./quiz.install, line 240
Quiz install schema for installing the quiz module

Code

function quiz_update_6413() {
  $results = array();
  db_add_field($results, 'quiz_node_properties', 'display_feedback', array(
    'type' => 'int',
    'size' => 'tiny',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 1,
  ));
  if (variable_get('quiz_display_feedback', 1) == 0) {
    $results[] = update_sql('
      UPDATE {quiz_node_properties}
      SET quiz_display_feedback = 0');
  }
  variable_del('quiz_display_feedback');
  db_add_field($results, 'quiz_user_settings', 'display_feedback', array(
    'type' => 'int',
    'size' => 'tiny',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 1,
  ));
  return $results;
}