mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Dry extension code
This commit is contained in:
parent
e68a74a71c
commit
2a7ae24c8e
@ -11,10 +11,10 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('Add-Extension pcov');
|
||||
expect(win32).toContain('Add-Extension sqlite3');
|
||||
expect(win32).toContain('Remove-Extension intl');
|
||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||
expect(win32).toContain('ioncube.ps1 7.4');
|
||||
expect(win32).toContain('oci.ps1 oci8 7.4');
|
||||
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
|
||||
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||
expect(win32).toContain('Add-Ioncube');
|
||||
expect(win32).toContain('Add-OCI oci8');
|
||||
expect(win32).toContain('Add-OCI pdo_oci');
|
||||
expect(win32).toContain('Add-Extension ast beta');
|
||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||
@ -43,17 +43,17 @@ describe('Extension tests', () => {
|
||||
'win32',
|
||||
true
|
||||
);
|
||||
expect(win32).toContain('phalcon.ps1 phalcon3');
|
||||
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||
expect(win32).toContain('Add-Extension does_not_exist');
|
||||
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
|
||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
|
||||
expect(win32).toContain('Add-Blackfire blackfire');
|
||||
|
||||
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||
expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0');
|
||||
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnLinux', async () => {
|
||||
@ -91,38 +91,29 @@ describe('Extension tests', () => {
|
||||
);
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.0');
|
||||
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.1');
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.2');
|
||||
|
||||
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.3');
|
||||
|
||||
expect(linux).toContain('add_gearman');
|
||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||
expect(linux).toContain('gearman.sh 7.4');
|
||||
expect(linux).toContain('add_gearman');
|
||||
|
||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
|
||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
||||
expect(linux).toContain('add_phalcon phalcon3');
|
||||
expect(linux).toContain('add_phalcon phalcon4');
|
||||
|
||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
||||
expect(linux).toContain('ioncube.sh 7.3');
|
||||
expect(linux).toContain('add_ioncube');
|
||||
|
||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||
expect(linux).toContain('oci.sh oci8 7.3');
|
||||
expect(linux).toContain('oci.sh pdo_oci 7.3');
|
||||
expect(linux).toContain('add_oci oci8');
|
||||
expect(linux).toContain('add_oci pdo_oci');
|
||||
|
||||
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
||||
expect(linux).toContain('blackfire.sh 7.3 blackfire');
|
||||
expect(linux).toContain('add_blackfire blackfire');
|
||||
|
||||
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
||||
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
|
||||
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
@ -142,17 +133,17 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||
|
||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
||||
expect(darwin).toContain('add_phalcon phalcon3');
|
||||
|
||||
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
||||
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
||||
expect(darwin).toContain('add_phalcon phalcon4');
|
||||
|
||||
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
||||
expect(darwin).toContain('ioncube.sh 7.3');
|
||||
expect(darwin).toContain('add_ioncube');
|
||||
|
||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||
expect(darwin).toContain('oci.sh oci8 7.3');
|
||||
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
||||
expect(darwin).toContain('add_oci oci8');
|
||||
expect(darwin).toContain('add_oci pdo_oci');
|
||||
|
||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||
expect(darwin).toContain(
|
||||
@ -162,15 +153,6 @@ describe('Extension tests', () => {
|
||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension pcov');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.2.7');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.4.1');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
|
||||
expect(darwin).toContain('pecl_install xdebug-2.5.5');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
@ -195,10 +177,10 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('pecl_install imagick');
|
||||
|
||||
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
||||
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
|
||||
expect(darwin).toContain('add_blackfire blackfire');
|
||||
|
||||
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
||||
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0');
|
||||
expect(darwin).toContain('add_blackfire blackfire-1.31.0');
|
||||
|
||||
darwin = await extensions.addExtension(
|
||||
'does_not_exist',
|
||||
|
@ -168,15 +168,6 @@ describe('Utils tests', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('checking getXdebugVersion', async () => {
|
||||
expect(await utils.getXdebugVersion('5.3')).toContain('2.2.7');
|
||||
expect(await utils.getXdebugVersion('5.4')).toContain('2.4.1');
|
||||
expect(await utils.getXdebugVersion('5.5')).toContain('2.5.5');
|
||||
expect(await utils.getXdebugVersion('5.6')).toContain('2.5.5');
|
||||
expect(await utils.getXdebugVersion('7.0')).toContain('2.7.2');
|
||||
expect(await utils.getXdebugVersion('7.2')).toContain('2.9.6');
|
||||
});
|
||||
|
||||
it('checking getUnsupportedLog', async () => {
|
||||
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
||||
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
||||
|
147
dist/index.js
vendored
147
dist/index.js
vendored
@ -1314,7 +1314,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.joins = exports.getUnsupportedLog = exports.getXdebugVersion = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
|
||||
exports.joins = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
@ -1529,27 +1529,6 @@ async function suppressOutput(os_version) {
|
||||
}
|
||||
}
|
||||
exports.suppressOutput = suppressOutput;
|
||||
/**
|
||||
* Function to get Xdebug version compatible with php versions.
|
||||
*
|
||||
* @param version
|
||||
*/
|
||||
async function getXdebugVersion(version) {
|
||||
switch (version) {
|
||||
case '5.3':
|
||||
return '2.2.7';
|
||||
case '5.4':
|
||||
return '2.4.1';
|
||||
case '5.5':
|
||||
case '5.6':
|
||||
return '2.5.5';
|
||||
case '7.0':
|
||||
return '2.7.2';
|
||||
default:
|
||||
return '2.9.6';
|
||||
}
|
||||
}
|
||||
exports.getXdebugVersion = getXdebugVersion;
|
||||
/**
|
||||
* Function to get script to log unsupported extensions.
|
||||
*
|
||||
@ -3611,9 +3590,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = void 0;
|
||||
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.customExtension = void 0;
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(163));
|
||||
/**
|
||||
* Function to get script to install custom extensions
|
||||
*
|
||||
* @param script
|
||||
* @param command
|
||||
*/
|
||||
async function customExtension(script, ...command) {
|
||||
return ('\n. ' +
|
||||
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||
'\n' +
|
||||
(await utils.joins(...command)));
|
||||
}
|
||||
exports.customExtension = customExtension;
|
||||
/**
|
||||
* Install and enable extensions for darwin
|
||||
*
|
||||
@ -3639,8 +3631,20 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
// 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):
|
||||
command = await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh'), version, extension);
|
||||
break;
|
||||
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||
@ -3649,10 +3653,6 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||
return;
|
||||
case /5\.[3-5]xdebug/.test(version_extension):
|
||||
command =
|
||||
command_prefix + 'xdebug-' + (await utils.getXdebugVersion(version));
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||
@ -3678,18 +3678,6 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins('\nbash ', path.join(__dirname, '../src/scripts/ext/oci.sh'), extension, version);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins('\nbash ', path.join(__dirname, '../src/scripts/ext/ioncube.sh'), version);
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins('\nbash ', path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh'), extension, version);
|
||||
return;
|
||||
default:
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
@ -3717,12 +3705,24 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
// Match :extension
|
||||
case /^:/.test(ext_name):
|
||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||
return;
|
||||
break;
|
||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
add_script += await utils.joins('\n& ', path.join(__dirname, '../src/scripts/ext/blackfire.ps1'), version, extension);
|
||||
return;
|
||||
add_script += await customExtension('blackfire.ps1', 'Add-Blackfire', extension);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.ps1', 'Add-OCI', extension);
|
||||
break;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.ps1', 'Add-Ioncube');
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension('phalcon.ps1', 'Add-Phalcon', extension);
|
||||
break;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
|
||||
@ -3730,12 +3730,12 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
||||
return;
|
||||
break;
|
||||
// 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);
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2], matches[1]);
|
||||
return;
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||
@ -3758,18 +3758,6 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
extension = 'sqlite3';
|
||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins('\n& ', path.join(__dirname, '../src/scripts/ext/oci.ps1'), extension, version);
|
||||
break;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins('\n& ', path.join(__dirname, '../src/scripts/ext/ioncube.ps1'), version);
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins('\n& ', path.join(__dirname, '../src/scripts/ext/phalcon.ps1'), extension, version);
|
||||
break;
|
||||
default:
|
||||
add_script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
@ -3803,8 +3791,24 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
command = await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/blackfire.sh'), version, extension);
|
||||
break;
|
||||
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
add_script += await customExtension('gearman.sh', 'add_gearman');
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||
@ -3817,22 +3821,6 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
command = await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/gearman.sh'), version, pipe);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/oci.sh'), extension, version);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/ioncube.sh'), version);
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins('\nbash', path.join(__dirname, '../src/scripts/ext/phalcon.sh'), extension, version);
|
||||
return;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
add_script +=
|
||||
@ -3844,11 +3832,8 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_st-].*/.test(version_extension):
|
||||
extension = extension
|
||||
.replace('pdo_', '')
|
||||
.replace('pdo-', '')
|
||||
.replace('sqlite3', 'sqlite');
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
add_script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match ast and uopz
|
||||
|
@ -1,6 +1,24 @@
|
||||
import * as path from 'path';
|
||||
import * as utils from './utils';
|
||||
|
||||
/**
|
||||
* Function to get script to install custom extensions
|
||||
*
|
||||
* @param script
|
||||
* @param command
|
||||
*/
|
||||
export async function customExtension(
|
||||
script: string,
|
||||
...command: string[]
|
||||
): Promise<string> {
|
||||
return (
|
||||
'\n. ' +
|
||||
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||
'\n' +
|
||||
(await utils.joins(...command))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install and enable extensions for darwin
|
||||
*
|
||||
@ -32,13 +50,28 @@ export async function addExtensionDarwin(
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
command = await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh'),
|
||||
version,
|
||||
add_script += await customExtension(
|
||||
'blackfire.sh',
|
||||
'add_blackfire',
|
||||
extension
|
||||
);
|
||||
break;
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension(
|
||||
'phalcon.sh',
|
||||
'add_phalcon',
|
||||
extension
|
||||
);
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
@ -57,10 +90,6 @@ export async function addExtensionDarwin(
|
||||
ext_prefix
|
||||
);
|
||||
return;
|
||||
case /5\.[3-5]xdebug/.test(version_extension):
|
||||
command =
|
||||
command_prefix + 'xdebug-' + (await utils.getXdebugVersion(version));
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||
@ -89,32 +118,6 @@ export async function addExtensionDarwin(
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash ',
|
||||
path.join(__dirname, '../src/scripts/ext/oci.sh'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash ',
|
||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh'),
|
||||
version
|
||||
);
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash ',
|
||||
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
return;
|
||||
default:
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
@ -150,19 +153,34 @@ export async function addExtensionWindows(
|
||||
// Match :extension
|
||||
case /^:/.test(ext_name):
|
||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||
return;
|
||||
break;
|
||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
add_script += await utils.joins(
|
||||
'\n& ',
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1'),
|
||||
version,
|
||||
add_script += await customExtension(
|
||||
'blackfire.ps1',
|
||||
'Add-Blackfire',
|
||||
extension
|
||||
);
|
||||
return;
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.ps1', 'Add-OCI', extension);
|
||||
break;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.ps1', 'Add-Ioncube');
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension(
|
||||
'phalcon.ps1',
|
||||
'Add-Phalcon',
|
||||
extension
|
||||
);
|
||||
break;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
@ -179,7 +197,7 @@ export async function addExtensionWindows(
|
||||
'stable',
|
||||
ext_version
|
||||
);
|
||||
return;
|
||||
break;
|
||||
// match semver with state
|
||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
||||
version_extension
|
||||
@ -193,7 +211,7 @@ export async function addExtensionWindows(
|
||||
matches[2],
|
||||
matches[1]
|
||||
);
|
||||
return;
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||
@ -216,32 +234,6 @@ export async function addExtensionWindows(
|
||||
extension = 'sqlite3';
|
||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins(
|
||||
'\n& ',
|
||||
path.join(__dirname, '../src/scripts/ext/oci.ps1'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
break;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\n& ',
|
||||
path.join(__dirname, '../src/scripts/ext/ioncube.ps1'),
|
||||
version
|
||||
);
|
||||
break;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\n& ',
|
||||
path.join(__dirname, '../src/scripts/ext/phalcon.ps1'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
break;
|
||||
default:
|
||||
add_script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
@ -281,13 +273,32 @@ export async function addExtensionLinux(
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
command = await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh'),
|
||||
version,
|
||||
add_script += await customExtension(
|
||||
'blackfire.sh',
|
||||
'add_blackfire',
|
||||
extension
|
||||
);
|
||||
break;
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await customExtension(
|
||||
'phalcon.sh',
|
||||
'add_phalcon',
|
||||
extension
|
||||
);
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
add_script += await customExtension('gearman.sh', 'add_gearman');
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
@ -310,41 +321,6 @@ export async function addExtensionLinux(
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||
return;
|
||||
// match 5.6gearman..7.4gearman
|
||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||
command = await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/gearman.sh'),
|
||||
version,
|
||||
pipe
|
||||
);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/oci.sh'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
return;
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh'),
|
||||
version
|
||||
);
|
||||
return;
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nbash',
|
||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh'),
|
||||
extension,
|
||||
version
|
||||
);
|
||||
return;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
add_script +=
|
||||
@ -356,11 +332,8 @@ export async function addExtensionLinux(
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_st-].*/.test(version_extension):
|
||||
extension = extension
|
||||
.replace('pdo_', '')
|
||||
.replace('pdo-', '')
|
||||
.replace('sqlite3', 'sqlite');
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
add_script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match ast and uopz
|
||||
|
@ -16,6 +16,16 @@ add_log() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to log result of installing extension.
|
||||
add_extension_log() {
|
||||
extension=$1
|
||||
status=$2
|
||||
extension_name=$(echo "$extension" | cut -d '-' -f 1)
|
||||
(
|
||||
check_extension "$extension_name" && add_log "$tick" "$extension_name" "$status"
|
||||
) || add_log "$cross" "$extension_name" "Could not install $extension on PHP $semver"
|
||||
}
|
||||
|
||||
# Function to read env inputs.
|
||||
read_env() {
|
||||
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||
@ -27,9 +37,9 @@ read_env() {
|
||||
# Function to setup environment for self-hosted runners.
|
||||
self_hosted_setup() {
|
||||
if [[ $(command -v brew) == "" ]]; then
|
||||
step_log "Setup Brew"
|
||||
curl "${curl_opts[@]}" https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
|
||||
add_log "$tick" "Brew" "Installed Homebrew"
|
||||
step_log "Setup Brew"
|
||||
curl "${curl_opts[@]}" https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
|
||||
add_log "$tick" "Brew" "Installed Homebrew"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -41,7 +51,7 @@ remove_extension() {
|
||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||
(! check_extension "$extension" && add_log "$tick" ":$extension" "Removed") ||
|
||||
add_log "$cross" ":$extension" "Could not remove $extension on PHP $semver"
|
||||
add_log "$cross" ":$extension" "Could not remove $extension on PHP $semver"
|
||||
else
|
||||
add_log "$tick" ":$extension" "Could not find $extension on PHP $semver"
|
||||
fi
|
||||
@ -92,11 +102,8 @@ add_pecl_extension() {
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
else
|
||||
remove_extension "$extension" >/dev/null 2>&1
|
||||
(
|
||||
pecl_install "$extension-$pecl_version" &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
pecl_install "$extension-$pecl_version"
|
||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -121,9 +128,8 @@ add_extension() {
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
elif ! check_extension "$extension"; then
|
||||
eval "$install_command" >/dev/null 2>&1 &&
|
||||
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -143,7 +149,7 @@ configure_composer() {
|
||||
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
||||
if [ $? -eq 1 ]; then
|
||||
add_log "$cross" "composer" "Could not download composer"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
composer -q global config process-timeout 0
|
||||
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
||||
@ -192,8 +198,7 @@ add_composertool() {
|
||||
release=$2
|
||||
prefix=$3
|
||||
(
|
||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||
add_log "$tick" "$tool" "Added"
|
||||
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added"
|
||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||
}
|
||||
|
||||
@ -261,7 +266,7 @@ fi
|
||||
# Setup PHP
|
||||
step_log "Setup PHP"
|
||||
if [[ "$version" =~ $old_versions ]]; then
|
||||
curl "${curl_opts[@]}" https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1 &&
|
||||
curl "${curl_opts[@]}" https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1
|
||||
status="Installed"
|
||||
elif [ "$existing_version" != "$version" ]; then
|
||||
setup_php "install" >/dev/null 2>&1
|
||||
|
@ -1,35 +1,29 @@
|
||||
Param (
|
||||
# Function to install blackfire extension.
|
||||
Function Add-Blackfire() {
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$version,
|
||||
[Parameter(Position = 1, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$extension
|
||||
)
|
||||
|
||||
$tick = ([char]8730)
|
||||
$php_dir = 'C:\tools\php'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$arch='x64'
|
||||
if ($version -lt '7.0') { $arch='x86' }
|
||||
$version = $version.replace('.', '')
|
||||
$extension_version = $extension.split('-')[1]
|
||||
if ($extension_version -notmatch "\S") {
|
||||
$ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 2 }
|
||||
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
|
||||
)
|
||||
try {
|
||||
$no_dot_version = $version.replace('.', '')
|
||||
$extension_version = $extension.split('-')[1]
|
||||
if ($extension_version -notmatch "\S") {
|
||||
$ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 2 }
|
||||
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
|
||||
}
|
||||
if (Test-Path $ext_dir\blackfire.dll) {
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Enabled"
|
||||
} else {
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Installed and enabled"
|
||||
}
|
||||
Add-Log $tick $extension $status
|
||||
} catch {
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||
}
|
||||
}
|
||||
if (Test-Path $ext_dir\blackfire.dll) {
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Enabled"
|
||||
} else {
|
||||
$installed = Get-Php -Path $php_dir
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Installed and enabled"
|
||||
}
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "blackfire" "$status"
|
||||
|
||||
|
@ -8,10 +8,10 @@ add_blackfire() {
|
||||
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||
if [ "$extension_version" = "blackfire" ]; then
|
||||
extension_version=$(curl "${curl_opts[@]:?}" https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
|
||||
extension_version=$(curl -sSL https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||
fi
|
||||
sudo curl -o "${ext_dir:?}/blackfire.so" "${curl_opts[@]:?}" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
||||
fi
|
||||
echo "extension=blackfire.so" | sudo tee -a "$blackfire_ini_file" >/dev/null 2>&1
|
||||
add_extension_log "$extension-$extension_version" "Installed and enabled"
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
version=${1/./}
|
||||
extension=${2}
|
||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||
if [ "$extension_version" = "blackfire" ]; then
|
||||
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
|
||||
fi
|
||||
curl_opts=(-sSL --retry 5 --retry-delay 1)
|
||||
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
ini_file="$scan_dir/50-blackfire.ini"
|
||||
sudo curl -o $ext_dir/blackfire.so "${curl_opts[@]}" "https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-darwin_amd64-php-$version.so"
|
||||
echo "extension=blackfire.so" | sudo tee -a "$ini_file"
|
@ -1,9 +1,23 @@
|
||||
release_version=$(lsb_release -s -r)
|
||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
# Helper function to add gearman extension.
|
||||
add_gearman_helper() {
|
||||
sudo "${debconf_fix:?}" add-apt-repository ppa:ondrej/pkg-gearman -y
|
||||
if [ -e "${ext_dir:?}/gearman.so" ] && [ "$DISTRIB_RELEASE" != "16.04" ]; then
|
||||
${apt_install:?} libgearman-dev
|
||||
echo "extension=gearman.so" | sudo tee -a "${scan_dir:?}/20-gearman.ini" >/dev/null 2>&1
|
||||
else
|
||||
status="Installed and enabled"
|
||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||
sudo "${debconf_fix:?}" apt-get update -y
|
||||
${apt_install:?} php"${version:?}"-gearman
|
||||
else
|
||||
${apt_install:?} libgearman-dev php"${version:?}"-gearman
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$release_version" = "18.04" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
||||
elif [ "$release_version" = "16.04" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
||||
fi
|
||||
# Function to add gearman extension.
|
||||
add_gearman() {
|
||||
status="Enabled"
|
||||
add_gearman_helper >/dev/null 2>&1
|
||||
add_extension_log "gearman" "$status"
|
||||
}
|
||||
|
@ -1,48 +1,32 @@
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$version
|
||||
)
|
||||
|
||||
# Function to log result of a operation.
|
||||
Function Add-Log($mark, $subject, $message) {
|
||||
if ($mark -eq $tick) {
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
|
||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||
Write-Output "::endgroup::"
|
||||
} else {
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
|
||||
}
|
||||
Function Add-LicenseLog() {
|
||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||
Write-Output "::endgroup::"
|
||||
}
|
||||
|
||||
$tick = ([char]8730)
|
||||
$cross = ([char]10007)
|
||||
$status = 'Enabled'
|
||||
$php_dir = 'C:\tools\php'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$installed = Get-Php $php_dir
|
||||
try {
|
||||
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||
$status = 'Installed and enabled'
|
||||
$arch = 'x86-64'
|
||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch = 'x86'
|
||||
# Function to add ioncube extension.
|
||||
Function Add-Ioncube() {
|
||||
try {
|
||||
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||
$status = 'Installed and enabled'
|
||||
$arch_part = $arch
|
||||
if ($arch -eq 'x64') {
|
||||
$arch_part = 'x86-64'
|
||||
}
|
||||
$vc = $installed.VCVersion
|
||||
$ts_part = ""
|
||||
if (-not($installed.ThreadSafe)) {
|
||||
$ts_part = "_nonts"
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||
}
|
||||
$vc = $installed.VCVersion
|
||||
$ts = ""
|
||||
if (-not($installed.ThreadSafe)) {
|
||||
$ts = "_nonts"
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts`_vc$vc`_$arch.zip" -OutFile $ext_dir\ioncube.zip
|
||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
|
||||
Add-Log $tick "ioncube" $status
|
||||
Add-LicenseLog
|
||||
} catch {
|
||||
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
||||
}
|
||||
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
|
||||
Add-Log $tick "ioncube" $status
|
||||
} catch {
|
||||
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ add_ioncube() {
|
||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
||||
add_extension_log "ioncube" "$status"
|
||||
check_extension "ioncube" && add_license_log
|
||||
}
|
||||
}
|
||||
|
@ -1,68 +1,55 @@
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateSet('oci8', 'pdo_oci')]
|
||||
[string]
|
||||
$extension,
|
||||
[Parameter(Position = 1, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$version
|
||||
)
|
||||
|
||||
# Function to log result of a operation.
|
||||
Function Add-Log($mark, $subject, $message) {
|
||||
if ($mark -eq $tick) {
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
|
||||
# Function to log license information.
|
||||
Function Add-LicenseLog() {
|
||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
||||
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||
Write-Output "::endgroup::"
|
||||
} else {
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
|
||||
}
|
||||
}
|
||||
|
||||
$tick = ([char]8730)
|
||||
$cross = ([char]10007)
|
||||
$php_dir = 'C:\tools\php'
|
||||
$status = 'Enabled'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$installed = Get-Php -Path $php_dir
|
||||
try
|
||||
{
|
||||
# Function to get instantclinet.
|
||||
Function Add-InstantClient() {
|
||||
if (-not(Test-Path $php_dir\oci.dll)) {
|
||||
$suffix = 'windows'
|
||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
|
||||
{
|
||||
if ($arch -eq 'x86') {
|
||||
$suffix = 'nt'
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||
}
|
||||
if ($extension -eq "pdo_oci") {
|
||||
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||
} else {
|
||||
$status = 'Installed and enabled'
|
||||
$ociVersion = '2.2.0'
|
||||
if ($version -eq '7.0')
|
||||
{
|
||||
$ociVersion = '2.1.8'
|
||||
}
|
||||
elseif ($version -lt '7.0')
|
||||
{
|
||||
$ociVersion = '2.0.12'
|
||||
}
|
||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
||||
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
||||
}
|
||||
Add-Log $tick $extension $status
|
||||
} catch {
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||
}
|
||||
|
||||
# Function to install oci8 and pdo_oci.
|
||||
Function Add-OCI() {
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateSet('oci8', 'pdo_oci')]
|
||||
[string]
|
||||
$extension
|
||||
)
|
||||
try {
|
||||
$status = 'Enabled'
|
||||
Add-InstantClient
|
||||
if ($extension -eq "pdo_oci") {
|
||||
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||
} else {
|
||||
$status = 'Installed and enabled'
|
||||
$ociVersion = '2.2.0'
|
||||
if ($version -eq '7.0') {
|
||||
$ociVersion = '2.1.8'
|
||||
} elseif ($version -lt '7.0') {
|
||||
$ociVersion = '2.0.12'
|
||||
}
|
||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
||||
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
||||
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
||||
}
|
||||
Add-Log $tick $extension $status
|
||||
Add-LicenseLog
|
||||
} catch {
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,24 @@
|
||||
# Function to log result of a operation.
|
||||
add_log() {
|
||||
mark=$1
|
||||
subject=$2
|
||||
message=$3
|
||||
if [ "$mark" = "$tick" ]; then
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||
echo "::endgroup::"
|
||||
else
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to test if extension is loaded.
|
||||
check_extension() {
|
||||
extension=$1
|
||||
php -m | grep -i -q -w "$extension"
|
||||
add_license_log() {
|
||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
# Function to get the tag for a php version.
|
||||
get_tag() {
|
||||
master_version='8.0'
|
||||
tag='master'
|
||||
if [ ! "$version" = "$master_version" ]; then
|
||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
||||
if [ ! "${version:?}" = "$master_version" ]; then
|
||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
||||
fi
|
||||
echo "$tag"
|
||||
}
|
||||
|
||||
# Function to install instantclient and SDK.
|
||||
install_client() {
|
||||
add_client() {
|
||||
sudo mkdir -p -m 777 "$oracle_home"
|
||||
if [ ! -e "$oracle_client" ]; then
|
||||
for package in basiclite sdk; do
|
||||
@ -47,7 +33,7 @@ install_client() {
|
||||
arch='macos'
|
||||
lib_ext='dylib'
|
||||
fi
|
||||
curl -o "/opt/oracle/$package.zip" "${curl_opts[@]}" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||
curl -o "/opt/oracle/$package.zip" "${curl_opts[@]:?}" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||
done
|
||||
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
||||
@ -63,9 +49,9 @@ get_php() {
|
||||
# Function to get phpize location on darwin.
|
||||
get_phpize() {
|
||||
if [[ "$version" =~ 5.[3-5] ]]; then
|
||||
echo '/opt/local/bin/phpize'
|
||||
echo '/opt/local/bin/phpize'
|
||||
else
|
||||
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
||||
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -91,51 +77,49 @@ patch_pdo_oci_config() {
|
||||
}
|
||||
|
||||
# Function to install the dependencies.
|
||||
install_dependencies() {
|
||||
add_dependencies() {
|
||||
if [ "$os" = 'Linux' ]; then
|
||||
if [ "$runner" = "self-hosted" ] || [ "$RUNNER" = "self-hosted" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||
if [ "${runner:?}" = "self-hosted" ]; then
|
||||
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||
else
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$version"-dev
|
||||
update_lists
|
||||
${apt_install:?} php"$version"-dev
|
||||
fi
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install the extension.
|
||||
install_extension() {
|
||||
if ! [ -e "$ext_dir/$ext.so" ]; then
|
||||
# Function to install oci8 and pdo_oci.
|
||||
add_oci_helper() {
|
||||
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||
status='Installed and enabled'
|
||||
phpize_orig=$(get_phpize)
|
||||
tag=$(get_tag)
|
||||
get_php
|
||||
patch_phpize
|
||||
(
|
||||
status='Installed and enabled'
|
||||
phpize_orig=$(get_phpize)
|
||||
tag=$(get_tag)
|
||||
get_php
|
||||
patch_phpize
|
||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
||||
sudo make -j"$(nproc)"
|
||||
sudo cp ./modules/* "$ext_dir/"
|
||||
restore_phpize
|
||||
)
|
||||
restore_phpize
|
||||
fi
|
||||
echo "extension=$ext.so" | sudo tee "$scan_dir/99-$ext.ini"
|
||||
echo "extension=$ext.so" | sudo tee "${scan_dir:?}/99-$ext.ini"
|
||||
}
|
||||
|
||||
ext=$1
|
||||
version=$2
|
||||
tick='✓'
|
||||
cross='✗'
|
||||
status='Enabled'
|
||||
oracle_home='/opt/oracle'
|
||||
oracle_client=$oracle_home/instantclient
|
||||
runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
|
||||
os=$(uname -s)
|
||||
curl_opts=(-sSL --retry 5 --retry-delay 1)
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||
install_client >/dev/null 2>&1
|
||||
install_dependencies >/dev/null 2>&1
|
||||
install_extension >/dev/null 2>&1
|
||||
(check_extension "$ext" && add_log "$tick" "$ext" "$status") || add_log "$cross" "$ext" "Could not install $ext"
|
||||
# Function to add oci extension oci8 and pdo_oci.
|
||||
add_oci() {
|
||||
ext=$1
|
||||
status='Enabled'
|
||||
oracle_home='/opt/oracle'
|
||||
oracle_client=$oracle_home/instantclient
|
||||
os=$(uname -s)
|
||||
add_client >/dev/null 2>&1
|
||||
add_dependencies >/dev/null 2>&1
|
||||
add_oci_helper >/dev/null 2>&1
|
||||
add_extension_log "$ext" "$status"
|
||||
check_extension "$ext" && add_license_log
|
||||
}
|
||||
|
@ -1,57 +1,55 @@
|
||||
Param (
|
||||
# Function to install phalcon
|
||||
Function Add-PhalconHelper() {
|
||||
if ($extension_version -eq '4') {
|
||||
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||
} else {
|
||||
$domain = 'https://github.com'
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||
$zip_file = $match.Matches[0].Groups[1].Value
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||
}
|
||||
}
|
||||
|
||||
Function Add-Phalcon() {
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateSet('phalcon3', 'phalcon4')]
|
||||
[string]
|
||||
$extension,
|
||||
[Parameter(Position = 1, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$version
|
||||
)
|
||||
$extension
|
||||
)
|
||||
try {
|
||||
$status = 'Enabled'
|
||||
$extension_version = $extension.substring($extension.Length - 1)
|
||||
|
||||
# Function to install phalcon
|
||||
Function Install-Phalcon() {
|
||||
if ($extension_version -eq '4') {
|
||||
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||
} else {
|
||||
$installed = Get-Php -Path $php_dir
|
||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||
$zip_file = $match.Matches[0].Groups[1].Value
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||
}
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
||||
}
|
||||
|
||||
$tick = ([char]8730)
|
||||
$domain = 'https://github.com'
|
||||
$php_dir = 'C:\tools\php'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$extension_version = $extension.substring($extension.Length - 1)
|
||||
|
||||
if($extension_version -eq '4') {
|
||||
if (Test-Path $ext_dir\php_psr.dll) {
|
||||
if($extension_version -eq '4') {
|
||||
if (Test-Path $ext_dir\php_psr.dll) {
|
||||
Enable-PhpExtension -Extension psr -Path $php_dir
|
||||
} else {
|
||||
} else {
|
||||
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Test-Path $ext_dir\php_phalcon.dll) {
|
||||
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
||||
if($phalcon.Version[0] -eq $extension_version) {
|
||||
if(Test-Path $ext_dir\php_phalcon.dll) {
|
||||
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
||||
if($phalcon.Version[0] -eq $extension_version) {
|
||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Enabled"
|
||||
} else {
|
||||
} else {
|
||||
$status = 'Installed and enabled'
|
||||
Remove-Item $ext_dir\php_phalcon.dll
|
||||
Install-Phalcon
|
||||
Add-PhalconHelper
|
||||
}
|
||||
} else {
|
||||
$status = 'Installed and enabled'
|
||||
Add-PhalconHelper
|
||||
}
|
||||
} else {
|
||||
Install-Phalcon
|
||||
}
|
||||
Add-Log $tick $extension $status
|
||||
} catch [Exception] {
|
||||
Write-Output $_.Exception|format-list -force
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||
}
|
||||
}
|
||||
|
@ -1,84 +1,65 @@
|
||||
# Function to log result of a operation
|
||||
add_log() {
|
||||
mark=$1
|
||||
subject=$2
|
||||
message=$3
|
||||
if [ "$mark" = "$tick" ]; then
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
# Helper function to add phalcon.
|
||||
add_phalcon_helper() {
|
||||
status='Installed and enabled'
|
||||
if [ "$os_name" = "Linux" ]; then
|
||||
update_lists
|
||||
${apt_install:?} "php${version:?}-$extension"
|
||||
else
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
phalcon_ini_file=${ini_file:?}
|
||||
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
||||
brew tap shivammathur/homebrew-phalcon
|
||||
brew install phalcon@"${version:?}"_"$extension_major_version"
|
||||
sudo cp /usr/local/opt/psr@"${version:?}"/psr.so "${ext_dir:?}"
|
||||
sudo cp /usr/local/opt/phalcon@"${version:?}"_"$extension_major_version"/phalcon.so "${ext_dir:?}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to add ppa:ondrej/php
|
||||
add_ppa() {
|
||||
if ! apt-cache policy | grep -q ondrej/php; then
|
||||
cleanup_lists
|
||||
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
|
||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||
sudo "$debconf_fix" apt-get update
|
||||
# Function to add phalcon3.
|
||||
add_phalcon3() {
|
||||
if [ -e "${ext_dir:?}/phalcon.so" ]; then
|
||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||
add_phalcon_helper
|
||||
else
|
||||
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
add_phalcon_helper
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to update the package lists
|
||||
update_lists() {
|
||||
if [ ! -e /tmp/setup_php ]; then
|
||||
[ "$DISTRIB_RELEASE" = "20.04" ] && add_ppa >/dev/null 2>&1
|
||||
cleanup_lists
|
||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
||||
echo '' | sudo tee "/tmp/setup_php" >/dev/null 2>&1
|
||||
# Function to add phalcon4.
|
||||
add_phalcon4() {
|
||||
if [ -e "${ext_dir:?}/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install phalcon
|
||||
install_phalcon() {
|
||||
extension=$1
|
||||
version=$2
|
||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
}
|
||||
|
||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
ini_file="/etc/php/$2/cli/conf.d/50-phalcon.ini"
|
||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
||||
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
||||
tick="✓"
|
||||
cross="✗"
|
||||
|
||||
if [ "$extension_major_version" = "4" ]; then
|
||||
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||
if php -m | grep -i -q -w psr; then
|
||||
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||
install_phalcon "$1" "$2"
|
||||
add_phalcon_helper
|
||||
else
|
||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||
add_log "$tick" "$1" "Enabled"
|
||||
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||
fi
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
add_phalcon_helper
|
||||
fi
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
fi
|
||||
fi
|
||||
add_phalcon_helper
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$extension_major_version" = "3" ]; then
|
||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||
install_phalcon "$1" "$2"
|
||||
else
|
||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||
add_log "$tick" "$1" "Enabled"
|
||||
fi
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
# Function to add phalcon.
|
||||
add_phalcon() {
|
||||
extension=$1
|
||||
status='Enabled'
|
||||
os_name=$(uname -s)
|
||||
phalcon_ini_file="${scan_dir:?}/50-phalcon.ini"
|
||||
extension_major_version=${extension: -1}
|
||||
if [ "$extension_major_version" = "4" ]; then
|
||||
add_phalcon4 >/dev/null 2>&1
|
||||
elif [ "$extension_major_version" = "3" ]; then
|
||||
add_phalcon3 >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
add_extension_log "phalcon" "$status"
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
# Function to log result of a operation
|
||||
add_log() {
|
||||
mark=$1
|
||||
subject=$2
|
||||
message=$3
|
||||
if [ "$mark" = "$tick" ]; then
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
else
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install phalcon
|
||||
install_phalcon() {
|
||||
(
|
||||
sed -i '' '/extension.*psr/d' "$ini_file"
|
||||
brew tap shivammathur/homebrew-phalcon >/dev/null 2>&1
|
||||
brew install phalcon@"$php_version"_"$extension_major" >/dev/null 2>&1
|
||||
sudo cp /usr/local/opt/psr@"$php_version"/psr.so "$ext_dir" >/dev/null 2>&1
|
||||
sudo cp /usr/local/opt/phalcon@"$php_version"_"$extension_major"/phalcon.so "$ext_dir" >/dev/null 2>&1
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
}
|
||||
|
||||
tick="✓"
|
||||
cross="✗"
|
||||
extension=$1
|
||||
extension_major=${extension: -1}
|
||||
php_version=$2
|
||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
|
||||
phalcon_version=$(php -d="extension=psr.so" -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
|
||||
if php -m | grep -i -q -w psr; then
|
||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
|
||||
fi
|
||||
if [ "$phalcon_version" != "$extension_major" ]; then
|
||||
install_phalcon
|
||||
else
|
||||
if ! php -m | grep -i -q -w psr; then echo "extension=psr.so" >>"$ini_file"; fi
|
||||
echo "extension=phalcon.so" >>"$ini_file"
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
fi
|
||||
else
|
||||
install_phalcon
|
||||
fi
|
@ -16,6 +16,16 @@ add_log() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to log result of installing extension.
|
||||
add_extension_log() {
|
||||
extension=$1
|
||||
status=$2
|
||||
extension_name=$(echo "$extension" | cut -d '-' -f 1)
|
||||
(
|
||||
check_extension "$extension_name" && add_log "$tick" "$extension_name" "$status"
|
||||
) || add_log "$cross" "$extension_name" "Could not install $extension on PHP $semver"
|
||||
}
|
||||
|
||||
# Function to read env inputs.
|
||||
read_env() {
|
||||
. /etc/lsb-release
|
||||
@ -155,8 +165,7 @@ add_pdo_extension() {
|
||||
fi
|
||||
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
||||
enable_extension "$pdo_ext" "extension"
|
||||
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
|
||||
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
|
||||
add_extension_log "$pdo_ext" "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -174,8 +183,7 @@ add_extension() {
|
||||
fi
|
||||
eval "$install_command" >/dev/null 2>&1 ||
|
||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
sudo chmod 777 "$ini_file"
|
||||
}
|
||||
@ -196,11 +204,8 @@ add_pecl_extension() {
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
else
|
||||
delete_extension "$extension"
|
||||
(
|
||||
pecl_install "$extension-$pecl_version" &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
pecl_install "$extension-$pecl_version"
|
||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -229,9 +234,7 @@ add_extension_from_source() {
|
||||
phpize && ./configure "$args" && make && sudo make install
|
||||
enable_extension "$extension" "$prefix"
|
||||
) >/dev/null 2>&1
|
||||
(
|
||||
check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$release on PHP $semver"
|
||||
add_extension_log "$extension-$release" "Installed and enabled"
|
||||
}
|
||||
|
||||
# Function to configure composer
|
||||
|
21
src/utils.ts
21
src/utils.ts
@ -260,27 +260,6 @@ export async function suppressOutput(os_version: string): Promise<string> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get Xdebug version compatible with php versions.
|
||||
*
|
||||
* @param version
|
||||
*/
|
||||
export async function getXdebugVersion(version: string): Promise<string> {
|
||||
switch (version) {
|
||||
case '5.3':
|
||||
return '2.2.7';
|
||||
case '5.4':
|
||||
return '2.4.1';
|
||||
case '5.5':
|
||||
case '5.6':
|
||||
return '2.5.5';
|
||||
case '7.0':
|
||||
return '2.7.2';
|
||||
default:
|
||||
return '2.9.6';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get script to log unsupported extensions.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user