mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-25 13:03:04 +07:00
Fix db extensions
This commit is contained in:
parent
933abd531a
commit
f3a1262ff6
@ -15,6 +15,19 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||
|
||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||
expect(win32).toContain('Add-Extension mysqli');
|
||||
expect(win32).toContain('Add-Extension mysqlnd');
|
||||
|
||||
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
||||
expect(win32).toContain('Add-Extension mysqli');
|
||||
expect(win32).toContain('Add-Extension mysqlnd');
|
||||
|
||||
win32 = await extensions.addExtension('mysql', '5.5', 'win32');
|
||||
expect(win32).toContain('Add-Extension mysql');
|
||||
expect(win32).toContain('Add-Extension mysqli');
|
||||
expect(win32).toContain('Add-Extension mysqlnd');
|
||||
|
||||
win32 = await extensions.addExtension(
|
||||
'phalcon3, does_not_exist',
|
||||
'7.2',
|
||||
|
21
dist/index.js
vendored
21
dist/index.js
vendored
@ -2611,7 +2611,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||
break;
|
||||
// match imagick
|
||||
case /imagick/.test(extension):
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
@ -2621,7 +2621,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
@ -2684,8 +2684,21 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
// match 5.3mysql..5.6mysql
|
||||
// match 5.3mysqli..5.6mysqli
|
||||
// match 5.3mysqlnd..5.6mysqlnd
|
||||
case /^5\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||
script +=
|
||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match 7.0mysql..8.0mysql
|
||||
// match 7.0mysqli..8.0mysqli
|
||||
// match 7.0mysqlnd..8.0mysqlnd
|
||||
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||
script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
@ -2789,7 +2802,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
|
@ -76,7 +76,7 @@ export async function addExtensionDarwin(
|
||||
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||
break;
|
||||
// match imagick
|
||||
case /imagick/.test(extension):
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
@ -86,7 +86,7 @@ export async function addExtensionDarwin(
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
@ -158,8 +158,21 @@ export async function addExtensionWindows(
|
||||
script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
// match 5.3mysql..5.6mysql
|
||||
// match 5.3mysqli..5.6mysqli
|
||||
// match 5.3mysqlnd..5.6mysqlnd
|
||||
case /^5\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||
script +=
|
||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match 7.0mysql..8.0mysql
|
||||
// match 7.0mysqli..8.0mysqli
|
||||
// match 7.0mysqlnd..8.0mysqlnd
|
||||
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||
script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
@ -269,7 +282,7 @@ export async function addExtensionLinux(
|
||||
script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
|
@ -27,7 +27,11 @@ remove_extension() {
|
||||
# Function to test if extension is loaded
|
||||
check_extension() {
|
||||
extension=$1
|
||||
php -m | grep -i -q -w "$extension"
|
||||
if [ "$extension" != "mysql" ]; then
|
||||
php -m | grep -i -q -w "$extension"
|
||||
else
|
||||
php -m | grep -i -q "$extension"
|
||||
fi
|
||||
}
|
||||
|
||||
# Fuction to get the PECL version
|
||||
|
@ -56,7 +56,12 @@ get_pecl_version() {
|
||||
|
||||
# Function to test if extension is loaded
|
||||
check_extension() {
|
||||
php -m | grep -i -q -w "$1"
|
||||
extension=$1
|
||||
if [ "$extension" != "mysql" ]; then
|
||||
php -m | grep -i -q -w "$extension"
|
||||
else
|
||||
php -m | grep -i -q "$extension"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to delete extensions
|
||||
|
Loading…
Reference in New Issue
Block a user