You are here

function tweet_feed_requirements in Tweet Feed 7.3

Implements hook_requirements().

File

./tweet_feed.install, line 200

Code

function tweet_feed_requirements($phase) {
  $t = get_t();
  $connection = Database::getConnection();
  $utf8mb4_configurable = $connection
    ->utf8mb4IsConfigurable();
  $utf8mb4_active = $connection
    ->utf8mb4IsActive();
  $utf8mb4_supported = $connection
    ->utf8mb4IsSupported();
  $requirements = array();
  $requirements['tweet_feed']['title'] = $t('Tweet Feed Database UTF-8 Support');
  if ($phase == 'runtime') {
    if ($utf8mb4_configurable && $utf8mb4_active && $utf8mb4_supported) {
      $requirements['tweet_feed']['value'] = 'UTF-8 Supported, enabled and ready.';
      $requirements['tweet_feed']['description'] = NULL;
      $requirements['tweet_feed']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['tweet_feed']['value'] = 'Not Supported.';

      //$requirements['tweet_feed']['description'] = $t('In order to properly support emoji and special character content, Tweet Feed now required UTF-8 database support. To learn how to configure this in Drupal, go to: https://www.drupal.org/node/2754539');
      $requirements['tweet_feed']['description'] = $t('Tweet Feed is now compliant with UTF-8 multibyte database support. To learn how to configure this in Drupal, go to: https://www.drupal.org/node/2754539. Support for non UTF-8 multibyte tables is deprecated and is likely to be removed in a future version.');
      $requirements['tweet_feed']['severity'] = REQUIREMENT_WARNING;
    }
  }

  /**
   * Keeping this code here for when we stop supporting non UTF-8 multibyte database tables.
   */

  /*
  elseif ($phase == 'install' || $phase == 'update') {
    if ($utf8mb4_configurable && $utf8mb4_active && $utf8mb4_supported) {
      $requirements['tweet_feed']['value'] = 'UTF-8 Supported, enabled and ready.';
      $requirements['tweet_feed']['description'] = NULL;
      $requirements['tweet_feed']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['tweet_feed']['value'] = 'Not Supported.';
      $requirements['tweet_feed']['description'] = $t('In order to properly support emoji and special character content, Tweet Feed now required UTF-8 database support. To learn how to configure this in Drupal, go to: https://www.drupal.org/node/2754539');
      $requirements['tweet_feed']['severity'] = REQUIREMENT_ERROR;
    }
  }
  */
  return $requirements;
}