You are here

tcpdf.install in TCPDF 8

Same filename and directory in other branches
  1. 7 tcpdf.install

Contains requirements for the TCPDF module.

File

tcpdf.install
View source
<?php

/**
 * @file
 * Contains requirements for the TCPDF module.
 */

/**
 * Implements hook_requirements().
 */
function tcpdf_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $tcpdf_file_dir = 'temporary://tcpdf/cache';
    $problematic_uris = array();
    $cache_dir = $tcpdf_file_dir . 'cache';
    if (!file_prepare_directory($cache_dir, FILE_CREATE_DIRECTORY)) {
      $problematic_uris['cachedir'] = $cache_dir;
    }
    else {
      $requirements['tcpdf_cachedir'] = array(
        'title' => t('TCPDF cache directory'),
        'severity' => REQUIREMENT_OK,
        'value' => t('Exists'),
      );
    }
    foreach ($problematic_uris as $uri) {
      $requirements['tcpdf_cache']['description'] = t('The TCPDF cache directory, %path could not be created or modified due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array(
        '%path' => $uri,
      ));
      $requirements['tcpdf_cache']['severity'] = REQUIREMENT_ERROR;
      $requirements['tcpdf_cache']['value'] = t('Unable to create');
    }
    $requirements["tcpdf_available"] = array(
      'title' => t('TCPDF library'),
      'value' => class_exists('TCPDF') ? t('Available') : t('Not available'),
      'severity' => class_exists('TCPDF') ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}

Functions

Namesort descending Description
tcpdf_requirements Implements hook_requirements().