You are here

upgrade_rector.install in Upgrade Rector 8

Install, update, and uninstall functions for the Upgrade Rector module.

File

upgrade_rector.install
View source
<?php

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

/**
 * Implements hook_uninstall().
 */
function upgrade_rector_uninstall() {
  \Drupal::keyValue('upgrade_status_rector_results')
    ->deleteAll();
}

/**
 * Implements hook_requirements().
 */
function upgrade_rector_requirements($phase) {
  $requirements = array();
  if (in_array($phase, [
    'install',
    'runtime',
  ])) {
    $message = t('Available');
    $severity = REQUIREMENT_OK;
    $description = '';
    if (!function_exists('exec')) {
      $message = t('Disabled');
      $description = t('The exec() PHP function is disabled. Upgrade Rector is unable to work without that.');
      $severity = REQUIREMENT_ERROR;
    }
    $requirements['upgrade_rector'] = array(
      'title' => t('PHP exec()'),
      'value' => $message,
      'severity' => $severity,
      'description' => $description,
    );
  }
  return $requirements;
}