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 grpc stable 1.2.3');
|
||||||
expect(win32).toContain('Add-Extension inotify alpha 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(
|
win32 = await extensions.addExtension(
|
||||||
'phalcon3, does_not_exist',
|
'phalcon3, does_not_exist',
|
||||||
'7.2',
|
'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;
|
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
// match imagick
|
// match imagick
|
||||||
case /imagick/.test(extension):
|
case /^imagick$/.test(extension):
|
||||||
command =
|
command =
|
||||||
'brew install pkg-config imagemagick' +
|
'brew install pkg-config imagemagick' +
|
||||||
pipe +
|
pipe +
|
||||||
@ -2621,7 +2621,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension + pipe;
|
command = command_prefix + extension + pipe;
|
||||||
break;
|
break;
|
||||||
@ -2684,8 +2684,21 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
script +=
|
script +=
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
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
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
script += '\nAdd-Extension ' + extension;
|
script += '\nAdd-Extension ' + extension;
|
||||||
break;
|
break;
|
||||||
@ -2789,7 +2802,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
script += '\nadd_pdo_extension ' + extension;
|
script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
|
@ -76,7 +76,7 @@ export async function addExtensionDarwin(
|
|||||||
command = command_prefix + 'redis-2.2.8' + pipe;
|
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
// match imagick
|
// match imagick
|
||||||
case /imagick/.test(extension):
|
case /^imagick$/.test(extension):
|
||||||
command =
|
command =
|
||||||
'brew install pkg-config imagemagick' +
|
'brew install pkg-config imagemagick' +
|
||||||
pipe +
|
pipe +
|
||||||
@ -86,7 +86,7 @@ export async function addExtensionDarwin(
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension + pipe;
|
command = command_prefix + extension + pipe;
|
||||||
break;
|
break;
|
||||||
@ -158,8 +158,21 @@ export async function addExtensionWindows(
|
|||||||
script +=
|
script +=
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
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
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
script += '\nAdd-Extension ' + extension;
|
script += '\nAdd-Extension ' + extension;
|
||||||
break;
|
break;
|
||||||
@ -269,7 +282,7 @@ export async function addExtensionLinux(
|
|||||||
script += '\nadd_pdo_extension ' + extension;
|
script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /sqlite/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
|
@ -27,7 +27,11 @@ remove_extension() {
|
|||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
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
|
# Fuction to get the PECL version
|
||||||
|
@ -56,7 +56,12 @@ get_pecl_version() {
|
|||||||
|
|
||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
check_extension() {
|
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
|
# Function to delete extensions
|
||||||
|
Loading…
Reference in New Issue
Block a user