filecache-8.x-1.0-alpha3/filecache.install

filecache.install
<?php

/**
 * @file
 * Requirements hook for the File Cache module.
 */

declare(strict_types=1);

use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\filecache\Cache\FileSystemBackend;

/**
 * Implements hook_requirements().
 */
function filecache_requirements(string $phase): array {
  $requirements = [];

  // Only report warnings during a runtime check. It's not important to already
  // have cache bins configured during module installation.
  if ($phase !== 'runtime') {
    return $requirements;
  }

  // Check if any cache bins are using the file system cache backend.
  $bins = array_filter(Cache::getBins(), function (CacheBackendInterface $backend) {
    return $backend instanceof FileSystemBackend;
  });
  if (empty($bins)) {
    $requirements['filecache_missing_bins'] = [
      'title' => t('File Cache'),
      'value' => t('No cache bins are set up to use the file system cache backend. Please follow the instructions in the README.'),
      'severity' => REQUIREMENT_WARNING,
    ];
  }
  return $requirements;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc