mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 21:33: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 pcov');
|
||||||
expect(win32).toContain('Add-Extension sqlite3');
|
expect(win32).toContain('Add-Extension sqlite3');
|
||||||
expect(win32).toContain('Remove-Extension intl');
|
expect(win32).toContain('Remove-Extension intl');
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||||
expect(win32).toContain('ioncube.ps1 7.4');
|
expect(win32).toContain('Add-Ioncube');
|
||||||
expect(win32).toContain('oci.ps1 oci8 7.4');
|
expect(win32).toContain('Add-OCI oci8');
|
||||||
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
|
expect(win32).toContain('Add-OCI pdo_oci');
|
||||||
expect(win32).toContain('Add-Extension ast beta');
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||||
@ -43,17 +43,17 @@ describe('Extension tests', () => {
|
|||||||
'win32',
|
'win32',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon3');
|
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||||
expect(win32).toContain('Add-Extension does_not_exist');
|
expect(win32).toContain('Add-Extension does_not_exist');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
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');
|
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 () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
@ -91,38 +91,29 @@ describe('Extension tests', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('add_gearman');
|
||||||
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');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
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');
|
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(linux).toContain('Platform fedora is not supported');
|
expect(linux).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||||
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
expect(linux).toContain('add_phalcon phalcon3');
|
||||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
expect(linux).toContain('add_phalcon phalcon4');
|
||||||
|
|
||||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
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');
|
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||||
expect(linux).toContain('oci.sh oci8 7.3');
|
expect(linux).toContain('add_oci oci8');
|
||||||
expect(linux).toContain('oci.sh pdo_oci 7.3');
|
expect(linux).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
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');
|
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 () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
@ -142,17 +133,17 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
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');
|
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');
|
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');
|
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('oci.sh oci8 7.3');
|
expect(darwin).toContain('add_oci oci8');
|
||||||
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
expect(darwin).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain(
|
expect(darwin).toContain(
|
||||||
@ -162,15 +153,6 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
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');
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
@ -195,10 +177,10 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('pecl_install imagick');
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
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');
|
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(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'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 () => {
|
it('checking getUnsupportedLog', async () => {
|
||||||
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
||||||
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
'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;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 fs = __importStar(__webpack_require__(747));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
@ -1529,27 +1529,6 @@ async function suppressOutput(os_version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.suppressOutput = suppressOutput;
|
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.
|
* Function to get script to log unsupported extensions.
|
||||||
*
|
*
|
||||||
@ -3611,9 +3590,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 path = __importStar(__webpack_require__(622));
|
||||||
const utils = __importStar(__webpack_require__(163));
|
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
|
* 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...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
|
// 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):
|
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);
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
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):
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
case /5\.[3-5]xdebug/.test(version_extension):
|
|
||||||
command =
|
|
||||||
command_prefix + 'xdebug-' + (await utils.getXdebugVersion(version));
|
|
||||||
break;
|
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
@ -3678,18 +3678,6 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
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:
|
default:
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
@ -3717,12 +3705,24 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
return;
|
break;
|
||||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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
|
// 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):
|
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);
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
|
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
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
||||||
return;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(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]);
|
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2], matches[1]);
|
||||||
return;
|
break;
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
@ -3758,18 +3758,6 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||||
break;
|
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:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + extension;
|
||||||
break;
|
break;
|
||||||
@ -3803,8 +3791,24 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
|
// 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):
|
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);
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
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):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
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
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
add_script +=
|
add_script +=
|
||||||
@ -3844,11 +3832,8 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_st-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
.replace('pdo_', '')
|
|
||||||
.replace('pdo-', '')
|
|
||||||
.replace('sqlite3', 'sqlite');
|
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match ast and uopz
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as utils from './utils';
|
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
|
* 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(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
command = await utils.joins(
|
add_script += await customExtension(
|
||||||
'\nbash',
|
'blackfire.sh',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh'),
|
'add_blackfire',
|
||||||
version,
|
|
||||||
extension
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@ -57,10 +90,6 @@ export async function addExtensionDarwin(
|
|||||||
ext_prefix
|
ext_prefix
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
case /5\.[3-5]xdebug/.test(version_extension):
|
|
||||||
command =
|
|
||||||
command_prefix + 'xdebug-' + (await utils.getXdebugVersion(version));
|
|
||||||
break;
|
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
@ -89,32 +118,6 @@ export async function addExtensionDarwin(
|
|||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
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:
|
default:
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
@ -150,19 +153,34 @@ export async function addExtensionWindows(
|
|||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
return;
|
break;
|
||||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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
|
// 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(
|
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
add_script += await utils.joins(
|
add_script += await customExtension(
|
||||||
'\n& ',
|
'blackfire.ps1',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1'),
|
'Add-Blackfire',
|
||||||
version,
|
|
||||||
extension
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@ -179,7 +197,7 @@ export async function addExtensionWindows(
|
|||||||
'stable',
|
'stable',
|
||||||
ext_version
|
ext_version
|
||||||
);
|
);
|
||||||
return;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
||||||
version_extension
|
version_extension
|
||||||
@ -193,7 +211,7 @@ export async function addExtensionWindows(
|
|||||||
matches[2],
|
matches[2],
|
||||||
matches[1]
|
matches[1]
|
||||||
);
|
);
|
||||||
return;
|
break;
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
@ -216,32 +234,6 @@ export async function addExtensionWindows(
|
|||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||||
break;
|
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:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + extension;
|
||||||
break;
|
break;
|
||||||
@ -281,13 +273,32 @@ export async function addExtensionLinux(
|
|||||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
command = await utils.joins(
|
add_script += await customExtension(
|
||||||
'\nbash',
|
'blackfire.sh',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh'),
|
'add_blackfire',
|
||||||
version,
|
|
||||||
extension
|
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
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@ -310,41 +321,6 @@ export async function addExtensionLinux(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
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
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
add_script +=
|
add_script +=
|
||||||
@ -356,11 +332,8 @@ export async function addExtensionLinux(
|
|||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_st-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
.replace('pdo_', '')
|
|
||||||
.replace('pdo-', '')
|
|
||||||
.replace('sqlite3', 'sqlite');
|
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match ast and uopz
|
||||||
|
@ -16,6 +16,16 @@ add_log() {
|
|||||||
fi
|
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.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||||
@ -92,11 +102,8 @@ add_pecl_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
remove_extension "$extension" >/dev/null 2>&1
|
remove_extension "$extension" >/dev/null 2>&1
|
||||||
(
|
pecl_install "$extension-$pecl_version"
|
||||||
pecl_install "$extension-$pecl_version" &&
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
check_extension "$extension" &&
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,8 +129,7 @@ add_extension() {
|
|||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
eval "$install_command" >/dev/null 2>&1 &&
|
eval "$install_command" >/dev/null 2>&1 &&
|
||||||
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
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_extension_log "$extension" "Installed and enabled"
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +149,7 @@ configure_composer() {
|
|||||||
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
add_log "$cross" "composer" "Could not download composer"
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
||||||
@ -192,8 +198,7 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added"
|
||||||
add_log "$tick" "$tool" "Added"
|
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +266,7 @@ fi
|
|||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
if [[ "$version" =~ $old_versions ]]; then
|
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"
|
status="Installed"
|
||||||
elif [ "$existing_version" != "$version" ]; then
|
elif [ "$existing_version" != "$version" ]; then
|
||||||
setup_php "install" >/dev/null 2>&1
|
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)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[string]
|
[string]
|
||||||
$version,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[string]
|
|
||||||
$extension
|
$extension
|
||||||
)
|
)
|
||||||
|
try {
|
||||||
$tick = ([char]8730)
|
$no_dot_version = $version.replace('.', '')
|
||||||
$php_dir = 'C:\tools\php'
|
$extension_version = $extension.split('-')[1]
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
if ($extension_version -notmatch "\S") {
|
||||||
$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 }
|
$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 }
|
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
|
||||||
}
|
}
|
||||||
if (Test-Path $ext_dir\blackfire.dll) {
|
if (Test-Path $ext_dir\blackfire.dll) {
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Enabled"
|
$status="Enabled"
|
||||||
} else {
|
} else {
|
||||||
$installed = Get-Php -Path $php_dir
|
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } 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-${version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
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
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Installed and enabled"
|
$status="Installed and enabled"
|
||||||
|
}
|
||||||
|
Add-Log $tick $extension $status
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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,7 +8,7 @@ add_blackfire() {
|
|||||||
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
if [ "$extension_version" = "blackfire" ]; 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
|
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
|
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
|
fi
|
||||||
|
@ -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)
|
# Helper function to add gearman extension.
|
||||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
add_gearman_helper() {
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
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
|
# Function to add gearman extension.
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
add_gearman() {
|
||||||
elif [ "$release_version" = "16.04" ]; then
|
status="Enabled"
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
add_gearman_helper >/dev/null 2>&1
|
||||||
fi
|
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 to log result of a operation.
|
||||||
Function Add-Log($mark, $subject, $message) {
|
Function Add-LicenseLog() {
|
||||||
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"
|
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
|
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||||
Write-Output "::endgroup::"
|
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)
|
# Function to add ioncube extension.
|
||||||
$cross = ([char]10007)
|
Function Add-Ioncube() {
|
||||||
$status = 'Enabled'
|
try {
|
||||||
$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)) {
|
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$arch = 'x86-64'
|
$arch_part = $arch
|
||||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
if ($arch -eq 'x64') {
|
||||||
$arch = 'x86'
|
$arch_part = 'x86-64'
|
||||||
}
|
}
|
||||||
$vc = $installed.VCVersion
|
$vc = $installed.VCVersion
|
||||||
$ts = ""
|
$ts_part = ""
|
||||||
if (-not($installed.ThreadSafe)) {
|
if (-not($installed.ThreadSafe)) {
|
||||||
$ts = "_nonts"
|
$ts_part = "_nonts"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts`_vc$vc`_$arch.zip" -OutFile $ext_dir\ioncube.zip
|
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
|
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
|
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
|
"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-Log $tick "ioncube" $status
|
||||||
} catch {
|
Add-LicenseLog
|
||||||
|
} catch {
|
||||||
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,60 +1,45 @@
|
|||||||
Param (
|
# Function to log license information.
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
Function Add-LicenseLog() {
|
||||||
[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
|
|
||||||
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 "::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 "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 "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"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
Write-Output "::endgroup::"
|
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)
|
# Function to get instantclinet.
|
||||||
$cross = ([char]10007)
|
Function Add-InstantClient() {
|
||||||
$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
|
|
||||||
{
|
|
||||||
if (-not(Test-Path $php_dir\oci.dll)) {
|
if (-not(Test-Path $php_dir\oci.dll)) {
|
||||||
$suffix = 'windows'
|
$suffix = 'windows'
|
||||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
|
if ($arch -eq 'x86') {
|
||||||
{
|
|
||||||
$suffix = 'nt'
|
$suffix = 'nt'
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
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
|
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||||
Copy-Item $php_dir\instantclient*\* $php_dir
|
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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") {
|
if ($extension -eq "pdo_oci") {
|
||||||
Enable-PhpExtension pdo_oci -Path $php_dir
|
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$ociVersion = '2.2.0'
|
$ociVersion = '2.2.0'
|
||||||
if ($version -eq '7.0')
|
if ($version -eq '7.0') {
|
||||||
{
|
|
||||||
$ociVersion = '2.1.8'
|
$ociVersion = '2.1.8'
|
||||||
}
|
} elseif ($version -lt '7.0') {
|
||||||
elseif ($version -lt '7.0')
|
|
||||||
{
|
|
||||||
$ociVersion = '2.0.12'
|
$ociVersion = '2.0.12'
|
||||||
}
|
}
|
||||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||||
@ -63,6 +48,8 @@ try
|
|||||||
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
||||||
}
|
}
|
||||||
Add-Log $tick $extension $status
|
Add-Log $tick $extension $status
|
||||||
} catch {
|
Add-LicenseLog
|
||||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,24 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
add_log() {
|
add_license_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 "::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 "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 "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"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
echo "::endgroup::"
|
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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the tag for a php version.
|
# Function to get the tag for a php version.
|
||||||
get_tag() {
|
get_tag() {
|
||||||
master_version='8.0'
|
master_version='8.0'
|
||||||
tag='master'
|
tag='master'
|
||||||
if [ ! "$version" = "$master_version" ]; then
|
if [ ! "${version:?}" = "$master_version" ]; then
|
||||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
||||||
fi
|
fi
|
||||||
echo "$tag"
|
echo "$tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install instantclient and SDK.
|
# Function to install instantclient and SDK.
|
||||||
install_client() {
|
add_client() {
|
||||||
sudo mkdir -p -m 777 "$oracle_home"
|
sudo mkdir -p -m 777 "$oracle_home"
|
||||||
if [ ! -e "$oracle_client" ]; then
|
if [ ! -e "$oracle_client" ]; then
|
||||||
for package in basiclite sdk; do
|
for package in basiclite sdk; do
|
||||||
@ -47,7 +33,7 @@ install_client() {
|
|||||||
arch='macos'
|
arch='macos'
|
||||||
lib_ext='dylib'
|
lib_ext='dylib'
|
||||||
fi
|
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"
|
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||||
done
|
done
|
||||||
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
||||||
@ -91,51 +77,49 @@ patch_pdo_oci_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to install the dependencies.
|
# Function to install the dependencies.
|
||||||
install_dependencies() {
|
add_dependencies() {
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
if [ "$runner" = "self-hosted" ] || [ "$RUNNER" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y autoconf automake libaio-dev gcc g++ php"$version"-dev
|
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||||
else
|
else
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$version"-dev
|
update_lists
|
||||||
|
${apt_install:?} php"$version"-dev
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install the extension.
|
# Function to install oci8 and pdo_oci.
|
||||||
install_extension() {
|
add_oci_helper() {
|
||||||
if ! [ -e "$ext_dir/$ext.so" ]; then
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
(
|
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
phpize_orig=$(get_phpize)
|
phpize_orig=$(get_phpize)
|
||||||
tag=$(get_tag)
|
tag=$(get_tag)
|
||||||
get_php
|
get_php
|
||||||
patch_phpize
|
patch_phpize
|
||||||
|
(
|
||||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
||||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
||||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
||||||
sudo make -j"$(nproc)"
|
sudo make -j"$(nproc)"
|
||||||
sudo cp ./modules/* "$ext_dir/"
|
sudo cp ./modules/* "$ext_dir/"
|
||||||
restore_phpize
|
|
||||||
)
|
)
|
||||||
|
restore_phpize
|
||||||
fi
|
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
|
# Function to add oci extension oci8 and pdo_oci.
|
||||||
version=$2
|
add_oci() {
|
||||||
tick='✓'
|
ext=$1
|
||||||
cross='✗'
|
status='Enabled'
|
||||||
status='Enabled'
|
oracle_home='/opt/oracle'
|
||||||
oracle_home='/opt/oracle'
|
oracle_client=$oracle_home/instantclient
|
||||||
oracle_client=$oracle_home/instantclient
|
os=$(uname -s)
|
||||||
runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
|
add_client >/dev/null 2>&1
|
||||||
os=$(uname -s)
|
add_dependencies >/dev/null 2>&1
|
||||||
curl_opts=(-sSL --retry 5 --retry-delay 1)
|
add_oci_helper >/dev/null 2>&1
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
add_extension_log "$ext" "$status"
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
check_extension "$ext" && add_license_log
|
||||||
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"
|
|
||||||
|
@ -1,22 +1,9 @@
|
|||||||
Param (
|
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateSet('phalcon3', 'phalcon4')]
|
|
||||||
[string]
|
|
||||||
$extension,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
|
||||||
[string]
|
|
||||||
$version
|
|
||||||
)
|
|
||||||
|
|
||||||
# Function to install phalcon
|
# Function to install phalcon
|
||||||
Function Install-Phalcon() {
|
Function Add-PhalconHelper() {
|
||||||
if ($extension_version -eq '4') {
|
if ($extension_version -eq '4') {
|
||||||
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
$installed = Get-Php -Path $php_dir
|
$domain = 'https://github.com'
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$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)`""
|
$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
|
$zip_file = $match.Matches[0].Groups[1].Value
|
||||||
@ -25,33 +12,44 @@ Function Install-Phalcon() {
|
|||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
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)
|
Function Add-Phalcon() {
|
||||||
$domain = 'https://github.com'
|
Param (
|
||||||
$php_dir = 'C:\tools\php'
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
[ValidateNotNull()]
|
||||||
$ext_dir = "$php_dir\ext"
|
[ValidateSet('phalcon3', 'phalcon4')]
|
||||||
$extension_version = $extension.substring($extension.Length - 1)
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
$status = 'Enabled'
|
||||||
|
$extension_version = $extension.substring($extension.Length - 1)
|
||||||
|
|
||||||
if($extension_version -eq '4') {
|
if($extension_version -eq '4') {
|
||||||
if (Test-Path $ext_dir\php_psr.dll) {
|
if (Test-Path $ext_dir\php_psr.dll) {
|
||||||
Enable-PhpExtension -Extension psr -Path $php_dir
|
Enable-PhpExtension -Extension psr -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Test-Path $ext_dir\php_phalcon.dll) {
|
if(Test-Path $ext_dir\php_phalcon.dll) {
|
||||||
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
||||||
if($phalcon.Version[0] -eq $extension_version) {
|
if($phalcon.Version[0] -eq $extension_version) {
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
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
|
Remove-Item $ext_dir\php_phalcon.dll
|
||||||
Install-Phalcon
|
Add-PhalconHelper
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = 'Installed and enabled'
|
||||||
|
Add-PhalconHelper
|
||||||
|
}
|
||||||
|
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)"
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Install-Phalcon
|
|
||||||
}
|
}
|
@ -1,84 +1,65 @@
|
|||||||
# Function to log result of a operation
|
# Helper function to add phalcon.
|
||||||
add_log() {
|
add_phalcon_helper() {
|
||||||
mark=$1
|
status='Installed and enabled'
|
||||||
subject=$2
|
if [ "$os_name" = "Linux" ]; then
|
||||||
message=$3
|
update_lists
|
||||||
if [ "$mark" = "$tick" ]; then
|
${apt_install:?} "php${version:?}-$extension"
|
||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add ppa:ondrej/php
|
# Function to add phalcon3.
|
||||||
add_ppa() {
|
add_phalcon3() {
|
||||||
if ! apt-cache policy | grep -q ondrej/php; then
|
if [ -e "${ext_dir:?}/phalcon.so" ]; then
|
||||||
cleanup_lists
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
add_phalcon_helper
|
||||||
sudo "$debconf_fix" apt-get update
|
else
|
||||||
|
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update the package lists
|
# Function to add phalcon4.
|
||||||
update_lists() {
|
add_phalcon4() {
|
||||||
if [ ! -e /tmp/setup_php ]; then
|
if [ -e "${ext_dir:?}/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||||
[ "$DISTRIB_RELEASE" = "20.04" ] && add_ppa >/dev/null 2>&1
|
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
||||||
cleanup_lists
|
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
|
||||||
echo '' | sudo tee "/tmp/setup_php" >/dev/null 2>&1
|
|
||||||
fi
|
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 [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
if php -m | grep -i -q -w psr; then
|
if php -m | grep -i -q -w psr; then
|
||||||
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [ "$extension_major_version" = "3" ]; then
|
# Function to add phalcon.
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
add_phalcon() {
|
||||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
extension=$1
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
status='Enabled'
|
||||||
install_phalcon "$1" "$2"
|
os_name=$(uname -s)
|
||||||
else
|
phalcon_ini_file="${scan_dir:?}/50-phalcon.ini"
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
extension_major_version=${extension: -1}
|
||||||
add_log "$tick" "$1" "Enabled"
|
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
|
||||||
else
|
add_extension_log "phalcon" "$status"
|
||||||
install_phalcon "$1" "$2"
|
}
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
@ -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
|
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.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
@ -155,8 +165,7 @@ add_pdo_extension() {
|
|||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
||||||
enable_extension "$pdo_ext" "extension"
|
enable_extension "$pdo_ext" "extension"
|
||||||
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
|
add_extension_log "$pdo_ext" "Enabled"
|
||||||
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +183,7 @@ add_extension() {
|
|||||||
fi
|
fi
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
eval "$install_command" >/dev/null 2>&1 ||
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
}
|
}
|
||||||
@ -196,11 +204,8 @@ add_pecl_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(
|
pecl_install "$extension-$pecl_version"
|
||||||
pecl_install "$extension-$pecl_version" &&
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
check_extension "$extension" &&
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,9 +234,7 @@ add_extension_from_source() {
|
|||||||
phpize && ./configure "$args" && make && sudo make install
|
phpize && ./configure "$args" && make && sudo make install
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
(
|
add_extension_log "$extension-$release" "Installed and enabled"
|
||||||
check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$release on PHP $semver"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure composer
|
# 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.
|
* Function to get script to log unsupported extensions.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user