mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +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');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('gearman.sh');
|
||||||
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');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
||||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
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
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
command =
|
command =
|
||||||
'\nbash ' +
|
'\n. ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
path.join(__dirname, '../src/scripts/ext/gearman.sh');
|
||||||
' ' +
|
return;
|
||||||
version +
|
|
||||||
pipe;
|
|
||||||
break;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
|
@ -153,13 +153,9 @@ export async function addExtensionLinux(
|
|||||||
return;
|
return;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
command =
|
script +=
|
||||||
'\nbash ' +
|
'\n. ' + path.join(__dirname, '../src/scripts/ext/gearman.sh');
|
||||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
return;
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
pipe;
|
|
||||||
break;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
|
@ -1,9 +1,22 @@
|
|||||||
release_version=$(lsb_release -s -r)
|
# Helper function to add gearman extension.
|
||||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
add_gearman_helper() {
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
add_ppa ondrej/pkg-gearman
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev
|
||||||
if [ "$release_version" = "18.04" ]; then
|
enable_extension gearman extension
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
if ! check_extension gearman; then
|
||||||
elif [ "$release_version" = "16.04" ]; then
|
status="Installed and enabled"
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"${version:?}"-gearman || pecl_install gearman
|
||||||
|
enable_extension gearman extension
|
||||||
fi
|
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
|
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
|
# Function to test if extension is loaded
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -106,6 +116,7 @@ remove_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||||
sudo phpdismod -v "$version" "$extension"
|
sudo phpdismod -v "$version" "$extension"
|
||||||
|
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user