mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve extension support
This commit is contained in:
parent
a5e5d07fcb
commit
2937ad6e7a
@ -3,12 +3,13 @@ import * as extensions from '../src/extensions';
|
||||
describe('Extension tests', () => {
|
||||
it('checking addExtensionOnWindows', async () => {
|
||||
let win32: string = await extensions.addExtension(
|
||||
'xdebug, pcov, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
||||
'Xdebug, pcov, sqlite, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
||||
'7.4',
|
||||
'win32'
|
||||
);
|
||||
expect(win32).toContain('Add-Extension xdebug');
|
||||
expect(win32).toContain('Add-Extension pcov');
|
||||
expect(win32).toContain('Add-Extension sqlite3');
|
||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||
expect(win32).toContain('Add-Extension ast beta');
|
||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||
@ -35,12 +36,15 @@ describe('Extension tests', () => {
|
||||
|
||||
it('checking addExtensionOnLinux', async () => {
|
||||
let linux: string = await extensions.addExtension(
|
||||
'xdebug, pcov, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||
'Xdebug, pcov, sqlite, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||
'7.4',
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain('update_extension xdebug 2.9.1');
|
||||
expect(linux).toContain('update_extension xdebug 2.9.2');
|
||||
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
|
||||
expect(linux).toContain(
|
||||
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
|
||||
);
|
||||
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||
expect(linux).toContain('add_pdo_extension mysql');
|
||||
expect(linux).toContain('add_pdo_extension odbc');
|
||||
@ -79,12 +83,13 @@ describe('Extension tests', () => {
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
let darwin: string = await extensions.addExtension(
|
||||
'xdebug, pcov, ast-beta, grpc-1.2.3',
|
||||
'Xdebug, pcov, sqlite, ast-beta, grpc-1.2.3',
|
||||
'7.2',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
||||
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||
|
||||
|
122
dist/index.js
vendored
122
dist/index.js
vendored
@ -1178,6 +1178,7 @@ function extensionArray(extension_csv) {
|
||||
.map(function (extension) {
|
||||
return extension
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace('php-', '')
|
||||
.replace('php_', '');
|
||||
})
|
||||
@ -2702,16 +2703,16 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
let script = '\n';
|
||||
yield utils.asyncForEach(extensions, function (extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
extension = extension.toLowerCase();
|
||||
const version_extension = version + extension;
|
||||
const [ext_name, ext_version] = extension.split('-');
|
||||
const prefix = yield utils.getExtensionPrefix(ext_name);
|
||||
let install_command = '';
|
||||
const ext_prefix = yield utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
install_command =
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
@ -2719,7 +2720,7 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
(yield utils.getBlackfireVersion(ext_version));
|
||||
break;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
@ -2727,35 +2728,54 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
prefix;
|
||||
ext_prefix;
|
||||
return;
|
||||
// match exact versions
|
||||
// match semver
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.3xdebug
|
||||
case /5\.3xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.2.7' + pipe;
|
||||
command = command_prefix + 'xdebug-2.2.7' + pipe;
|
||||
break;
|
||||
// match 5.4xdebug
|
||||
case /5\.4xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.4.1' + pipe;
|
||||
command = command_prefix + 'xdebug-2.4.1' + pipe;
|
||||
break;
|
||||
// match 5.5xdebug and 5.6xdebug
|
||||
case /5\.[5-6]xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
|
||||
command = command_prefix + 'xdebug-2.5.5' + pipe;
|
||||
break;
|
||||
// match 7.0redis
|
||||
case /7\.0xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||
command = command_prefix + 'xdebug-2.9.0' + pipe;
|
||||
break;
|
||||
// match 5.6redis
|
||||
case /5\.6redis/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f redis-2.2.8' + pipe;
|
||||
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||
break;
|
||||
case /[5-9]\.\dimagick/.test(version_extension):
|
||||
install_command =
|
||||
// match imagick
|
||||
case /imagick/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && sudo pecl install -f imagick' +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
'sh ' +
|
||||
@ -2766,16 +2786,11 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
version;
|
||||
return;
|
||||
default:
|
||||
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
'\nadd_extension ' +
|
||||
extension +
|
||||
' "' +
|
||||
install_command +
|
||||
'" ' +
|
||||
(yield utils.getExtensionPrefix(extension));
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
});
|
||||
});
|
||||
return script;
|
||||
@ -2795,7 +2810,6 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
||||
let script = '\n';
|
||||
yield utils.asyncForEach(extensions, function (extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
extension = extension.toLowerCase();
|
||||
const [ext_name, ext_version] = extension.split('-');
|
||||
const version_extension = version + extension;
|
||||
let matches;
|
||||
@ -2811,19 +2825,25 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
(yield utils.getBlackfireVersion(ext_version));
|
||||
return;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||
break;
|
||||
// match exact versions
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||
return;
|
||||
case /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||
matches = /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
||||
// match semver with state
|
||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
||||
script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
@ -2858,16 +2878,16 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
let script = '\n';
|
||||
yield utils.asyncForEach(extensions, function (extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
extension = extension.toLowerCase();
|
||||
const version_extension = version + extension;
|
||||
const [ext_name, ext_version] = extension.split('-');
|
||||
const prefix = yield utils.getExtensionPrefix(ext_name);
|
||||
let install_command = '';
|
||||
const ext_prefix = yield utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo $debconf_fix apt-get install -y php';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
install_command =
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
|
||||
' ' +
|
||||
@ -2875,7 +2895,7 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
(yield utils.getBlackfireVersion(ext_version));
|
||||
break;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
@ -2883,16 +2903,21 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
prefix;
|
||||
ext_prefix;
|
||||
return;
|
||||
// match exact versions
|
||||
// match semver versions
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
install_command =
|
||||
command =
|
||||
'sh ' +
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
||||
' ' +
|
||||
@ -2912,28 +2937,27 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.1' +
|
||||
'\nupdate_extension xdebug 2.9.2' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pdo_extension ' +
|
||||
extension.replace('pdo_', '').replace('pdo-', '');
|
||||
extension = extension.replace('pdo_', '').replace('pdo-', '');
|
||||
script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
default:
|
||||
install_command =
|
||||
'sudo $debconf_fix apt-get install -y php' +
|
||||
version +
|
||||
'-' +
|
||||
extension +
|
||||
pipe;
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
'\nadd_extension ' + extension + ' "' + install_command + '" ' + prefix;
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
});
|
||||
});
|
||||
return script;
|
||||
@ -2946,7 +2970,7 @@ exports.addExtensionLinux = addExtensionLinux;
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
* @param os_version
|
||||
* @param log_prefix
|
||||
* @param no_step
|
||||
*/
|
||||
function addExtension(extension_csv, version, os_version, no_step = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
@ -16,18 +16,18 @@ export async function addExtensionDarwin(
|
||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||
let script = '\n';
|
||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||
extension = extension.toLowerCase();
|
||||
const version_extension: string = version + extension;
|
||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||
let install_command = '';
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
install_command =
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
@ -35,7 +35,7 @@ export async function addExtensionDarwin(
|
||||
' ' +
|
||||
(await utils.getBlackfireVersion(ext_version));
|
||||
break;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
@ -43,35 +43,54 @@ export async function addExtensionDarwin(
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
prefix;
|
||||
ext_prefix;
|
||||
return;
|
||||
// match exact versions
|
||||
// match semver
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.3xdebug
|
||||
case /5\.3xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.2.7' + pipe;
|
||||
command = command_prefix + 'xdebug-2.2.7' + pipe;
|
||||
break;
|
||||
// match 5.4xdebug
|
||||
case /5\.4xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.4.1' + pipe;
|
||||
command = command_prefix + 'xdebug-2.4.1' + pipe;
|
||||
break;
|
||||
// match 5.5xdebug and 5.6xdebug
|
||||
case /5\.[5-6]xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
|
||||
command = command_prefix + 'xdebug-2.5.5' + pipe;
|
||||
break;
|
||||
// match 7.0redis
|
||||
case /7\.0xdebug/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||
command = command_prefix + 'xdebug-2.9.0' + pipe;
|
||||
break;
|
||||
// match 5.6redis
|
||||
case /5\.6redis/.test(version_extension):
|
||||
install_command = 'sudo pecl install -f redis-2.2.8' + pipe;
|
||||
command = command_prefix + 'redis-2.2.8' + pipe;
|
||||
break;
|
||||
case /[5-9]\.\dimagick/.test(version_extension):
|
||||
install_command =
|
||||
// match imagick
|
||||
case /imagick/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && sudo pecl install -f imagick' +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
'sh ' +
|
||||
@ -82,16 +101,11 @@ export async function addExtensionDarwin(
|
||||
version;
|
||||
return;
|
||||
default:
|
||||
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||
command = command_prefix + extension + pipe;
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
'\nadd_extension ' +
|
||||
extension +
|
||||
' "' +
|
||||
install_command +
|
||||
'" ' +
|
||||
(await utils.getExtensionPrefix(extension));
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
});
|
||||
return script;
|
||||
}
|
||||
@ -111,7 +125,6 @@ export async function addExtensionWindows(
|
||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||
let script = '\n';
|
||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||
extension = extension.toLowerCase();
|
||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||
const version_extension: string = version + extension;
|
||||
let matches: RegExpExecArray;
|
||||
@ -129,23 +142,29 @@ export async function addExtensionWindows(
|
||||
' ' +
|
||||
(await utils.getBlackfireVersion(ext_version));
|
||||
return;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||
break;
|
||||
// match exact versions
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||
return;
|
||||
case /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.test(
|
||||
// match semver with state
|
||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
||||
version_extension
|
||||
):
|
||||
matches = /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.exec(
|
||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
|
||||
version_extension
|
||||
) as RegExpExecArray;
|
||||
script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
@ -180,18 +199,18 @@ export async function addExtensionLinux(
|
||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||
let script = '\n';
|
||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||
extension = extension.toLowerCase();
|
||||
const version_extension: string = version + extension;
|
||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||
let install_command = '';
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo $debconf_fix apt-get install -y php';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
install_command =
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
|
||||
' ' +
|
||||
@ -199,7 +218,7 @@ export async function addExtensionLinux(
|
||||
' ' +
|
||||
(await utils.getBlackfireVersion(ext_version));
|
||||
break;
|
||||
// match pre-release versions
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
@ -207,16 +226,21 @@ export async function addExtensionLinux(
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
prefix;
|
||||
ext_prefix;
|
||||
return;
|
||||
// match exact versions
|
||||
// match semver versions
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
install_command =
|
||||
command =
|
||||
'sh ' +
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
||||
' ' +
|
||||
@ -236,28 +260,27 @@ export async function addExtensionLinux(
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.1' +
|
||||
'\nupdate_extension xdebug 2.9.2' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
script +=
|
||||
'\nadd_pdo_extension ' +
|
||||
extension.replace('pdo_', '').replace('pdo-', '');
|
||||
extension = extension.replace('pdo_', '').replace('pdo-', '');
|
||||
script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match sqlite
|
||||
case /sqlite/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
default:
|
||||
install_command =
|
||||
'sudo $debconf_fix apt-get install -y php' +
|
||||
version +
|
||||
'-' +
|
||||
extension +
|
||||
pipe;
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
'\nadd_extension ' + extension + ' "' + install_command + '" ' + prefix;
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
});
|
||||
return script;
|
||||
}
|
||||
@ -268,7 +291,7 @@ export async function addExtensionLinux(
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
* @param os_version
|
||||
* @param log_prefix
|
||||
* @param no_step
|
||||
*/
|
||||
export async function addExtension(
|
||||
extension_csv: string,
|
||||
|
@ -196,6 +196,7 @@ export async function extensionArray(
|
||||
.map(function(extension: string) {
|
||||
return extension
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace('php-', '')
|
||||
.replace('php_', '');
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user