mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix gearman setup
This commit is contained in:
parent
12d6e834b7
commit
70cd53866f
@ -58,18 +58,7 @@ describe('Extension tests', () => {
|
||||
);
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.0');
|
||||
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.1');
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.2');
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.3');
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.4');
|
||||
expect(linux).toContain('gearman.sh');
|
||||
|
||||
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||
|
9
dist/index.js
vendored
9
dist/index.js
vendored
@ -1934,12 +1934,9 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
command =
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
||||
' ' +
|
||||
version +
|
||||
pipe;
|
||||
break;
|
||||
'\n. ' +
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
|
@ -153,13 +153,9 @@ export async function addExtensionLinux(
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
command =
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
||||
' ' +
|
||||
version +
|
||||
pipe;
|
||||
break;
|
||||
script +=
|
||||
'\n. ' + path.join(__dirname, '../src/scripts/ext/gearman.sh');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
|
@ -1,9 +1,22 @@
|
||||
release_version=$(lsb_release -s -r)
|
||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
|
||||
if [ "$release_version" = "18.04" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
||||
elif [ "$release_version" = "16.04" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
||||
# Helper function to add gearman extension.
|
||||
add_gearman_helper() {
|
||||
add_ppa ondrej/pkg-gearman
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev
|
||||
enable_extension gearman extension
|
||||
if ! check_extension gearman; then
|
||||
status="Installed and enabled"
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"${version:?}"-gearman || pecl_install gearman
|
||||
enable_extension gearman extension
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to add gearman extension.
|
||||
add_gearman() {
|
||||
status="Enabled"
|
||||
add_gearman_helper >/dev/null 2>&1
|
||||
if check_extension gearman; then
|
||||
add_log "${tick:?}" "gearman" "$status"
|
||||
fi
|
||||
}
|
||||
|
||||
add_gearman
|
||||
|
@ -82,6 +82,16 @@ pecl_install() {
|
||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to enable existing extensions.
|
||||
enable_extension() {
|
||||
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
|
||||
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
||||
fi
|
||||
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
|
||||
echo "$2=$ext_dir/$1.so" | sudo tee -a "$pecl_file" >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to test if extension is loaded
|
||||
check_extension() {
|
||||
extension=$1
|
||||
@ -106,6 +116,7 @@ remove_extension() {
|
||||
extension=$1
|
||||
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||
sudo phpdismod -v "$version" "$extension"
|
||||
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
|
||||
fi
|
||||
delete_extension "$extension"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user