mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve phalcon scripts
This commit is contained in:
parent
88c7757dc8
commit
3454287b87
@ -22,7 +22,7 @@ Function Install-Phalcon() {
|
|||||||
$zip_file = $match.Matches[0].Groups[1].Value
|
$zip_file = $match.Matches[0].Groups[1].Value
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||||
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll > $null 2>&1
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
}
|
}
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
||||||
|
@ -27,14 +27,7 @@ install_phalcon() {
|
|||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to remove an extensions
|
ini_file="/etc/php/$2/cli/conf.d/50-phalcon.ini"
|
||||||
remove_extension() {
|
|
||||||
extension=$1
|
|
||||||
sudo sed -i "/$extension/d" "$ini_file"
|
|
||||||
rm -rf "$ext_dir/$extension.so"
|
|
||||||
}
|
|
||||||
|
|
||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
|
||||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
||||||
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
||||||
@ -44,18 +37,16 @@ cross="✗"
|
|||||||
|
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
if [ "$extension_major_version" = "4" ]; then
|
||||||
if [ -e "$ext_dir/psr.so" ]; then
|
if [ -e "$ext_dir/psr.so" ]; then
|
||||||
echo "extension=psr" >>"$ini_file"
|
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
if php -m | grep -i -q -w psr; then
|
if php -m | grep -i -q -w psr; then
|
||||||
echo "extension=phalcon" >>"$ini_file"
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
phalcon_version=$(php -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
remove_extension "psr" >/dev/null 2>&1
|
|
||||||
remove_extension "phalcon" >/dev/null 2>&1
|
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -68,12 +59,11 @@ fi
|
|||||||
|
|
||||||
if [ "$extension_major_version" = "3" ]; then
|
if [ "$extension_major_version" = "3" ]; then
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
echo "extension=phalcon" >>"$ini_file"
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
phalcon_version=$(php -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
remove_extension "phalcon" >/dev/null 2>&1
|
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -6,13 +6,8 @@ ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
|||||||
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
echo "extension=psr" >>"$ini_file"
|
echo "extension=psr" >>"$ini_file"
|
||||||
echo "extension=phalcon" >>"$ini_file"
|
echo "extension=phalcon" >>"$ini_file"
|
||||||
phalcon_semver=$(php -r "echo phpversion('phalcon');")
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
phalcon_version=$(echo "$phalcon_semver" | cut -d'.' -f 1)
|
|
||||||
if [ "$phalcon_version" != "$extension_major" ]; then
|
if [ "$phalcon_version" != "$extension_major" ]; then
|
||||||
sudo sed -i '' "/psr/d" "$ini_file"
|
|
||||||
sudo sed -i '' "/phalcon/d" "$ini_file"
|
|
||||||
rm -rf "$ext_dir"/psr.so
|
|
||||||
rm -rf "$ext_dir"/phalcon.so
|
|
||||||
brew tap shivammathur/homebrew-phalcon
|
brew tap shivammathur/homebrew-phalcon
|
||||||
brew install phalcon@"$php_version"_"$extension_major"
|
brew install phalcon@"$php_version"_"$extension_major"
|
||||||
fi
|
fi
|
||||||
|
BIN
update.zip
Normal file
BIN
update.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user