You are here

function node_gallery_api_requirements in Node Gallery 7

Implements hook_requirements().

File

./node_gallery_api.install, line 131
Install, update and uninstall functions for the node_gallery_api module.

Code

function node_gallery_api_requirements($phase) {
  $t = get_t();
  $requirements = array();

  // Do not let this module be enabled if a D6 table schema exists.
  // Update.php must be run with this module disabled, and it will be enabled
  // as part of the upgrade process in node_gallery_update_7001().
  if ($phase === 'install') {
    $node_gallery_schema = drupal_get_installed_schema_version('node_gallery');
    $d6_table_exists = db_table_exists('node_gallery_images');
    if ($node_gallery_schema < 7000 && $d6_table_exists) {
      $requirements['node_gallery_upgrade'] = array(
        'description' => $t('Node Gallery API cannot be enabled because updates need to be run. With this module in place (but disabled), run <a href="!url">update.php</a>. Node Gallery API will be enabled as part of the upgrade path.', array(
          '!url' => base_path() . 'update.php',
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => NULL,
      );
    }
  }
  return $requirements;
}