forked from pmmp/PocketMine-MP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
@echo off | ||
set "url=https://github.com/pmmp/PHP-Binaries/releases/download/php-8.2-latest/PHP-Windows-x64-PM5.zip" | ||
set "zipfile=PHP-Windows-x64-PM5.zip" | ||
set "binfolder=bin" | ||
set "phpfolder=%binfolder%\php" | ||
set "composerUrl=https://getcomposer.org/download/latest-stable/composer.phar" | ||
set "composerfile=composer.phar" | ||
set "vcredist=vc_redist.x64.exe" | ||
|
||
if exist %binfolder% ( | ||
echo Removing existing bin folder... | ||
rmdir /S /Q "%binfolder%" | ||
echo Bin folder removed. | ||
) | ||
|
||
echo Downloading PHP binaries... | ||
curl -L -o "%zipfile%" "%url%" | ||
|
||
if exist "%zipfile%" ( | ||
echo Download complete. Extracting bin folder... | ||
powershell -command "Expand-Archive -Path '%cd%\%zipfile%' -DestinationPath '%cd%'" | ||
|
||
if exist "%binfolder%" ( | ||
echo Extraction successful. | ||
|
||
echo Downloading Composer... | ||
curl -L -o "%binfolder%\%composerfile%" "%composerUrl%" | ||
|
||
if exist "%binfolder%\%composerfile%" ( | ||
echo Composer downloaded successfully to %binfolder%. | ||
|
||
echo Running composer install... | ||
"%phpfolder%\php.exe" "%binfolder%\composer.phar" install | ||
|
||
if !errorlevel! equ 0 ( | ||
echo Composer install completed successfully. | ||
) else ( | ||
echo Error : Composer install failed. | ||
) | ||
) else ( | ||
echo Error: Failed to download Composer. | ||
) | ||
|
||
if exist "%vcredist%" ( | ||
echo Removing %vcredist%... | ||
del "%vcredist%" | ||
echo %vcredist% removed. | ||
) else ( | ||
echo %vcredist% not found, skipping removal. | ||
) | ||
|
||
if exist "%zipfile%" ( | ||
echo Removing %zipfile%... | ||
del "%zipfile%" | ||
echo %zipfile% removed. | ||
) else ( | ||
echo %zipfile% not found, skipping removal. | ||
) | ||
|
||
git fetch | ||
|
||
git checkout stable | ||
) else ( | ||
echo Error: Bin folder not found. | ||
) | ||
) else ( | ||
echo Error: Failed to download the file. | ||
) | ||
|
||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
$url = "https://github.com/pmmp/PHP-Binaries/releases/download/php-8.2-latest/PHP-Windows-x64-PM5.zip" | ||
$zipfile = "PHP-Windows-x64-PM5.zip" | ||
$binfolder = "bin" | ||
$phpfolder = "$binfolder\php" | ||
$composerUrl = "https://getcomposer.org/download/latest-stable/composer.phar" | ||
$composerfile = "composer.phar" | ||
$vcredist = "vc_redist.x64.exe" | ||
|
||
if (Test-Path $binfolder) { | ||
Write-Host "Removing existing bin folder..." | ||
Remove-Item -Recurse -Force $binfolder | ||
Write-Host "Bin folder removed." | ||
} | ||
|
||
Write-Host "Downloading PHP binaries..." | ||
Invoke-WebRequest -Uri $url -OutFile $zipfile | ||
|
||
if (Test-Path $zipfile) { | ||
Write-Host "Download complete. Extracting bin folder..." | ||
Expand-Archive -Path $zipfile -DestinationPath $PWD | ||
|
||
if (Test-Path $binfolder) { | ||
Write-Host "Extraction successful." | ||
|
||
Write-Host "Downloading Composer..." | ||
Invoke-WebRequest -Uri $composerUrl -OutFile "$binfolder\$composerfile" | ||
|
||
if (Test-Path "$binfolder\$composerfile") { | ||
Write-Host "Composer downloaded successfully to $binfolder." | ||
|
||
Write-Host "Running composer install..." | ||
& "$phpfolder\php.exe" "$binfolder\$composerfile" install | ||
|
||
if ($LASTEXITCODE -eq 0) { | ||
Write-Host "Composer install completed successfully." | ||
} else { | ||
Write-Host "Error: Composer install failed." | ||
} | ||
} else { | ||
Write-Host "Error: Failed to download Composer." | ||
} | ||
|
||
if (Test-Path $vcredist) { | ||
Write-Host "Removing $vcredist..." | ||
Remove-Item $vcredist | ||
Write-Host "$vcredist removed." | ||
} else { | ||
Write-Host "$vcredist not found, skipping removal." | ||
} | ||
|
||
if (Test-Path $zipfile) { | ||
Write-Host "Removing $zipfile..." | ||
Remove-Item $zipfile | ||
Write-Host "$zipfile removed." | ||
} else { | ||
Write-Host "$zipfile not found, skipping removal." | ||
} | ||
|
||
Write-Host "Running git fetch..." | ||
git fetch | ||
Write-Host "Checking out stable branch..." | ||
git checkout stable | ||
} else { | ||
Write-Host "Error: Bin folder not found." | ||
} | ||
} else { | ||
Write-Host "Error: Failed to download the file." | ||
} | ||
|
||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
url="https://github.com/pmmp/PHP-Binaries/releases/download/php-8.2-latest/PHP-Windows-x64-PM5.zip" | ||
zipfile="PHP-Windows-x64-PM5.zip" | ||
binfolder="bin" | ||
phpfolder="$binfolder/php" | ||
composerUrl="https://getcomposer.org/download/latest-stable/composer.phar" | ||
composerfile="composer.phar" | ||
vcredist="vc_redist.x64.exe" | ||
|
||
if [ -d "$binfolder" ]; then | ||
echo "Removing existing bin folder..." | ||
rm -rf "$binfolder" | ||
echo "Bin folder removed." | ||
fi | ||
|
||
echo "Downloading PHP binaries..." | ||
curl -L -o "$zipfile" "$url" | ||
|
||
if [ -f "$zipfile" ]; then | ||
echo "Download complete. Extracting bin folder..." | ||
unzip -o "$zipfile" -d . | ||
|
||
if [ -d "$binfolder" ]; then | ||
echo "Extraction successful." | ||
|
||
echo "Downloading Composer..." | ||
curl -L -o "$binfolder/$composerfile" "$composerUrl" | ||
|
||
if [ -f "$binfolder/$composerfile" ]; then | ||
echo "Composer downloaded successfully to $binfolder." | ||
|
||
echo "Running composer install..." | ||
"$phpfolder/php" "$binfolder/$composerfile" install | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Composer install completed successfully." | ||
else | ||
echo "Error: Composer install failed." | ||
fi | ||
else | ||
echo "Error: Failed to download Composer." | ||
fi | ||
|
||
if [ -f "$vcredist" ]; then | ||
echo "Removing $vcredist..." | ||
rm "$vcredist" | ||
echo "$vcredist removed." | ||
else | ||
echo "$vcredist not found, skipping removal." | ||
fi | ||
|
||
if [ -f "$zipfile" ]; then | ||
echo "Removing $zipfile..." | ||
rm "$zipfile" | ||
echo "$zipfile removed." | ||
else | ||
echo "$zipfile not found, skipping removal." | ||
fi | ||
|
||
echo "Running git fetch..." | ||
git fetch | ||
echo "Checking out stable branch..." | ||
git checkout stable | ||
else | ||
echo "Error: Bin folder not found." | ||
fi | ||
else | ||
echo "Error: Failed to download the file." | ||
fi |