Fix wp-cli support

This commit is contained in:
Shivam Mathur
2020-02-22 21:41:40 +05:30
parent d95ca49e8d
commit 68c827cfcf
6 changed files with 25 additions and 24 deletions

View File

@ -93,7 +93,8 @@ add_tool() {
composer -q global config process-timeout 0
add_log "$tick" "$tool" "Added"
else
tool_path=/usr/local/bin/"$tool"
tool_path_dir=/usr/local/bin
tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
@ -110,7 +111,7 @@ add_tool() {
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
sudo chmod a+x "$tool_path"
elif [ "$tool" = "wp-cli" ]; then
sudo cp "$tool_path" /usr/local/bin/wp
sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi
add_log "$tick" "$tool" "Added"
else

View File

@ -150,7 +150,8 @@ update_extension() {
add_tool() {
url=$1
tool=$2
tool_path=/usr/local/bin/"$tool"
tool_path_dir=/usr/local/bin
tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
@ -166,7 +167,7 @@ add_tool() {
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
elif [ "$tool" = "wp-cli" ]; then
sudo cp "$tool_path" /usr/local/bin/wp
sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi
add_log "$tick" "$tool" "Added"
else

View File

@ -124,6 +124,8 @@ Function Add-Tool() {
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
} elseif($tool -eq "composer") {
composer -q global config process-timeout 0
} elseif($tool -eq "wp-cli") {
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
}
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
Add-Log $tick $tool "Added"