You are here

monolog.install in Monolog 6

Same filename and directory in other branches
  1. 8 monolog.install
  2. 7 monolog.install
  3. 2.x monolog.install

Install, update, and uninstall functions for the Monolog module.

File

monolog.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the Monolog module.
 */

/**
 * Implements hook_schema().
 */
function monolog_schema() {
  $schema = array();
  $schema['monolog_profile'] = array(
    'description' => 'Logging profiles for logging channels.',
    'export' => array(
      'key' => 'name',
      'identifier' => 'profile',
      'default hook' => 'default_monolog_profiles',
      'api' => array(
        'owner' => 'monolog',
        'api' => 'monolog',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'description' => 'The machine readable name of the profile.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'options' => array(
        'description' => 'Serialized storage of profile options.',
        'type' => 'blob',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function monolog_uninstall() {
  variable_del('monolog_channel_profiles');
}

/**
 * Change the machine name of the "stream_handler" handler to "stream".
 */
function monolog_update_7100() {
  $result = db_query('SELECT name, options FROM {monolog_profile}');
  foreach ($result as $record) {
    $options = unserialize($record->options);
    foreach ($options['handlers'] as $handler_name => $handler_config) {
      if ('stream_handler' == $handler_config['handler']) {
        $options['handlers'][$handler_name]['handler'] = 'stream';
      }
    }
    db_update('monolog_profile')
      ->fields(array(
      'options' => serialize($options),
    ))
      ->condition('name', $record->name)
      ->execute();
  }
}

Functions

Namesort descending Description
monolog_schema Implements hook_schema().
monolog_uninstall Implements hook_uninstall().
monolog_update_7100 Change the machine name of the "stream_handler" handler to "stream".