mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Accept PECL default parameters
This commit is contained in:
parent
83bdf158fa
commit
67152eb712
@ -136,7 +136,7 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension grpc');
|
||||
expect(darwin).toContain('add_brew_extension protobuf');
|
||||
expect(darwin).toContain('add_brew_extension swoole');
|
||||
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
||||
expect(darwin).toContain('pecl_install sqlite3');
|
||||
expect(darwin).toContain('remove_extension intl');
|
||||
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||
@ -163,13 +163,13 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension pcov');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.2.7');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.4.1');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.4.1');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.5.5');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
@ -181,18 +181,18 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
|
||||
expect(darwin).toContain('pecl_install redis-2.2.8');
|
||||
|
||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install -f redis');
|
||||
expect(darwin).toContain('pecl_install redis');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||
expect(darwin).toContain('pecl_install imagick');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||
expect(darwin).toContain('pecl_install imagick');
|
||||
|
||||
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
||||
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -3629,7 +3629,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
const version_extension = version + extension;
|
||||
const [ext_name, ext_version] = extension.split('-');
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
const command_prefix = 'pecl_install ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match :extension
|
||||
|
@ -20,7 +20,7 @@ export async function addExtensionDarwin(
|
||||
const version_extension: string = version + extension;
|
||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
const command_prefix = 'pecl_install ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match :extension
|
||||
|
@ -70,6 +70,12 @@ get_pecl_version() {
|
||||
echo "$pecl_version"
|
||||
}
|
||||
|
||||
# Function to install PECL extensions and accept default options
|
||||
pecl_install() {
|
||||
local extension=$1
|
||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to install a specific version of PECL extension.
|
||||
add_pecl_extension() {
|
||||
extension=$1
|
||||
@ -87,7 +93,7 @@ add_pecl_extension() {
|
||||
else
|
||||
remove_extension "$extension" >/dev/null 2>&1
|
||||
(
|
||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
||||
pecl_install "$extension-$pecl_version" &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
@ -161,12 +167,12 @@ add_tool() {
|
||||
if [ "$tool" = "composer" ]; then
|
||||
configure_composer "$tool_path"
|
||||
elif [ "$tool" = "phan" ]; then
|
||||
add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1
|
||||
add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1
|
||||
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
|
||||
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
|
||||
elif [ "$tool" = "phive" ]; then
|
||||
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
|
||||
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
|
||||
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
|
||||
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
|
||||
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
|
||||
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
|
||||
elif [ "$tool" = "cs2pr" ]; then
|
||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
||||
tr -d '\r' <"$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
||||
|
@ -91,6 +91,12 @@ get_pecl_version() {
|
||||
echo "$pecl_version"
|
||||
}
|
||||
|
||||
# Function to install PECL extensions and accept default options
|
||||
pecl_install() {
|
||||
local extension=$1
|
||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to check if an extension is loaded.
|
||||
check_extension() {
|
||||
extension=$1
|
||||
@ -167,8 +173,7 @@ add_extension() {
|
||||
install_command="update_lists && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
|
||||
fi
|
||||
eval "$install_command" >/dev/null 2>&1 ||
|
||||
(update_lists && eval "$install_command" >/dev/null 2>&1) ||
|
||||
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
fi
|
||||
@ -192,7 +197,7 @@ add_pecl_extension() {
|
||||
else
|
||||
delete_extension "$extension"
|
||||
(
|
||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
||||
pecl_install "$extension-$pecl_version" &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
|
Loading…
Reference in New Issue
Block a user