From 5c4ffd22feae4304557bd2a77cb90794e5149c8d Mon Sep 17 00:00:00 2001 From: Rajab Natshah Date: Sun, 18 Dec 2022 19:49:53 +0300 Subject: [PATCH] Switch to use the local Drush if it was installed in the project. Only use the global Drush in the system, when no local one in the project #55 --- scripts/update/update.php | 13 ------------- scripts/update/varbase-updater.sh | 7 +++++++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/update/update.php b/scripts/update/update.php index 3b3db90..8fbd00e 100644 --- a/scripts/update/update.php +++ b/scripts/update/update.php @@ -107,10 +107,6 @@ function get_file($url, $newfilename) { mkdir(getcwd().'/scripts/update', 0777, true); } - if (!file_exists(getcwd().'/drush')) { - mkdir(getcwd().'/drush', 0777, true); - } - if (!file_exists(getcwd().'/bin')) { mkdir(getcwd().'/bin', 0777, true); } @@ -134,15 +130,6 @@ function get_file($url, $newfilename) { get_file($base_path . "scripts/update/version-check.php", getcwd().'/scripts/update/version-check.php'); get_file($base_path . "scripts/update/update-config.json", getcwd().'/scripts/update/update-config.json'); - // Only download them if they don't exist. - if (!file_exists(getcwd().'/drush/policy.drush.inc')) { - get_file($base_path . "drush/policy.drush.inc", getcwd().'/drush/policy.drush.inc'); - } - - if (!file_exists(getcwd().'/drush/README.md')) { - get_file($base_path . "drush/README.md", getcwd().'/drush/README.md'); - } - chmod(getcwd().'/scripts/update/update-varbase.sh', 0755); chmod(getcwd().'/scripts/update/version-check.php', 0755); chmod(getcwd().'/scripts/composer/VarbaseUpdate.php', 0755); diff --git a/scripts/update/varbase-updater.sh b/scripts/update/varbase-updater.sh index b575b70..a96f0b6 100644 --- a/scripts/update/varbase-updater.sh +++ b/scripts/update/varbase-updater.sh @@ -12,7 +12,14 @@ DRUPALPATH='docroot'; if [ -d "${BASEDIR}/web" ]; then DRUPALPATH='web'; fi + +# Use the local Drush if it was insalled in the project. +# If not in the local, use the global Drush in the system. DRUSH="drush"; +if [ -d "${BASEDIR}/vendor/drush/drush" ]; then + DRUSH="${BASEDIR}/vendor/drush/drush/drush"; +fi + clear; echo "$(tput setaf 4)"; cat << "EOF"