2019-09-20 09:41:20 +07:00
|
|
|
import * as utils from './utils';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for darwin
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
2019-09-26 04:03:39 +07:00
|
|
|
* @param version
|
2019-09-20 09:41:20 +07:00
|
|
|
*/
|
|
|
|
export async function addExtensionDarwin(
|
2019-09-26 04:03:39 +07:00
|
|
|
extension_csv: string,
|
2020-11-08 14:36:21 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2020-02-16 01:55:50 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
2020-03-12 06:17:52 +07:00
|
|
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
2021-01-21 17:37:11 +07:00
|
|
|
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
2020-05-07 04:57:00 +07:00
|
|
|
return;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\ndisable_all_shared';
|
|
|
|
return;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-03-11 08:59:43 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-03-17 06:18:19 +07:00
|
|
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
2021-03-11 08:59:43 +07:00
|
|
|
return;
|
2020-12-14 15:44:49 +07:00
|
|
|
// match 5.3blackfire...8.0blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
2021-04-03 06:43:18 +07:00
|
|
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
|
|
|
// match 5.3ioncube...7.4ioncube
|
2020-08-06 17:03:58 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
2020-12-14 15:43:45 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
2021-02-22 20:10:19 +07:00
|
|
|
extension
|
|
|
|
):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2021-10-09 07:56:16 +07:00
|
|
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
|
|
|
'ext',
|
|
|
|
extension,
|
|
|
|
'darwin'
|
2020-07-26 17:18:19 +07:00
|
|
|
);
|
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_unstable_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-01-30 13:33:30 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-02-23 20:30:40 +07:00
|
|
|
return;
|
2020-07-23 08:17:57 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
2020-07-23 08:17:57 +07:00
|
|
|
return;
|
2021-09-16 20:11:02 +07:00
|
|
|
// match 5.6 and newer - amqp, apcu, expect, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 7.1 and newer - pcov
|
|
|
|
// match 5.6 to 7.4 - propro
|
2021-10-12 22:26:58 +07:00
|
|
|
// match 7.0 and newer - vips, xlswriter
|
2021-09-16 20:11:02 +07:00
|
|
|
case /(?<!5\.[3-5])(amqp|apcu|expect|grpc|igbinary|imagick|imap|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
2020-10-17 23:26:06 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2021-02-10 06:42:37 +07:00
|
|
|
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2021-10-12 22:26:58 +07:00
|
|
|
case /(?<!5\.[3-6])(vips|xlswriter)/.test(version_extension):
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_brew_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_prefix
|
|
|
|
);
|
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
|
|
|
break;
|
2019-09-26 04:03:39 +07:00
|
|
|
default:
|
|
|
|
break;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins('\nadd_extension', extension, ext_prefix);
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for windows
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
|
|
|
*/
|
|
|
|
export async function addExtensionWindows(
|
|
|
|
extension_csv: string,
|
2020-03-12 09:27:40 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2020-02-16 01:55:50 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2020-02-16 01:55:50 +07:00
|
|
|
let matches: RegExpExecArray;
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// Match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\nDisable-Extension' + ext_name.replace(/:/g, ' ');
|
2020-07-26 17:18:19 +07:00
|
|
|
break;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\nDisable-AllShared';
|
|
|
|
break;
|
2020-12-14 15:44:49 +07:00
|
|
|
// match 5.3blackfire...8.0blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
2020-08-06 17:03:58 +07:00
|
|
|
// match pdo_oci and oci8
|
2020-12-14 15:44:49 +07:00
|
|
|
// match 5.3ioncube...7.4ioncube
|
2020-08-06 17:03:58 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
2021-02-12 20:04:27 +07:00
|
|
|
// match 7.1pecl_http...8.0pecl_http and 7.1http...8.0http
|
2020-12-14 15:43:45 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2021-02-22 20:10:19 +07:00
|
|
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2020-07-26 17:18:19 +07:00
|
|
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(7\.[1-4]|8\.0)(pecl_)?http/.test(version_extension):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
|
|
|
'ext',
|
|
|
|
extension,
|
|
|
|
'win32'
|
2020-07-26 17:18:19 +07:00
|
|
|
);
|
2020-08-06 17:03:58 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
2020-11-27 16:25:30 +07:00
|
|
|
ext_version.replace('stable', '')
|
2020-07-24 11:58:48 +07:00
|
|
|
);
|
2020-01-26 02:34:09 +07:00
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-01-21 17:37:11 +07:00
|
|
|
add_script += await utils.getUnsupportedLog(
|
|
|
|
extension,
|
|
|
|
version,
|
|
|
|
'win32'
|
|
|
|
);
|
|
|
|
break;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver without state
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-\d+\.\d+\.\d+$/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
|
|
|
'stable',
|
|
|
|
ext_version
|
|
|
|
);
|
2020-07-26 17:18:19 +07:00
|
|
|
break;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver with state
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
|
|
|
|
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(
|
2020-02-16 01:55:50 +07:00
|
|
|
version_extension
|
|
|
|
) as RegExpExecArray;
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
2020-10-31 20:34:20 +07:00
|
|
|
matches[2].replace('preview', 'devel'),
|
2020-07-24 11:58:48 +07:00
|
|
|
matches[1]
|
|
|
|
);
|
2020-07-26 17:18:19 +07:00
|
|
|
break;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 7.2xdebug2 to 7.4xdebug2
|
|
|
|
case /7\.[2-4]xdebug2/.test(version_extension):
|
2020-11-27 00:41:52 +07:00
|
|
|
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
|
|
|
break;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
2020-07-23 08:17:57 +07:00
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
2020-07-23 08:17:57 +07:00
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 5.3 to 5.6 - mysql, mysqli, mysqlnd
|
2021-04-27 16:47:29 +07:00
|
|
|
case /^5\.[3-6](?<!pdo_)(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script +=
|
2020-03-16 08:23:58 +07:00
|
|
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 7.0 and newer mysql, mysqli and mysqlnd
|
2021-04-27 16:47:29 +07:00
|
|
|
case /(?<!5\.[3-6])(?<!pdo_)(mysql|mysqli|mysqlnd)$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
2020-03-16 08:23:58 +07:00
|
|
|
break;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
2020-03-12 06:17:52 +07:00
|
|
|
break;
|
2019-12-02 22:13:45 +07:00
|
|
|
default:
|
2020-05-17 12:49:52 +07:00
|
|
|
add_script += '\nAdd-Extension ' + extension;
|
2019-12-02 22:13:45 +07:00
|
|
|
break;
|
|
|
|
}
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for linux
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
|
|
|
*/
|
|
|
|
export async function addExtensionLinux(
|
|
|
|
extension_csv: string,
|
2020-11-08 14:36:21 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2020-02-16 01:55:50 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
2020-03-12 06:17:52 +07:00
|
|
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
2021-01-21 17:37:11 +07:00
|
|
|
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// Match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
2020-05-07 04:57:00 +07:00
|
|
|
return;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\ndisable_all_shared';
|
|
|
|
return;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-03-11 08:59:43 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-03-17 06:18:19 +07:00
|
|
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
2021-03-11 08:59:43 +07:00
|
|
|
return;
|
2020-12-14 15:44:49 +07:00
|
|
|
// match 5.3blackfire...8.0blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
2020-08-08 20:32:17 +07:00
|
|
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
2021-04-03 06:43:18 +07:00
|
|
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
|
|
|
// match 5.3ioncube...7.4ioncube
|
2020-08-06 17:03:58 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
2020-12-14 15:43:45 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2020-08-08 20:32:17 +07:00
|
|
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^couchbase$|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
2021-02-22 20:10:19 +07:00
|
|
|
extension
|
|
|
|
):
|
2021-04-13 01:33:56 +07:00
|
|
|
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2020-07-26 17:18:19 +07:00
|
|
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
|
|
|
'ext',
|
|
|
|
extension,
|
|
|
|
'linux'
|
|
|
|
);
|
2020-07-26 17:18:19 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_unstable_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-01-30 13:33:30 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver versions
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-02-14 00:09:00 +07:00
|
|
|
return;
|
2020-07-23 08:17:57 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
2020-07-23 08:17:57 +07:00
|
|
|
return;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 7.2xdebug2...7.4xdebug2
|
|
|
|
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
2020-11-27 00:41:52 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
2020-12-24 19:50:42 +07:00
|
|
|
'xdebug',
|
2020-11-27 00:41:52 +07:00
|
|
|
'2.9.8',
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-12-24 19:50:42 +07:00
|
|
|
return;
|
2020-03-05 07:28:24 +07:00
|
|
|
// match pdo extensions
|
2021-02-09 01:36:18 +07:00
|
|
|
case /^pdo[_-].+/.test(extension):
|
2020-07-26 17:18:19 +07:00
|
|
|
extension = extension.replace(/pdo[_-]|3/, '');
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script += '\nadd_pdo_extension ' + extension;
|
2020-03-05 07:28:24 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
|
|
|
break;
|
2019-09-28 21:39:05 +07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins('\nadd_extension', extension, ext_prefix);
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
2019-11-24 03:34:12 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
|
|
|
* @param os_version
|
2020-03-12 06:17:52 +07:00
|
|
|
* @param no_step
|
2019-11-24 03:34:12 +07:00
|
|
|
*/
|
|
|
|
export async function addExtension(
|
|
|
|
extension_csv: string,
|
|
|
|
version: string,
|
|
|
|
os_version: string,
|
|
|
|
no_step = false
|
|
|
|
): Promise<string> {
|
2020-11-08 14:36:21 +07:00
|
|
|
const log: string = await utils.stepLog('Setup Extensions', os_version);
|
2019-11-24 03:34:12 +07:00
|
|
|
let script = '\n';
|
|
|
|
switch (no_step) {
|
|
|
|
case true:
|
2020-11-08 14:36:21 +07:00
|
|
|
script += log + (await utils.suppressOutput(os_version));
|
2019-11-24 03:34:12 +07:00
|
|
|
break;
|
|
|
|
case false:
|
|
|
|
default:
|
2020-11-08 14:36:21 +07:00
|
|
|
script += log;
|
2019-11-24 03:34:12 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (os_version) {
|
|
|
|
case 'win32':
|
2020-03-12 09:27:40 +07:00
|
|
|
return script + (await addExtensionWindows(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
case 'darwin':
|
2020-11-08 14:36:21 +07:00
|
|
|
return script + (await addExtensionDarwin(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
case 'linux':
|
2020-11-08 14:36:21 +07:00
|
|
|
return script + (await addExtensionLinux(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
default:
|
|
|
|
return await utils.log(
|
|
|
|
'Platform ' + os_version + ' is not supported',
|
|
|
|
os_version,
|
|
|
|
'error'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|