Compare commits

..

5 Commits
1.3.0 ... 1.3.1

7 changed files with 46 additions and 20 deletions

View File

@ -42,26 +42,28 @@ function asyncForEach(array, callback) {
Enable extensions which are installed but not enabled
*/
function enableExtension(extension) {
return __awaiter(this, void 0, void 0, function* () {
windows += `try {
windows += `try {
$${extension}_found = 0
$ext_dir = Get-PhpIniKey extension_dir
$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$version
$${extension}_found = 1
}
} catch [Exception] {
echo $_
}\n`;
let shell_code = `ext_dir=$(php-config --extension-dir)
let shell_code = `ext_dir=$(php-config --extension-dir)
${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
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
echo "${extension} enabled"
${extension}_found=1
fi\n`;
linux += shell_code;
darwin += shell_code;
});
linux += shell_code;
darwin += shell_code;
}
/*
Install and enable extensions
@ -86,7 +88,9 @@ function addExtension(extension_csv, version) {
// else add script to attempt to install the extension
if (os_version == 'linux') {
linux +=
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
'if [ $' +
extension +
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version +
'-' +
extension +
@ -94,7 +98,7 @@ function addExtension(extension_csv, version) {
version +
'-' +
extension +
'"\n';
'"; fi\n';
}
else {
// check if pecl extension exists
@ -109,19 +113,24 @@ function addExtension(extension_csv, version) {
extension_version = 'alpha';
}
windows +=
'try { Install-PhpExtension ' +
'if($' +
extension +
'_found -eq 0) { ' +
'try { Install-PhpExtension ' +
extension +
' -MinimumStability ' +
extension_version +
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
extension +
' }\n';
' } }\n';
darwin +=
'pecl install ' +
'if [ $' +
extension +
'_found -eq 0 ]; then sudo pecl install ' +
extension +
' || echo "Couldn\'t find extension: ' +
extension +
'"\n';
'"; fi\n';
}
else {
console.log('Cannot find pecl extension: ' + extension);

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "1.3.0",
"version": "1.3.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "1.3.0",
"version": "1.3.1",
"private": false,
"description": "Setup php action",
"main": "lib/setup-php.js",

View File

@ -45,4 +45,6 @@ phpbrew install -j 10 7.4.0RC2 +default +bz2="$(brew --prefix bzip2)" +zlib="$(b
phpbrew switch php-7.4.0RC2 >> /dev/null
sudo mkdir -p /usr/local/bin
sudo ln -sf /Users/runner/.phpbrew/php/php-7.4.0RC2/bin/php /usr/local/bin/php
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 $ini_file
brew install composer

View File

@ -9,8 +9,10 @@ else
fi
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 $ini_file
mkdir -p $(pecl config-get ext_dir)
curl -sS https://getcomposer.org/installer | php
chmod +x composer.phar
mv composer.phar /usr/local/bin/composer
composer global require hirak/prestissimo
php -v
composer -V

View File

@ -27,23 +27,27 @@ async function asyncForEach(array: any, callback: any) {
/*
Enable extensions which are installed but not enabled
*/
async function enableExtension(extension: string) {
function enableExtension(extension: string) {
windows += `try {
$${extension}_found = 0
$ext_dir = Get-PhpIniKey extension_dir
$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$version
$${extension}_found = 1
}
} catch [Exception] {
echo $_
}\n`;
let shell_code = `ext_dir=$(php-config --extension-dir)
${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
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
echo "${extension} enabled"
${extension}_found=1
fi\n`;
linux += shell_code;
darwin += shell_code;
@ -71,7 +75,9 @@ async function addExtension(extension_csv: string, version: string) {
// else add script to attempt to install the extension
if (os_version == 'linux') {
linux +=
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
'if [ $' +
extension +
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version +
'-' +
extension +
@ -79,7 +85,7 @@ async function addExtension(extension_csv: string, version: string) {
version +
'-' +
extension +
'"\n';
'"; fi\n';
} else {
// check if pecl extension exists
const http = new httpm.HttpClient('shivammathur/php-setup', [], {
@ -95,19 +101,24 @@ async function addExtension(extension_csv: string, version: string) {
extension_version = 'alpha';
}
windows +=
'if($' +
extension +
'_found -eq 0) { ' +
'try { Install-PhpExtension ' +
extension +
' -MinimumStability ' +
extension_version +
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
extension +
' }\n';
' } }\n';
darwin +=
'pecl install ' +
'if [ $' +
extension +
'_found -eq 0 ]; then sudo pecl install ' +
extension +
' || echo "Couldn\'t find extension: ' +
extension +
'"\n';
'"; fi\n';
} else {
console.log('Cannot find pecl extension: ' + extension);
}

View File

@ -17,7 +17,9 @@ if [ ! -e "/usr/bin/composer" ]; then
sudo curl -s https://getcomposer.org/installer | php;
sudo mv composer.phar /usr/local/bin/composer;
fi
composer global require hirak/prestissimo
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 $ini_file
sudo mkdir -p /run/php
php -v
composer -V