Add support for php.ini customization and fix bugs

This commit is contained in:
Shivam Mathur
2019-09-18 07:40:09 +05:30
parent a398f54da4
commit e4a37d0f16
9 changed files with 112 additions and 34 deletions

View File

@ -86,7 +86,7 @@ function addExtension(extension_csv, version) {
// else add script to attempt to install the extension
if (os_version == 'linux') {
linux +=
'sudo apt install -y php' +
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version +
'-' +
extension +
@ -129,7 +129,28 @@ function addExtension(extension_csv, version) {
}
});
});
linux += 'sudo apt autoremove -y';
linux += 'sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y';
});
}
/*
Add script to set custom ini values
*/
function addINIValues(ini_values_csv) {
return __awaiter(this, void 0, void 0, function* () {
let ini_values = ini_values_csv
.split(',')
.map(function (ini_value) {
return ini_value.trim();
});
yield asyncForEach(ini_values, function (ini_value) {
return __awaiter(this, void 0, void 0, function* () {
// add script to set ini value
linux += '\necho "' + ini_value + '" >> $ini_file';
darwin += '\necho "' + ini_value + '" >> $ini_file';
windows +=
'\nAdd-Content C:\\tools\\php$version\\php.ini "' + ini_value + '"';
});
});
});
}
/*
@ -166,7 +187,7 @@ function run() {
if (!version) {
version = core.getInput('php-version', { required: true });
}
console.log('Input: ' + version);
console.log('Version: ' + version);
if (version == '7.4') {
darwin = fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8');
}
@ -175,9 +196,17 @@ function run() {
extension_csv = core.getInput('extension-csv');
}
if (extension_csv) {
console.log('Input: ' + extension_csv);
console.log('Extensions: ' + extension_csv);
yield addExtension(extension_csv, version);
}
let ini_values_csv = process.env['ini-values-csv'];
if (!ini_values_csv) {
ini_values_csv = core.getInput('ini-values-csv');
}
if (ini_values_csv) {
console.log('INI Values: ' + ini_values_csv);
yield addINIValues(ini_values_csv);
}
// check the os version and run the respective script
if (os_version == 'darwin') {
yield createScript('darwin.sh', version);