Skip to content

Commit

Permalink
Fix condition to check if extension is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Sep 24, 2019
1 parent e63fd8e commit 83cc9a4
Show file tree
Hide file tree
Showing 292 changed files with 44 additions and 56,059 deletions.
32 changes: 12 additions & 20 deletions lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ exports.addINIValues = addINIValues;
*/
function enableExtensionWindows(extension) {
return __awaiter(this, void 0, void 0, function* () {
return `try {
$${extension}_found = 0
$ext_dir = Get-PhpIniKey extension_dir
return `try {
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
if($enabled -eq 'no' -and $exist) {
Enable-PhpExtension ${extension} C:\\tools\\php
$${extension}_found = 1
if(!(php -m | findstr -i ${extension}) -and $exist) {
Enable-PhpExtension ${extension} C:\\tools\\php
}
} catch [Exception] {
echo $_
Expand All @@ -68,12 +64,9 @@ exports.enableExtensionWindows = enableExtensionWindows;
*/
function enableExtensionUnix(extension) {
return __awaiter(this, void 0, void 0, function* () {
return `${extension}_found=0
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
return `if [ ! "$(php -m | grep ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
echo "${extension} enabled"
${extension}_found=1
echo "${extension} enabled"
fi\n`;
});
}
Expand All @@ -93,9 +86,9 @@ function addExtensionDarwin(extension_csv) {
script += yield enableExtensionUnix(extension);
if (yield pecl.checkPECLExtension(extension)) {
script +=
'if [ $' +
'if [ ! "$(php -m | grep ' +
extension +
'_found -eq 0 ]; then sudo pecl install ' +
')" ]; then sudo pecl install ' +
extension +
' || echo "Couldn\'t find extension: ' +
extension +
Expand Down Expand Up @@ -127,9 +120,9 @@ function addExtensionWindows(extension_csv, version) {
}
if (yield pecl.checkPECLExtension(extension)) {
script +=
'if($' +
'if(!(php -m | findstr -i ' +
extension +
'_found -eq 0) { ' +
')) { ' +
'try { Install-PhpExtension ' +
extension +
' -MinimumStability ' +
Expand Down Expand Up @@ -159,9 +152,9 @@ function addExtensionLinux(extension_csv, version) {
// add script to enable extension is already installed along with php
script += yield enableExtensionUnix(extension);
script +=
'if [ $' +
'if [ ! "$(php -m | grep ' +
extension +
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
')" ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version +
'-' +
extension +
Expand Down Expand Up @@ -207,8 +200,7 @@ function addINIValuesWindows(ini_values_csv) {
yield utils.asyncForEach(ini_values, function (ini_value) {
return __awaiter(this, void 0, void 0, function* () {
// add script to set ini value
script +=
'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
script += 'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
});
});
return script;
Expand Down
15 changes: 0 additions & 15 deletions node_modules/.bin/codecov

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/.bin/codecov.cmd

This file was deleted.

15 changes: 0 additions & 15 deletions node_modules/.bin/esparse

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/.bin/esparse.cmd

This file was deleted.

15 changes: 0 additions & 15 deletions node_modules/.bin/esvalidate

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/.bin/esvalidate.cmd

This file was deleted.

15 changes: 0 additions & 15 deletions node_modules/.bin/js-yaml

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/.bin/js-yaml.cmd

This file was deleted.

24 changes: 0 additions & 24 deletions node_modules/agent-base/.travis.yml

This file was deleted.

113 changes: 0 additions & 113 deletions node_modules/agent-base/History.md

This file was deleted.

Loading

0 comments on commit 83cc9a4

Please sign in to comment.