yoti-8.x-2.5/yoti.install

yoti.install
<?php

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

use Drupal\Core\Site\Settings;
use Drupal\yoti\Models\YotiUserModel;
use Drupal\yoti\YotiHelper;

/**
 * Implements hook_requirements().
 */
function yoti_requirements($phase) {
  $requirements = [];

  if ($phase == 'install') {
    $privatePath = Settings::get('file_private_path');
    if (!$privatePath) {
      $requirements['yoti'] = [
        'description' => t("Yoti requires that you have the file_private_path setting enabled for your website. Don't forget to clear the cache after you enable this setting."),
        'severity' => REQUIREMENT_ERROR,
      ];
    }

    if ($privatePath && !is_writable($privatePath)) {
      $requirements['yoti'] = [
        'description' => t('Yoti could not be installed. The following folder must exist and be writable by the server: @path', ['@path' => $privatePath]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
    elseif ($privatePath) {
      // The path is writable so create Yoti file directory.
      \Drupal::service('file_system')->mkdir($privatePath . '/yoti', 0777, TRUE);
    }
  }

  return $requirements;
}

/**
 * Implements hook_schema().
 */
function yoti_schema() {
  $schema[YotiHelper::YOTI_USER_TABLE_NAME] = YotiUserModel::getYotiUserTableSchema();
  return $schema;
}

/**
 * Update Table users_yoti to remove unnecessary fields.
 *
 * Implements  hook_update_N().
 */
function yoti_update_8101(&$sandbox) {
  YotiUserModel::removeDuplicatedFieldsFromYotiUserTable();
}

/**
 * Implements hook_uninstall().
 */
function yoti_uninstall() {
  // Delete Yoti config data.
  \Drupal::configFactory()->getEditable('yoti.settings')->delete();
}

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

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