You are here

function w3c_validator_update_8001 in W3C Validator 8

Update W3C Validator storage table to add support for validator messages.

File

./w3c_validator.install, line 138
Install, update and uninstall functions for the w3c_validator module.

Code

function w3c_validator_update_8001() {
  $info_count = [
    'description' => 'Number of infos found during validation.',
    'type' => 'int',
    'unsigned' => TRUE,
    'size' => 'small',
    'not null' => TRUE,
    'default' => 0,
    'disp-width' => '5',
  ];
  $infos = [
    'description' => 'Detailled information about infos.',
    'type' => 'text',
    'size' => 'big',
  ];
  try {
    $schema = Database::getConnection()
      ->schema();
    $schema
      ->addField('w3c_validator', 'info_count', $info_count);
    $schema
      ->addField('w3c_validator', 'infos', $infos);
  } catch (Exception $e) {
    throw new UpdateException('W3C Validation table could not be properly updated.');
  }
  return 'W3C Validation table has been updated.';
}