function drush_drupal_major_version

8.0.x drupal.inc drush_drupal_major_version($drupal_root = NULL)
6.x drupal.inc drush_drupal_major_version($drupal_root = NULL)
7.x drupal.inc drush_drupal_major_version($drupal_root = NULL)
3.x drush.inc drush_drupal_major_version()
4.x drush.inc drush_drupal_major_version($drupal_root = NULL)
5.x drupal.inc drush_drupal_major_version($drupal_root = NULL)
master drupal.inc drush_drupal_major_version($drupal_root = NULL)

Returns the Drupal major version number (6, 7, 8 ...)

63 calls to drush_drupal_major_version()
drush_archive_restore in commands/core/archive.drush.inc
Command callback. Restore web site(s) from a site archive file.
drush_backend_batch_process in includes/batch.inc
Process a Drupal batch by spawning multiple Drush processes.
drush_batch_command in includes/batch.inc
Process sets from the specified batch.
drush_cache_clear_theme_registry in commands/core/cache.drush.inc
drush_cache_clear_types in commands/core/cache.drush.inc
All types of caches available for clearing. Contrib commands can alter in their own.

... See full list

File

includes/drupal.inc, line 58
Utility functions related to Drupal.

Code

function drush_drupal_major_version($drupal_root = NULL) {
  $major_version = FALSE;
  if ($version = drush_drupal_version($drupal_root)) {
    $version_parts = explode('.', $version);
    if (is_numeric($version_parts[0])) {
      $major_version = (integer) $version_parts[0];
    }
  }
  return $major_version;
}