Fix extension setup

This commit is contained in:
Shivam Mathur 2021-06-04 21:23:57 +05:30
parent 86e1ccdd8d
commit b2f833f7d1
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 7710 additions and 10 deletions

2
dist/index.js vendored
View File

@ -1119,7 +1119,7 @@ exports.fetch = fetch;
* @param version
*/
async function parseVersion(version) {
const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json';
const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
switch (true) {
case /latest|\d.x/.test(version):
return JSON.parse(await fetch(manifest))[version];

7705
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -105,9 +105,8 @@ check_extension() {
# Function to enable existing extensions.
enable_extension() {
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
fi
modules_dir="/var/lib/php/modules/$version"
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
fi

View File

@ -58,9 +58,7 @@ delete_extension() {
extension=$1
disable_extension "$extension"
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
if [ "${runner:?}" = "self-hosted" ]; then
$apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true
fi
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
}
# Function to disable and delete extensions.
@ -69,7 +67,6 @@ remove_extension() {
if check_extension "$extension"; then
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
fi
delete_extension "$extension"
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||

View File

@ -67,7 +67,8 @@ export async function fetch(url: string): Promise<string> {
* @param version
*/
export async function parseVersion(version: string): Promise<string> {
const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json';
const manifest =
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
switch (true) {
case /latest|\d.x/.test(version):
return JSON.parse(await fetch(manifest))[version];