Security update for Core, with self-updated composer
[yaffs-website] / vendor / drush / drush / commands / core / init.drush.inc
index 183a41b5cfa1c030c88b66fb27078fca5911479f..2ab26a0a7b64ead812676fdccb2e3e08f0a35b4f 100644 (file)
@@ -61,6 +61,16 @@ function drush_init_core_init() {
     drush_log(dt("Copied example Drush configuration file to !path", array('!path' => $drush_config_file)), LogLevel::OK);
   }
 
+  // If Drush is not in the $PATH, then figure out which
+  // path to add so that Drush can be found globally.
+  $add_path = drush_get_option('add-path', NULL);
+  if ((!drush_which("drush") || $add_path) && ($add_path !== FALSE)) {
+    $drush_path = drush_find_path_to_drush($home);
+    $drush_path = preg_replace("%^" . preg_quote($home) . "/%", '$HOME/', $drush_path);
+
+    $bashrc_additions["%$drush_path%"] = "\n# Path to Drush, added by 'drush init'.\nexport PATH=\"\$PATH:$drush_path\"\n\n";
+  }
+
   // If there is no ~/.drush/drush.bashrc file, then copy
   // the example bashrc file there
   if (!is_file($drush_bashrc)) {
@@ -91,16 +101,6 @@ function drush_init_core_init() {
   // ~/.bashrc or ~/.bash_profile
   $bashrc = drush_init_find_bashrc($home);
 
-  // If Drush is not in the $PATH, then figure out which
-  // path to add so that Drush can be found globally.
-  $add_path = drush_get_option('add-path', NULL);
-  if ((!drush_which("drush") || $add_path) && ($add_path !== FALSE)) {
-    $drush_path = drush_find_path_to_drush($home);
-    $drush_path = preg_replace("%^" . preg_quote($home) . "/%", '$HOME/', $drush_path);
-
-    $bashrc_additions["%$drush_path%"] = "\n# Path to Drush, added by 'drush init'.\nexport PATH=\"\$PATH:$drush_path\"\n\n";
-  }
-
   // Modify the user's bashrc file, adding our customizations.
   $bashrc_contents = "";
   if (file_exists($bashrc)) {