function drush_include

8.0.x drush_include($path, $name, $version = NULL, $extension = 'inc')
6.x drush_include($path, $name, $version = NULL, $extension = 'inc')
7.x drush_include($path, $name, $version = NULL, $extension = 'inc')
3.x drush_include($path, $name, $version = NULL, $extension = 'inc')
4.x drush_include($path, $name, $version = NULL, $extension = 'inc')
5.x drush_include($path, $name, $version = NULL, $extension = 'inc')
master drush_include($path, $name, $version = NULL, $extension = 'inc')

Include a file, selecting a version specific file if available.

For example, if you pass the path "/var/drush" and the name "update" when bootstrapped on a Drupal 6 site it will first check for the presence of "/var/drush/" in include it if exists. If this file does NOT exist it will proceed and check for "/var/drush/". If neither file exists, it will return FALSE.


$path: The path you want to search.

$name: The file base name you want to include (not including a version suffix or extension).

$version: The version suffix you want to include (could be specific to the software or platform your are connecting to) - defaults to the current Drupal core major version.

$extension: The extension - defaults to ".inc".

Return value

TRUE if the file was found and included.

2 calls to drush_include()
drush_include_engine in includes/
Include the engine code for a specific named engine of a certain type.
drush_sql_sanitize in commands/sql/
Command callback. Run's the sanitization operations on the current database.


includes/, line 63
The drush API implementation and helpers.


function drush_include($path, $name, $version = NULL, $extension = 'inc') {
  $version = ($version) ? $version : drush_drupal_major_version();
  $file = sprintf("%s/%s_%s.%s", $path, $name, $version, $extension);
  if (file_exists($file)) {
    //drush_log(dt('Including version specific file : @file', array('@file' => $file)));
    include_once ($file);
    return TRUE;
  $file = sprintf("%s/%s.%s", $path, $name, $extension);
  if (file_exists($file)) {
    //drush_log(dt('Including non-version specific file : @file', array('@file' => $file)));
    include_once ($file);
    return TRUE;