X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FCommand%2FCommandfiles.php;fp=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FCommand%2FCommandfiles.php;h=516f71f3f22953610a657dbf7b6d36e85d7a725b;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drush/drush/lib/Drush/Command/Commandfiles.php b/vendor/drush/drush/lib/Drush/Command/Commandfiles.php new file mode 100644 index 000000000..516f71f3f --- /dev/null +++ b/vendor/drush/drush/lib/Drush/Command/Commandfiles.php @@ -0,0 +1,69 @@ +cache = array(); + $this->deferred = array(); + } + + function get() { + return $this->cache; + } + + function deferred() { + return $this->deferred; + } + + function sort() { + ksort($this->cache); + } + + function add($commandfile) { + $load_command = FALSE; + + $module = basename($commandfile); + $module = preg_replace('/\.*drush[0-9]*\.inc/', '', $module); + $module_versionless = preg_replace('/\.d([0-9]+)$/', '', $module); + if (!isset($this->cache[$module_versionless])) { + $drupal_version = ''; + if (preg_match('/\.d([0-9]+)$/', $module, $matches)) { + $drupal_version = $matches[1]; + } + if (empty($drupal_version)) { + $load_command = TRUE; + } + else { + if (function_exists('drush_drupal_major_version') && ($drupal_version == drush_drupal_major_version())) { + $load_command = TRUE; + } + else { + // Signal that we should try again on + // the next bootstrap phase. + $this->deferred[$module] = $commandfile; + } + } + if ($load_command) { + $this->cache[$module_versionless] = $commandfile; + require_once $commandfile; + unset($this->deferred[$module]); + } + } + return $load_command; + } +}