You are here

function library_install in Library 7

Same name and namespace in other branches
  1. 5.2 library.install \library_install()
  2. 6.2 library.install \library_install()
  3. 6 library.install \library_install()

Implements hook_install().

File

./library.install, line 161
@author Jess Straatmann Install and uninstall all required databases.

Code

function library_install() {
  $t = get_t();
  $fields = array(
    'name' => 'Check Out',
    'status_change' => 1,
  );
  try {
    $return_value = db_insert('library_actions')
      ->fields($fields)
      ->execute();
  } catch (Exception $e) {
    drupal_set_message($t('db_insert failed. Message = %message, query= %query', array(
      '%message' => $e
        ->getMessage(),
      '%query' => $e->query_string,
    )), 'error');
  }
  $fields = array(
    'name' => 'Check In',
    'status_change' => 2,
  );
  try {
    $return_value = db_insert('library_actions')
      ->fields($fields)
      ->execute();
  } catch (Exception $e) {
    drupal_set_message($t('db_insert failed. Message = %message, query= %query', array(
      '%message' => $e
        ->getMessage(),
      '%query' => $e->query_string,
    )), 'error');
  }

  // Notify user of changes.
  // @ignore rule:sniffer_files_linelength_toolong
  drupal_set_message($t('Library module successfully installed. You can configure library settings at admin/config/workflow/library. To start creating library items, edit one or more content types to be included in the library.'));
}