mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve support for ext-phalcon and refactor extensions.ts
This commit is contained in:
parent
935e74fb40
commit
4c045616f4
@ -3,20 +3,21 @@ import * as extensions from '../src/extensions';
|
|||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'xdebug, pcov, redis',
|
'xdebug, pcov, phalcon4',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(win32).toContain('Add-Extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
expect(win32).toContain('Add-Extension pcov');
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
expect(win32).toContain('Add-Extension redis beta');
|
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||||
|
|
||||||
win32 = await extensions.addExtension(
|
win32 = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'phalcon3, does_not_exist',
|
||||||
'7.2',
|
'7.2',
|
||||||
'win32',
|
'win32',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
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');
|
||||||
@ -25,7 +26,7 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
let linux: string = await extensions.addExtension(
|
let linux: string = await extensions.addExtension(
|
||||||
'xdebug, pcov, redis',
|
'xdebug, pcov',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -37,9 +38,6 @@ describe('Extension tests', () => {
|
|||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('pecl install pcov');
|
expect(linux).toContain('pecl install pcov');
|
||||||
expect(linux).toContain(
|
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis'
|
|
||||||
);
|
|
||||||
|
|
||||||
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('gearman.sh 7.0');
|
||||||
@ -51,8 +49,8 @@ describe('Extension tests', () => {
|
|||||||
'7.2',
|
'7.2',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('phalcon.sh 3.4.x 7.2');
|
expect(linux).toContain('phalcon.sh phalcon3 7.2');
|
||||||
expect(linux).toContain('phalcon.sh master 7.2');
|
expect(linux).toContain('phalcon.sh phalcon4 7.2');
|
||||||
expect(linux).toContain('gearman.sh 7.2');
|
expect(linux).toContain('gearman.sh 7.2');
|
||||||
|
|
||||||
linux = await extensions.addExtension(
|
linux = await extensions.addExtension(
|
||||||
@ -60,12 +58,12 @@ describe('Extension tests', () => {
|
|||||||
'7.3',
|
'7.3',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('phalcon.sh 3.4.x 7.3');
|
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
||||||
expect(linux).toContain('phalcon.sh master 7.3');
|
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
||||||
expect(linux).toContain('gearman.sh 7.3');
|
expect(linux).toContain('gearman.sh 7.3');
|
||||||
|
|
||||||
linux = await extensions.addExtension('phalcon4, gearman', '7.4', 'linux');
|
linux = await extensions.addExtension('phalcon4, gearman', '7.4', 'linux');
|
||||||
expect(linux).toContain('phalcon.sh master 7.4');
|
expect(linux).toContain('phalcon.sh phalcon4 7.4');
|
||||||
expect(linux).toContain('gearman.sh 7.4');
|
expect(linux).toContain('gearman.sh 7.4');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
@ -81,6 +79,12 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install xdebug');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install pcov');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('add_phalcon phalcon3');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('add_phalcon phalcon4');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install pcov');
|
||||||
|
|
||||||
|
59
dist/index.js
vendored
59
dist/index.js
vendored
@ -2194,13 +2194,16 @@ function addExtensionDarwin(extension_csv, version) {
|
|||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '5.6xdebug':
|
case /5\.6xdebug/.test(version + extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
case '5.6redis':
|
case /5\.6redis/.test(version + extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
|
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
script += '\nadd_phalcon ' + extension;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
@ -2231,9 +2234,10 @@ function addExtensionWindows(extension_csv, version) {
|
|||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '7.4redis':
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
script += '\nAdd-Extension ' + extension + ' beta';
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
script += '\nAdd-Phalcon ' + extension;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
script += '\nAdd-Extension ' + extension;
|
script += '\nAdd-Extension ' + extension;
|
||||||
@ -2260,35 +2264,9 @@ function addExtensionLinux(extension_csv, version) {
|
|||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '7.4redis':
|
// match 5.6gearman..7.4gearman
|
||||||
install_command =
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version + extension):
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.2phalcon3':
|
|
||||||
case '7.3phalcon3':
|
|
||||||
install_command =
|
|
||||||
'sh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
|
||||||
' 3.4.x ' +
|
|
||||||
version +
|
|
||||||
' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.2phalcon4':
|
|
||||||
case '7.3phalcon4':
|
|
||||||
case '7.4phalcon4':
|
|
||||||
install_command =
|
|
||||||
'sh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
|
||||||
' master ' +
|
|
||||||
version +
|
|
||||||
' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.0gearman':
|
|
||||||
case '7.1gearman':
|
|
||||||
case '7.2gearman':
|
|
||||||
case '7.3gearman':
|
|
||||||
case '7.4gearman':
|
|
||||||
install_command =
|
install_command =
|
||||||
'sh ' +
|
'sh ' +
|
||||||
path.join(__dirname, '../src/scripts/gearman.sh') +
|
path.join(__dirname, '../src/scripts/gearman.sh') +
|
||||||
@ -2296,6 +2274,17 @@ function addExtensionLinux(extension_csv, version) {
|
|||||||
version +
|
version +
|
||||||
' >/dev/null 2>&1';
|
' >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
|
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
install_command =
|
||||||
|
'sh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
||||||
|
' ' +
|
||||||
|
extension +
|
||||||
|
' ' +
|
||||||
|
version +
|
||||||
|
' >/dev/null 2>&1';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
|
@ -17,13 +17,16 @@ export async function addExtensionDarwin(
|
|||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '5.6xdebug':
|
case /5\.6xdebug/.test(version + extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
case '5.6redis':
|
case /5\.6redis/.test(version + extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
|
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
script += '\nadd_phalcon ' + extension;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
@ -53,9 +56,10 @@ export async function addExtensionWindows(
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '7.4redis':
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
script += '\nAdd-Extension ' + extension + ' beta';
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
script += '\nAdd-Phalcon ' + extension;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
script += '\nAdd-Extension ' + extension;
|
script += '\nAdd-Extension ' + extension;
|
||||||
@ -82,35 +86,9 @@ export async function addExtensionLinux(
|
|||||||
// add script to enable extension is already installed along with php
|
// add script to enable extension is already installed along with php
|
||||||
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (version + extension) {
|
switch (true) {
|
||||||
case '7.4redis':
|
// match 5.6gearman..7.4gearman
|
||||||
install_command =
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version + extension):
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.2phalcon3':
|
|
||||||
case '7.3phalcon3':
|
|
||||||
install_command =
|
|
||||||
'sh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
|
||||||
' 3.4.x ' +
|
|
||||||
version +
|
|
||||||
' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.2phalcon4':
|
|
||||||
case '7.3phalcon4':
|
|
||||||
case '7.4phalcon4':
|
|
||||||
install_command =
|
|
||||||
'sh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
|
||||||
' master ' +
|
|
||||||
version +
|
|
||||||
' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
case '7.0gearman':
|
|
||||||
case '7.1gearman':
|
|
||||||
case '7.2gearman':
|
|
||||||
case '7.3gearman':
|
|
||||||
case '7.4gearman':
|
|
||||||
install_command =
|
install_command =
|
||||||
'sh ' +
|
'sh ' +
|
||||||
path.join(__dirname, '../src/scripts/gearman.sh') +
|
path.join(__dirname, '../src/scripts/gearman.sh') +
|
||||||
@ -118,6 +96,17 @@ export async function addExtensionLinux(
|
|||||||
version +
|
version +
|
||||||
' >/dev/null 2>&1';
|
' >/dev/null 2>&1';
|
||||||
break;
|
break;
|
||||||
|
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version + extension):
|
||||||
|
install_command =
|
||||||
|
'sh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/phalcon.sh') +
|
||||||
|
' ' +
|
||||||
|
extension +
|
||||||
|
' ' +
|
||||||
|
version +
|
||||||
|
' >/dev/null 2>&1';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
|
@ -40,6 +40,22 @@ add_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_phalcon() {
|
||||||
|
extension=$1
|
||||||
|
sudo pecl install psr >/dev/null 2>&1
|
||||||
|
brew install autoconf automake libtool >/dev/null 2>&1
|
||||||
|
git clone https://github.com/phalcon/cphalcon.git >/dev/null 2>&1
|
||||||
|
cd cphalcon || echo "could not cd"
|
||||||
|
git checkout "$(git branch -r | grep -E "origin/${extension: -1}\.\d\.x" | sort -r | head -n 1 | sed "s/ //g")" >/dev/null 2>&1
|
||||||
|
sed -i '' 's/zend_ulong/ulong/' build/php7/64bits/phalcon.zep.c
|
||||||
|
sed -i '' 's/ulong/zend_ulong/' build/php7/64bits/phalcon.zep.c
|
||||||
|
cd build/php7/64bits && sudo phpize >/dev/null 2>&1
|
||||||
|
sudo ./configure --with-php-config=/usr/local/bin/php-config --enable-phalcon >/dev/null 2>&1
|
||||||
|
sudo glibtoolize --force >/dev/null 2>&1 && sudo autoreconf >/dev/null 2>&1
|
||||||
|
sudo make -i -j2 >/dev/null 2>&1 && sudo make install >/dev/null 2>&1
|
||||||
|
echo "extension=phalcon.so" >>"$ini_file" && add_log "$tick" "$extension" "Installed and enabled"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup PHP and composer
|
# Function to setup PHP and composer
|
||||||
setup_php_and_composer() {
|
setup_php_and_composer() {
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
ini_dir=$(php --ini | grep in: | sed -e "s|.*:s*||" | sed "s/ //g")
|
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
||||||
if [ ! "$(apt-cache search php"$2"-psr)" ]; then
|
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
|
||||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
|
||||||
for tool in php-config phpize; do
|
for tool in php-config phpize; do
|
||||||
@ -19,6 +17,6 @@ if [ ! "$(apt-cache search php"$2"-psr)" ]; then
|
|||||||
echo "extension=psr.so" >> "$ini_file"
|
echo "extension=psr.so" >> "$ini_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ~ && git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b "$1"
|
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
||||||
cd cphalcon/build && sudo ./install --phpize /usr/bin/phpize"$2" --php-config /usr/bin/php-config"$2"
|
extension_version=$(apt-cache policy -- *phalcon | grep -i -Po "$extension_major_version\.\d\.\d.*php$2" | head -n 1)
|
||||||
echo "extension=phalcon.so" | sudo tee "$ini_dir/50-phalcon.ini"
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast -o Dpkg::Options::="--force-overwrite" install -y php"$2"-phalcon="$extension_version"
|
@ -9,6 +9,7 @@ $php_dir = 'C:\tools\php'
|
|||||||
$ext_dir = $php_dir + '\ext'
|
$ext_dir = $php_dir + '\ext'
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$master_version = '8.0'
|
$master_version = '8.0'
|
||||||
|
$arch='x64'
|
||||||
|
|
||||||
Function Step-Log($message) {
|
Function Step-Log($message) {
|
||||||
printf "\n\033[90;1m==> \033[0m\033[37;1m%s \033[0m\n" $message
|
printf "\n\033[90;1m==> \033[0m\033[37;1m%s \033[0m\n" $message
|
||||||
@ -33,7 +34,6 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
}
|
}
|
||||||
Step-Log "Setup PHP and Composer"
|
Step-Log "Setup PHP and Composer"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
||||||
$arch='x64'
|
|
||||||
if ($version -lt '7.0') {
|
if ($version -lt '7.0') {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
$arch='x86'
|
$arch='x86'
|
||||||
@ -101,3 +101,29 @@ Function Add-Extension {
|
|||||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function Add-Phalcon {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateSet('phalcon3', 'phalcon4')]
|
||||||
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
$extension_version = $extension.substring($extension.Length - 1)
|
||||||
|
$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" }
|
||||||
|
$domain = "https://github.com"
|
||||||
|
Install-Phpextension psr
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||||
|
$zip_file = $match.Matches[0].Groups[1].Value
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $PSScriptRoot\phalcon.zip
|
||||||
|
Expand-Archive -Path $PSScriptRoot\phalcon.zip -DestinationPath $PSScriptRoot\phalcon -Force > $null 2>&1
|
||||||
|
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $PSScriptRoot\phalcon\php_phalcon.dll > $null 2>&1
|
||||||
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
|
Add-Log $tick $extension "Installed and enabled"
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user