Compare commits

..

6 Commits

Author SHA1 Message Date
dependabot[bot]
083d5237d9 Bump the github-actions group with 2 updates (#1085)
Bumps the github-actions group with 2 updates: [github/codeql-action](https://github.com/github/codeql-action) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `github/codeql-action` from 4.35.5 to 4.36.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9e0d7b8d25...7211b7c807)

Updates `codecov/codecov-action` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](57e3a136b7...e79a6962e0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-30 16:35:36 +05:30
Shivam Mathur
a919ff576a Update FUNDING.yml 2026-05-19 03:02:31 +05:30
Shivam Mathur
deb2299a77 Harden GitHub Actions workflows 2026-05-18 00:56:40 +05:30
Shivam Mathur
5825be4b77 Harden environment lookup 2026-05-18 00:56:40 +05:30
Shivam Mathur
8d45593ff3 Add CODEOWNERS 2026-05-15 23:46:09 +05:30
Shivam Mathur
ba8d1631c1 Update PHP versions in SECURITY.md 2026-05-15 01:33:20 +05:30
51 changed files with 283 additions and 226 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @shivammathur

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
# These are supported funding model platforms
github: shivammathur
open_collective: setup-php

2
.github/SECURITY.md vendored
View File

@@ -10,10 +10,10 @@ This security policy only applies to the latest patch releases of the following
| Version | Supported |
|---------|--------------------|
| 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: |
| 8.3 | :white_check_mark: |
| 8.4 | :white_check_mark: |
| 8.5 | :white_check_mark: |
## Reporting a Vulnerability

View File

@@ -1,7 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "develop"
schedule:
interval: "weekly"
- package-ecosystem: 'github-actions'
directory: '/'
target-branch: 'develop'
schedule:
interval: 'weekly'
groups:
github-actions:
patterns:
- '*'
cooldown:
default-days: 7

View File

@@ -5,9 +5,13 @@ on:
- cron: '0 15 * * 6'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
codeql:
name: CodeQL Analysis
if: github.event.repository.fork == false
permissions:
actions: read # for github/codeql-action/init to get workflow details
@@ -16,18 +20,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 2
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
with:
config-file: ./.github/codeql/codeql-configuration.yml
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v4
uses: github/codeql-action/autobuild@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4

View File

@@ -5,12 +5,15 @@ on:
- cron: '0 15 * * 6'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
create:
if: github.event.repository.fork == false
permissions:
contents: none
contents: none # this job only prepares artifacts and uploads them, no repository writes
name: Create
runs-on: ${{ matrix.operating-system }}
strategy:
@@ -20,7 +23,7 @@ jobs:
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: ${{ matrix.php-versions }}
tools: none
@@ -39,7 +42,7 @@ jobs:
run: |
php -m | Out-File -FilePath "$env:file.all" -Append
- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: none
@@ -72,7 +75,7 @@ jobs:
version: ${{ matrix.php-versions }}
if: matrix.operating-system == 'windows-2022'
run: |
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
Write-Output "## PHP $env:version`n" | Out-File -FilePath "$env:file"
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file.builtin" -Append
Get-Content "$env:file.all" | ForEach-Object {
@@ -88,7 +91,7 @@ jobs:
Remove-Item "$env:file.all" -Force
Remove-Item "$env:file.builtin" -Force
- name: Upload artifacts
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
@@ -101,19 +104,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: ${{ github.repository }}.wiki
persist-credentials: false
- name: Download artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: ${{ github.workspace }}/lists
pattern: lists-*
merge-multiple: true
- name: Configure Git
env:
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_USER_NAME: github-actions[bot]
run : |
git config --local user.email "${{ secrets.email }}"
git config --local user.name "${{ github.repository_owner }}"
git config --local user.email "$GIT_USER_EMAIL"
git config --local user.name "$GIT_USER_NAME"
- name: Combine
run: |
for os in ubuntu-24.04 ubuntu-22.04 windows-2025 windows-2022 windows-2019 macos-13 macos-14 macos-15 macos-26; do
@@ -130,9 +137,12 @@ jobs:
done
rm -rf ./lists
- name: Update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WIKI_REPOSITORY: ${{ github.repository }}
run: |
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add .
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
git push -f https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master || true
git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/${WIKI_REPOSITORY}.wiki.git master || true
fi

View File

@@ -18,10 +18,14 @@ on:
- 'examples/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run:
name: Run
environment: codecov
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
@@ -29,12 +33,13 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 2
persist-credentials: false
- name: Setup Node.js 24.x
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24.x
@@ -54,7 +59,7 @@ jobs:
run: npm audit
- name: Send Coverage
uses: codecov/codecov-action@v6
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info

View File

@@ -19,8 +19,11 @@ on:
- 'examples/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
default-php-version: '8.2'
default-php-version: '8.5'
jobs:
run:
name: Run
@@ -39,18 +42,20 @@ jobs:
key: cache-v5
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@develop
uses: shivammathur/cache-extensions@256729b5fef535345e27904657f78048c0990f81 # v1
with:
php-version: ${{ matrix.php-versions || env.default-php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v5
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
@@ -58,8 +63,10 @@ jobs:
- name: Stage php-version-file
if: ${{ matrix.php-version-file == 'php-version-file' }}
env:
DEFAULT_PHP_VERSION: ${{ env.default-php-version }}
run: |
echo ${{ env.default-php-version }} > php-version-file
echo "$DEFAULT_PHP_VERSION" > php-version-file
- name: Setup PHP with extensions and custom config
run: node dist/index.js
@@ -70,9 +77,11 @@ jobs:
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
- name: Testing PHP version
env:
EXPECTED_PHP_VERSION: ${{ matrix.php-versions || env.default-php-version }}
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions || env.default-php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
php -r '$expected = getenv("EXPECTED_PHP_VERSION"); if(strpos(phpversion(), $expected) === false) {throw new Exception("Wrong PHP version Installed");}'
- name: Testing Composer version
run: |

View File

@@ -10,29 +10,39 @@ on:
tag:
description: Tag name
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
name: Build and Publish
permissions:
contents: read
packages: write
id-token: write
contents: read # for actions/checkout
packages: write # For publishing to GitHub Packages
id-token: write # For authentication with npm registry
runs-on: ubuntu-latest
steps:
- name: Checkout release
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Checkout tag
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ github.event.inputs.tag }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24.x'
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Install dependencies and add lib
run: |
@@ -45,9 +55,10 @@ jobs:
run: npm publish --access public
- name: Change to GitHub Packages registry
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
registry-url: https://npm.pkg.github.com
package-manager-cache: false
scope: '@shivammathur'
- name: Patch package.json

View File

@@ -11,6 +11,12 @@ describe('Utils tests', () => {
expect(await utils.readEnv('TEST')).toBe('setup-php');
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
expect(await utils.readEnv('test invalid')).toBe('');
process.env['conflict_hyphen'] = 'setup-php';
process.env['conflict-hyphen'] = 'wrong';
expect(await utils.readEnv('conflict_hyphen')).toBe('setup-php');
delete process.env['conflict_hyphen'];
delete process.env['conflict-hyphen'];
expect(await utils.readEnv('undefined')).toBe('');
});
@@ -211,9 +217,9 @@ describe('Utils tests', () => {
});
it('checking suppressOutput', async () => {
expect(await utils.suppressOutput('win32')).toEqual(' ');
expect(await utils.suppressOutput('linux')).toEqual(' ');
expect(await utils.suppressOutput('darwin')).toEqual(' ');
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
expect(await utils.suppressOutput('openbsd')).toContain(
'Platform openbsd is not supported'
);

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,7 @@ export async function addINIValuesUnix(
return (
'echo "' +
ini_values.map(v => utils.escapeForShell(v, 'linux')).join('\n') +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" ' +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
script
);
}

View File

@@ -13,10 +13,10 @@ handle_dependency_extensions() {
suffix="$(get_php_formula_suffix)"
if [[ -n "$suffix" ]]; then
brew_opts=(-sf)
patch_abstract_file
patch_abstract_file >/dev/null 2>&1
for dependency_extension in "${dependency_extensions[@]}"; do
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" &&
brew link --overwrite --force "$dependency_extension@$version" &&
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 &&
brew link --overwrite --force "$dependency_extension@$version" >/dev/null 2>&1 &&
copy_brew_extensions "$dependency_extension"
done
fi
@@ -33,7 +33,7 @@ disable_extension_helper() {
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
mkdir -p /tmp/extdisabled/"$version"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
}
# Function to get extension name from brew formula.
@@ -83,13 +83,13 @@ add_brew_extension() {
add_brew_tap "$php_tap"
add_brew_tap "$ext_tap"
formula="$(get_renamed_formula "$formula")"
update_dependencies
handle_dependency_extensions "$formula" "$extension"
update_dependencies >/dev/null 2>&1
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
(
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" &&
brew link --overwrite --force "$formula@$version" &&
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 &&
brew link --overwrite --force "$formula@$version" >/dev/null 2>&1 &&
copy_brew_extensions "$formula"
) || pecl_install "$extension"
) || pecl_install "$extension" >/dev/null 2>&1
add_extension_log "$extension" "Installed and enabled"
fi
}
@@ -98,7 +98,7 @@ add_brew_extension() {
patch_abstract_file() {
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
echo '' | sudo tee /tmp/abstract_patch
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
fi
}
@@ -108,9 +108,9 @@ add_extension_helper() {
local extension=$1
prefix=$2
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
run_script "php5-darwin" "${version/./}" "$extension"
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
else
pecl_install "$extension" &&
pecl_install "$extension" >/dev/null 2>&1 &&
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
fi
add_extension_log "$extension" "Installed and enabled"
@@ -124,8 +124,8 @@ add_devtools() {
# Function to handle request to add PECL.
add_pecl() {
enable_extension xml extension
configure_pecl
enable_extension xml extension >/dev/null 2>&1
configure_pecl >/dev/null 2>&1
pear_version=$(get_tool_version "pecl" "version")
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
}
@@ -157,7 +157,7 @@ update_dependencies() {
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
fi
done
echo '' | sudo tee /tmp/update_dependencies
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
fi
}
@@ -223,7 +223,7 @@ add_php_config() {
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
elif [ "$ini" = "none" ]; then
echo '' | sudo tee "${ini_file[@]}"
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
fi
}
@@ -238,7 +238,7 @@ get_scan_dir() {
# Function to handle self-hosted runner setup.
self_hosted_helper() {
sudo mkdir -p /opt/hostedtoolcache || true
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
}
# Function to Setup PHP.
@@ -250,15 +250,15 @@ setup_php() {
existing_version=$(get_brewed_php)
status="Found"
if [[ "$version" =~ ${old_versions:?} ]]; then
run_script "php5-darwin" "${version/./}"
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
status="Installed"
elif [ "${existing_version:0:3}" != "$version" ]; then
add_php "install" "$existing_version"
add_php "install" "$existing_version" >/dev/null 2>&1
status="Installed"
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
if [ "$brew_php_version" != "$existing_version" ]; then
add_php "upgrade" "$existing_version"
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Upgraded"
fi
fi

View File

@@ -50,7 +50,7 @@ enable_extension() {
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
enable_extension_dependencies "$1" "$2"
enable_cache_extension_dependencies "$1" "$2"
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod ; then
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
mod="${ini_dir:?}"/../mods-available/"$1".ini
if ! [ -e "$mod" ]; then
@@ -59,7 +59,7 @@ enable_extension() {
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
fi
sudo phpenmod -v "$version" "$1"
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
else
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
fi
@@ -71,7 +71,7 @@ enable_extensions() {
local extensions=("$@")
to_wait=()
for ext in "${extensions[@]}"; do
enable_extension "$ext" extension &
enable_extension "$ext" extension >/dev/null 2>&1 &
to_wait+=($!)
done
wait "${to_wait[@]}"
@@ -79,7 +79,7 @@ enable_extensions() {
# Function to get a map of extensions and their dependent shared extensions.
get_extension_map() {
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
}
# Function to enable extension dependencies which are also extensions.
@@ -125,7 +125,7 @@ disable_extension() {
disable_all_shared() {
get_extension_map
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
mkdir -p /tmp/extdisabled/"$version"
sudo rm -f /tmp/php"$version"_extensions
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
@@ -139,7 +139,7 @@ configure_pecl() {
for script in pear pecl; do
sudo "$script" channel-update "$script".php.net
done
echo '' | sudo tee /tmp/pecl_config
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
fi
}
@@ -177,8 +177,8 @@ get_pecl_version() {
pecl_install() {
local extension=$1
local prefix=${2:-extension}
add_pecl
disable_extension_helper "${extension%-*}"
add_pecl >/dev/null 2>&1
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
# Compare version with 8.3 so it runs only on 8.4 and above
# Install using the source interface as it allows for patching.
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
@@ -191,11 +191,11 @@ pecl_install() {
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension"
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension"
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
fi
local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
@@ -218,7 +218,7 @@ add_pecl_extension() {
add_log "${tick:?}" "$extension" "Enabled"
else
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" )
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1)
extension_version="$(php -r "echo phpversion('$extension');")"
[ -n "$extension_version" ] && extension_version="-$extension_version"
add_extension_log "$extension$extension_version" "Installed and enabled"

View File

@@ -19,11 +19,11 @@ add_blackfire() {
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
fi
fi
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
fi
if [ -e "${ext_dir:?}/blackfire.so" ]; then
disable_extension xdebug
disable_extension pcov
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
enable_extension blackfire extension
add_extension_log blackfire "$status"
else

View File

@@ -59,9 +59,9 @@ add_couchbase() {
ext=$(get_couchbase_version)
fi
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
add_couchbase_clibs "$ext"
add_couchbase_clibs "$ext" >/dev/null 2>&1
else
add_couchbase_cxxlibs
add_couchbase_cxxlibs >/dev/null 2>&1
fi
enable_extension "couchbase" "extension"
if check_extension "couchbase"; then
@@ -72,9 +72,9 @@ add_couchbase() {
n_proc="$(nproc)"
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
else
pecl_install "${ext}"
pecl_install "${ext}" >/dev/null 2>&1
fi
add_extension_log "couchbase" "Installed and enabled"
fi
@@ -93,6 +93,6 @@ add_couchbase() {
fi
add_brew_extension couchbase extension
find "${brew_prefix:?}/lib" "${brew_prefix:?}/opt/couchbase@${version:?}" "${brew_prefix:?}/Cellar/couchbase@${version:?}" \
-name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \;
-name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \; >/dev/null 2>&1
fi
}

View File

@@ -42,7 +42,7 @@ add_cubrid_helper() {
add_cubrid() {
ext=$1
status='Enabled'
add_cubrid_helper "$ext"
add_cubrid_helper "$ext" >/dev/null 2>&1
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}

View File

@@ -39,9 +39,9 @@ add_event() {
add_log "${tick:?}" "event" "Enabled"
else
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
add_brew_extension event extension
add_brew_extension event extension >/dev/null 2>&1
else
add_event_helper "$ext"
add_event_helper "$ext" >/dev/null 2>&1
fi
add_extension_log "event" "Installed and enabled"
fi

View File

@@ -15,12 +15,12 @@ add_firebird() {
else
if [ "$(uname -s)" = "Linux" ]; then
if [[ "${version:?}" =~ 5.3|${php_builder_versions:?} ]]; then
add_firebird_helper /usr
add_firebird_helper /usr >/dev/null 2>&1
else
add_pdo_extension firebird
add_pdo_extension firebird >/dev/null 2>&1
fi
else
add_brew_extension pdo_firebird extension
add_brew_extension pdo_firebird extension >/dev/null 2>&1
fi
add_extension_log pdo_firebird "Installed and enabled"
fi

View File

@@ -19,7 +19,7 @@ add_gearman_helper() {
add_gearman() {
status="Enabled"
if [ "$(uname -s)" = 'Linux' ]; then
add_gearman_helper
add_gearman_helper >/dev/null 2>&1
add_extension_log "gearman" "$status"
else
add_brew_extension gearman extension

View File

@@ -11,7 +11,7 @@ add_geos() {
if check_extension "geos"; then
add_log "${tick:?}" "geos" "Enabled"
else
add_geos_helper
add_geos_helper >/dev/null 2>&1
add_extension_log "geos" "Installed and enabled"
fi
}

View File

@@ -42,12 +42,12 @@ Function Repair-ICU() {
}
Function Add-Http() {
Add-Extension iconv
Add-Extension raphf
Add-Extension iconv >$null 2>&1
Add-Extension raphf >$null 2>&1
if($version -lt '8.0') {
Add-Extension propro
Add-Extension propro >$null 2>&1
}
Add-Extension pecl_http
Add-Extension pecl_http >$null 2>&1
Repair-ICU
Add-ExtensionLog http "Installed and enabled"
}

View File

@@ -75,7 +75,7 @@ add_http_latest() {
if [ "$os" = "Linux" ]; then
add_http_dependencies
package="php$version-http"
add_ppa ondrej/php || update_ppa ondrej/php
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
else
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
@@ -103,9 +103,9 @@ add_http() {
ext=$1
status="Enabled"
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
add_http_latest
add_http_latest >/dev/null 2>&1
else
add_http_version "$ext"
add_http_version "$ext" >/dev/null 2>&1
fi
add_extension_log "http" "$status"
}

View File

@@ -61,7 +61,7 @@ add_cli_driver() {
else
libs='/usr/local/lib'
sudo mkdir -p "$libs"
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" || true
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" >/dev/null 2>&1 || true
fi
}
@@ -93,11 +93,11 @@ add_ibm() {
status='Enabled'
ibm_home='/opt/ibm'
ibm_cli=$ibm_home/clidriver
if ! add_cli_driver ; then
if ! add_cli_driver >/dev/null 2>&1; then
add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
return 1
fi
add_ibm_helper
add_ibm_helper >/dev/null 2>&1
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}

View File

@@ -17,7 +17,7 @@ add_intl() {
add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
else
[ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu"
install_icu "$icu" >/dev/null 2>&1
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu"

View File

@@ -24,10 +24,10 @@ add_ioncube() {
if [ -e "$loader_file" ]; then
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
else
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
fi
add_extension_log "ioncube" "$status"
check_extension "ioncube" && add_license_log

View File

@@ -71,7 +71,7 @@ Function Add-Oci() {
}
} else {
$status = 'Installed and enabled'
Add-Extension $extension
Add-Extension $extension >$null 2>&1
}
Add-ExtensionLog $extension $status
Add-LicenseLog

View File

@@ -72,8 +72,8 @@ add_oci() {
oracle_home='/opt/oracle'
oracle_client=$oracle_home/instantclient
os=$(uname -s)
add_client
add_oci_helper
add_client >/dev/null 2>&1
add_oci_helper >/dev/null 2>&1
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}

View File

@@ -36,7 +36,7 @@ add_phalcon_helper() {
add_brew_extension "$extension" extension
else
package="php${version:?}-$extension"
add_ppa ondrej/php || update_ppa ondrej/php
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
fi
@@ -96,7 +96,7 @@ add_phalcon() {
[ "$extension" = "phalcon" ] && extension=phalcon5
extension_major_version=${extension: -1}
if [[ "$extension_major_version" =~ [3-5] ]]; then
add_phalcon"$extension_major_version"
add_phalcon"$extension_major_version" >/dev/null 2>&1
fi
add_extension_log "phalcon" "$status"
}

View File

@@ -145,14 +145,14 @@ add_relay() {
error="Relay extension is not available for macOS x86_64 architecture"
else
relay_version=$(get_relay_version "$ext")
add_relay_dependencies
add_relay_dependencies >/dev/null 2>&1
if shared_extension relay; then
message="Enabled"
else
add_relay_helper "$arch"
add_relay_helper "$arch" >/dev/null 2>&1
message="Installed and enabled ${relay_version}"
fi
configure_relay
configure_relay >/dev/null 2>&1
fi
add_extension_log relay "$message" "$error"
}

View File

@@ -51,7 +51,7 @@ check_lib() {
add_linux_libs() {
local lib=$1
if ! check_lib "$lib"; then
install_packages "$lib" || true
install_packages "$lib" >/dev/null 2>&1 || true
fi
add_lib_log "$lib"
}
@@ -61,10 +61,10 @@ add_darwin_libs() {
local lib=$1
if ! check_lib "$lib"; then
if [[ "$lib" = *@* ]]; then
safe_brew install --skip-link "$lib" || true
brew link --overwrite --force "$lib" || true
safe_brew install --skip-link "$lib" >/dev/null 2>&1 || true
brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
else
safe_brew install "$lib" || true
safe_brew install "$lib" >/dev/null 2>&1 || true
fi
fi
add_lib_log "$lib"
@@ -99,7 +99,7 @@ get_libraries() {
run_group() {
local command=$1
local log=$2
echo "$command" | sudo tee ./run_group.sh
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
echo "$GROUP$log"
. ./run_group.sh
local status=$?
@@ -163,7 +163,7 @@ add_extension_from_source() {
sub_dir="$(parse_args "$extension" PATH)"
step_log "Setup $slug"
(
add_devtools phpize
add_devtools phpize >/dev/null 2>&1
disable_extension_helper "$extension"
fetch_extension "$extension" "$fetch"
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
@@ -171,7 +171,7 @@ add_extension_from_source() {
else
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
patch_extension "$extension"
patch_extension "$extension" >/dev/null 2>&1
run_group "phpize" "phpize" && \
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make" && \

View File

@@ -69,10 +69,10 @@ Function Add-Sqlsrv() {
Add-ExtensionFromGithub $extension > $null 2>&1
} catch {}
if (-not(Test-Extension $extension)) {
Add-SqlsrvFromMSGithub $extension
Add-SqlsrvFromMSGithub $extension >$null 2>&1
}
if (-not(Test-Extension $extension)) {
Add-Extension $extension
Add-Extension $extension >$null 2>&1
}
$status = 'Installed and enabled'
}

View File

@@ -77,7 +77,7 @@ Function Add-ZephirParser() {
try {
Add-ZephirParserFromGitHub $extension
} catch {
Add-Extension $extension
Add-Extension $extension >$null 2>&1
}
}
Add-ExtensionLog zephir_parser $status

View File

@@ -33,7 +33,7 @@ add_zephir_parser() {
zp_releases=https://github.com/"$repo"/releases
if ! shared_extension zephir_parser; then
message='Installed and enabled'
add_zephir_parser_helper "$ext"
add_zephir_parser_helper "$ext" >/dev/null 2>&1
else
message='Enabled'
enable_extension zephir_parser extension

View File

@@ -20,23 +20,23 @@ self_hosted_helper() {
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
fi
sudo mkdir -p /opt/hostedtoolcache || true
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
}
# Function to fix broken packages.
fix_broken_packages() {
sudo apt --fix-broken install
sudo apt --fix-broken install >/dev/null 2>&1
}
# Function to install a package
install_packages() {
packages=("$@")
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
fi
$apt_install "${packages[@]}" || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" )
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
}
# Function to disable an extension.
@@ -48,10 +48,10 @@ disable_extension_helper() {
disable_extension_dependents "$extension"
fi
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
sudo rm -f /tmp/php"$version"_extensions
mkdir -p /tmp/extdisabled/"$version"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
}
# Function to add PDO extension.
@@ -64,7 +64,7 @@ add_pdo_extension() {
ext_name=$1
if shared_extension pdo; then
disable_extension_helper pdo
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}"
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
fi
if [ "$ext" = "mysql" ]; then
enable_extension "mysqlnd" "extension"
@@ -72,15 +72,15 @@ add_pdo_extension() {
elif [ "$ext" = "dblib" ]; then
ext_name="sybase"
elif [ "$ext" = "firebird" ]; then
install_packages libfbclient2
install_packages libfbclient2 >/dev/null 2>&1
enable_extension "pdo_firebird" "extension"
ext_name="interbase"
elif [ "$ext" = "sqlite" ]; then
ext="sqlite3"
ext_name="sqlite3"
fi
add_extension "$ext_name" "extension"
add_extension "$pdo_ext" "extension"
add_extension "$ext_name" "extension" >/dev/null 2>&1
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
add_extension_log "$pdo_ext" "Enabled"
fi
}
@@ -94,7 +94,7 @@ check_package() {
add_extension_helper() {
local extension=$1
packages=(php"$version"-"$extension")
add_ppa ondrej/php || update_ppa ondrej/php
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
add_extension_log "$extension" "Installed and enabled"
@@ -108,7 +108,7 @@ add_devtools() {
install_packages "php$version-dev"
fi
switch_version "phpize" "php-config"
add_extension xml extension
add_extension xml extension >/dev/null 2>&1
add_log "${tick:?}" "$tool" "Added $tool $semver"
}
@@ -159,7 +159,7 @@ register_alternative() {
fi
link="$(alternative_link "$tool")"
priority="${version//./}"
sudo update-alternatives --install "$link" "$tool" "$target" "$priority"
sudo update-alternatives --install "$link" "$tool" "$target" "$priority" >/dev/null 2>&1
}
# Function to register and switch an alternative.
@@ -169,16 +169,16 @@ set_alternative() {
target="$(alternative_target "$tool")"
[ -e "$target" ] || return 0
register_alternative "$tool" || return 1
sudo update-alternatives --set "$tool" "$target"
sudo update-alternatives --set "$tool" "$target" >/dev/null 2>&1
}
# Function to add PECL.
add_pecl() {
add_devtools phpize
add_devtools phpize >/dev/null 2>&1
if ! command -v pecl >/dev/null; then
install_packages php-pear
fi
configure_pecl
configure_pecl >/dev/null 2>&1
pear_version=$(get_tool_version "pecl" "version")
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
}
@@ -207,7 +207,7 @@ get_php_packages() {
# Function to install packaged PHP
add_packaged_php() {
add_ppa ondrej/php || update_ppa ondrej/php
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}"
}
@@ -231,7 +231,7 @@ add_php() {
setup_php_builder
else
add_packaged_php
switch_version
switch_version >/dev/null 2>&1
add_pecl
fi
elif [[ "$version" =~ ${old_versions:?} ]]; then
@@ -244,7 +244,7 @@ add_php() {
# Function to ini file for pear and link it to each SAPI.
link_pecl_file() {
echo '' | sudo tee "$pecl_file"
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
for file in "${ini_file[@]}"; do
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
@@ -277,9 +277,9 @@ add_php_config() {
elif [ "$ini" = "development" ]; then
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
elif [ "$ini" = "none" ]; then
echo '' | sudo tee "${ini_file[@]}"
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
fi
echo "$ini" | sudo tee "$current_ini"
echo "$ini" | sudo tee "$current_ini" >/dev/null 2>&1
}
# Function to Setup PHP
@@ -290,13 +290,13 @@ setup_php() {
check_pre_installed
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
add_php
add_php >/dev/null 2>&1
else
if ! [[ "$version" =~ ${old_versions:?} ]]; then
switch_version
switch_version >/dev/null 2>&1
fi
if [ "${update:?}" = "true" ]; then
update_php
update_php >/dev/null 2>&1
else
status="Switched to"
fi
@@ -304,7 +304,7 @@ setup_php() {
php_config="$(command -v php-config)"
else
if [ "$update" = "true" ]; then
update_php
update_php >/dev/null 2>&1
else
status="Found"
fi
@@ -324,7 +324,7 @@ setup_php() {
link_pecl_file
configure_php
set_output "php-version" "$semver"
sudo rm -rf /usr/local/bin/phpunit
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
@@ -338,8 +338,8 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
scripts="$src"/scripts
add_sudo
link_apt_fast
add_sudo >/dev/null 2>&1
link_apt_fast >/dev/null 2>&1
. /etc/os-release
# shellcheck source=.

View File

@@ -200,7 +200,7 @@ Function Add-ToolsHelper() {
$extensions += @('json', 'tokenizer')
} elseif($tool -eq "phpDocumentor") {
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
Add-Extension fileinfo
Add-Extension fileinfo >$null 2>&1
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
} elseif($tool -eq "phpunit") {
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
@@ -213,7 +213,7 @@ Function Add-ToolsHelper() {
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
}
foreach($extension in $extensions) {
Add-Extension $extension
Add-Extension $extension >$null 2>&1
}
}
@@ -286,7 +286,7 @@ Function Add-Tool() {
$bat_content += "php %BIN_TARGET% %*"
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
Add-ToolsHelper $tool
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat"
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat" >$null 2>&1
$tool_version = Get-ToolVersion $tool $ver_param
Add-Log $tick $tool "Added $tool $tool_version"
} else {
@@ -324,9 +324,9 @@ Function Add-ComposerToolHelper() {
Remove-Item -Path $composer_lock -Force
}
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
composer global config --no-plugins allow-plugins."$prefix$tool" true
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
}
composer global require $prefix$release $composer_args
composer global require $prefix$release $composer_args >$null 2>&1
return composer global show $prefix$tool 2>&1 | findstr '^versions'
} else {
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
@@ -337,9 +337,9 @@ Function Add-ComposerToolHelper() {
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
Set-Content -Path $scoped_dir\composer.json -Value "{}"
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
}
composer require $prefix$release -d $unix_scoped_dir $composer_args
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
}
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
Add-Path $scoped_dir\vendor\bin

View File

@@ -69,7 +69,7 @@ update_auth_json() {
# Function to check if public GitHub token authentication is possible.
can_access_public_github() {
curl --fail -s -H "Authorization: token $1" 'https://api.github.com/'
curl --fail -s -H "Authorization: token $1" 'https://api.github.com/' >/dev/null 2>&1
}
composer_gh_auth_no_op() {
@@ -127,7 +127,7 @@ set_composer_env() {
add_env_path "$composer_env"
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
composer global config --no-plugins "allow-plugins.$plugin" true
composer global config --no-plugins "allow-plugins.$plugin" true >/dev/null 2>&1
done
fi
}
@@ -192,7 +192,7 @@ add_tools_helper() {
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}" 2>/dev/null || true
fi
for extension in "${extensions[@]}"; do
add_extension "$extension" extension
add_extension "$extension" extension >/dev/null 2>&1
done
}
@@ -262,22 +262,22 @@ add_composer_tool_helper() {
enable_extensions curl mbstring openssl
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
if [ "$scope" = "global" ]; then
sudo rm -f "$composer_lock" || true
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
composer global config --no-plugins allow-plugins."$prefix$tool" true
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
fi
composer global require "$prefix$release" "$composer_args"
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
else
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
if ! [ -d "$scoped_dir" ]; then
mkdir -p "$scoped_dir"
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
fi
composer require "$prefix$release" -d "$scoped_dir" "$composer_args"
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
fi
add_path "$scoped_dir"/vendor/bin
fi

View File

@@ -6,14 +6,14 @@ Function Add-Blackfire() {
}
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
Get-File -Url $url -OutFile $bin_dir\blackfire.zip
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
}
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
}
Add-Log $tick "blackfire" "Added blackfire $cli_version"
}

View File

@@ -32,9 +32,9 @@ blackfire_config() {
# Function to add blackfire cli.
add_blackfire() {
os="$(uname -s)"
[ "$os" = "Linux" ] && add_blackfire_linux
[ "$os" = "Darwin" ] && add_blackfire_darwin
blackfire_config
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
blackfire_config >/dev/null 2>&1
tool_version=$(get_tool_version "blackfire" "version")
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
}

View File

@@ -14,11 +14,11 @@ add_brew_tap() {
tap=$1
if ! [ -d "$tap_dir/$tap" ]; then
if [ "${runner:?}" = "self-hosted" ]; then
brew tap "$tap"
brew tap "$tap" >/dev/null 2>&1
else
fetch_brew_tap "$tap"
fetch_brew_tap "$tap" >/dev/null 2>&1
if ! [ -d "$tap_dir/$tap" ]; then
brew tap "$tap"
brew tap "$tap" >/dev/null 2>&1
fi
fi
fi
@@ -59,12 +59,12 @@ terminate_process_tree() {
local pid=$1
local children child
children=$(pgrep -P "$pid" 2>/dev/null || true)
kill -TERM "$pid" || true
kill -TERM "$pid" >/dev/null 2>&1 || true
for child in $children; do
terminate_process_tree "$child"
done
sleep 2
kill -KILL "$pid" || true
kill -KILL "$pid" >/dev/null 2>&1 || true
for child in $children; do
terminate_process_tree "$child"
done
@@ -113,7 +113,7 @@ run_with_inactivity_watchdog() {
last_activity=$(get_file_mtime "$stdout_log")
current_err_activity=$(get_file_mtime "$stderr_log")
[ "$current_err_activity" -gt "$last_activity" ] && last_activity="$current_err_activity"
while kill -0 "$command_pid" ; do
while kill -0 "$command_pid" >/dev/null 2>&1; do
sleep "$poll_secs"
current_activity=$(get_file_mtime "$stdout_log")
[ "$current_activity" -gt "$last_activity" ] && last_activity="$current_activity"
@@ -134,7 +134,7 @@ run_with_inactivity_watchdog() {
exit_code=$?
wait "$stdout_reader_pid" 2>/dev/null || true
wait "$stderr_reader_pid" 2>/dev/null || true
kill "$monitor_pid" || true
kill "$monitor_pid" >/dev/null 2>&1 || true
wait "$monitor_pid" 2>/dev/null || true
if [ -e "$timeout_file" ]; then
@@ -178,7 +178,7 @@ add_brew() {
brew_prefix="$(get_brew_prefix)"
if ! [ -d "$brew_prefix"/bin ]; then
step_log "Setup Brew"
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/main/install.sh" | bash -s
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/main/install.sh" | bash -s >/dev/null 2>&1
add_log "${tick:?}" "Brew" "Installed Homebrew"
fi
add_brew_bins_to_path "$brew_prefix"

View File

@@ -1,7 +1,7 @@
Function Add-Msys2() {
$msys_location = 'C:\msys64'
if (-not(Test-Path $msys_location)) {
choco install msys2 -y
choco install msys2 -y >$null 2>&1
$msys_location = 'C:\tools\msys64'
}
return $msys_location
@@ -15,7 +15,7 @@ Function Add-GrpcPhpPlugin() {
} else {
$grpc_package = 'mingw-w64-x86_64-grpc'
}
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package"
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
Add-Path $msys_location\mingw64\bin
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"

View File

@@ -26,7 +26,7 @@ add_grpc_php_plugin_brew() {
configure_brew
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
safe_brew install grpc
brew link --force --overwrite grpc
brew link --force --overwrite grpc >/dev/null 2>&1
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
license_path="$(brew --prefix grpc)/LICENSE"
@@ -50,9 +50,9 @@ add_grpc_php_plugin() {
grpc_tag=$1
license_path=""
if [ "$grpc_tag" = "latest" ]; then
add_grpc_php_plugin_brew
add_grpc_php_plugin_brew >/dev/null 2>&1
else
add_grpc_php_plugin_compile
add_grpc_php_plugin_compile >/dev/null 2>&1
fi
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"

View File

@@ -28,8 +28,8 @@ Function Add-Mago() {
$arch_name = 'i686'
}
$url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
Get-File -Url $url -OutFile $bin_dir\mago.zip
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force
Get-File -Url $url -OutFile $bin_dir\mago.zip >$null 2>&1
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force >$null 2>&1
Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
Add-Log $tick "mago" "Added mago $mago_tag"

View File

@@ -24,6 +24,6 @@ add_mago() {
sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
sudo chmod +x /usr/local/bin/mago
)
) >/dev/null 2>&1
add_log "${tick:?}" "mago" "Added mago $mago_tag"
}

View File

@@ -31,7 +31,7 @@ set_base_version() {
else
set_base_version_codename
set_base_version_id
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
fi
}
@@ -70,8 +70,8 @@ update_lists() {
list="$list_file"
fi
if [ ! -e "$status_file" ]; then
update_lists_helper "$list"
echo '' | tee "$status_file"
update_lists_helper "$list" >/dev/null 2>&1
echo '' | tee "$status_file" >/dev/null 2>&1
fi
}
@@ -186,7 +186,7 @@ add_key() {
key_urls+=("$ppa_sp/keys/$ppa.gpg")
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
sudo gpg --batch --yes --dearmor "$key_file" && sudo mv "$key_file".gpg "$key_file"
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
fi
}
@@ -230,7 +230,7 @@ Architectures: $arch
Signed-By: $key_file
EOF
else
echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list
echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list >/dev/null 2>&1
fi
}

View File

@@ -29,8 +29,8 @@ Function Add-Protoc() {
$arch_num = '32'
}
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
Get-File -Url $url -OutFile $bin_dir\protoc.zip
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"

View File

@@ -22,7 +22,7 @@ add_protoc() {
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
sudo unzip /tmp/protobuf.zip -d /usr/local/
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
)
) >/dev/null 2>&1
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE

View File

@@ -31,7 +31,7 @@ add_symfony() {
if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
else
add_symfony_helper "$symfony_tag"
add_symfony_helper "$symfony_tag" >/dev/null 2>&1
symfony_path="$(command -v symfony)"
if [[ -n "$symfony_path" ]]; then
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli

View File

@@ -44,7 +44,7 @@ set_output() {
name=$1
value=$2
if [ "${GITHUB_ACTIONS}" = "true" ]; then
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT"
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT" >/dev/null 2>&1
fi
}
@@ -70,7 +70,7 @@ read_env() {
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
if ! check_ppa ondrej/php; then
update=true
echo '' | sudo tee /tmp/sp_update
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
elif [ -e /tmp/sp_update ]; then
update=true
fi
@@ -94,7 +94,7 @@ acquire_lock() {
else
if sudo test -f "$lock_path/pid"; then
lock_pid=$(sudo cat "$lock_path/pid")
if ! ps -p "$lock_pid" ; then
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
sudo rm -rf "$lock_path"
continue
fi
@@ -178,7 +178,7 @@ add_path() {
printf '%s\n%s' "$path_to_add" "$(grep -v "^${path_to_add}$" "$GITHUB_PATH" 2>/dev/null)" > "$GITHUB_PATH"
else
profile=$(get_shell_profile)
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile"
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile" >/dev/null 2>&1
fi
[[ ":$PATH:" == *":$path_to_add:"* ]] || export PATH="${PATH:+${PATH}:}$path_to_add"
}
@@ -200,10 +200,10 @@ add_env() {
env_name=$1
env_value=$2
if [[ -n "$GITHUB_ENV" ]]; then
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV"
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV" >/dev/null 2>&1
else
profile=$(get_shell_profile)
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile"
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile" >/dev/null 2>&1
fi
export "$env_name"="$env_value"
}
@@ -224,7 +224,7 @@ self_hosted_setup() {
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
exit 1
else
self_hosted_helper
self_hosted_helper >/dev/null 2>&1
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
fi
fi
@@ -252,8 +252,8 @@ configure_php() {
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
jit_config_files=("$jit_ini")
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}"
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}"
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
}
# Function to get PHP version in semver format.

View File

@@ -360,7 +360,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
$bin_dir = 'C:\tools\bin'
$php_dir = "$php_dir$version"
$ext_dir = "$php_dir\ext"
Get-CleanPSProfile
Get-CleanPSProfile >$null 2>&1
New-Item $bin_dir -Type Directory -Force > $null 2>&1
Add-Path -PathItem $bin_dir
if($version -lt 5.6) {
@@ -373,12 +373,12 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
}
New-Item $php_dir -Type Directory -Force > $null 2>&1
Add-Path -PathItem $php_dir
setx PHPROOT $php_dir
setx PHPROOT $php_dir >$null 2>&1
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
} else {
$current_profile = "$PSHOME\Profile.ps1"
if(-not(Test-Path -LiteralPath $current_profile)) {
New-Item -Path $current_profile -ItemType "file" -Force
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
}
Add-Path -PathItem $bin_dir -Force
}
@@ -387,9 +387,9 @@ $src = Join-Path -Path $PSScriptRoot -ChildPath \..
. $src\scripts\tools\add_tools.ps1
. $src\scripts\extensions\add_extensions.ps1
Add-Printf
Add-Printf >$null 2>&1
Step-Log "Setup PhpManager"
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
Add-Log $tick "PhpManager" "Installed"
Step-Log "Setup PHP"
@@ -418,7 +418,7 @@ if($version -eq 'pre') {
}
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
}
try {
if ($version -match $nightly_versions) {
@@ -431,7 +431,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
} catch { }
} else {
if($env:update -eq 'true') {
Update-Php $php_dir
Update-Php $php_dir >$null 2>&1
$status = "Updated to"
} else {
$status = "Found"
@@ -449,7 +449,7 @@ if($installed.MajorMinorVersion -ne $version) {
Write-Error "Could not setup PHP $version" -ErrorAction Stop
}
if($version -lt "5.5") {
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ }
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
} elseif($version -lt "8.5") {
$enable_extensions += ('opcache')
}

View File

@@ -9,16 +9,19 @@ import * as fetch from './fetch';
* @param property
*/
export async function readEnv(property: string): Promise<string> {
if (!/^[A-Za-z0-9_-]+$/.test(property)) {
return '';
}
const property_lc: string = property.toLowerCase();
const property_uc: string = property.toUpperCase();
return (
process.env[property] ||
process.env[property_lc] ||
process.env[property_uc] ||
process.env[property_lc.replace('_', '-')] ||
process.env[property_uc.replace('_', '-')] ||
''
);
const candidates = [
property,
property_lc,
property_uc,
property_lc.replace('_', '-'),
property_uc.replace('_', '-')
].filter((value, index, array) => array.indexOf(value) === index);
return candidates.map(name => process.env[name] || '').find(Boolean) || '';
}
/**
@@ -320,10 +323,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
export async function suppressOutput(os: string): Promise<string> {
switch (os) {
case 'win32':
return ' ';
return ' >$null 2>&1';
case 'linux':
case 'darwin':
return ' ';
return ' >/dev/null 2>&1';
default:
return await log('Platform ' + os + ' is not supported', os, 'error');
}