mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix db extensions
This commit is contained in:
parent
3cfc409e14
commit
5ad0888329
@ -13,6 +13,19 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||
expect(win32).toContain('Add-Extension ast beta');
|
||||
|
||||
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.6', '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',
|
||||
@ -66,7 +79,7 @@ describe('Extension tests', () => {
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
let darwin: string = await extensions.addExtension(
|
||||
'Xdebug, pcov, sqlite3, ast-beta',
|
||||
'Xdebug, pcov, sqlite, ast-beta',
|
||||
'7.2',
|
||||
'darwin'
|
||||
);
|
||||
|
20
dist/index.js
vendored
20
dist/index.js
vendored
@ -2531,7 +2531,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 +
|
||||
@ -2541,7 +2541,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;
|
||||
@ -2587,8 +2587,19 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||
break;
|
||||
// match 5.6mysql, 5.6mysqli, 5.6mysqlnd
|
||||
case /^5\.6(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;
|
||||
@ -2665,7 +2676,8 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
'\n' +
|
||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
case /sqlite/.test(extension):
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
|
@ -45,7 +45,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 +
|
||||
@ -55,7 +55,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;
|
||||
@ -104,8 +104,19 @@ export async function addExtensionWindows(
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||
break;
|
||||
// match 5.6mysql, 5.6mysqli, 5.6mysqlnd
|
||||
case /^5\.6(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;
|
||||
@ -186,7 +197,8 @@ export async function addExtensionLinux(
|
||||
'\n' +
|
||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
case /sqlite/.test(extension):
|
||||
// match sqlite
|
||||
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
|
||||
|
@ -51,7 +51,11 @@ get_pecl_version() {
|
||||
# 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
|
||||
}
|
||||
|
||||
# Function to delete extensions
|
||||
|
Loading…
Reference in New Issue
Block a user