-
Notifications
You must be signed in to change notification settings - Fork 562
First stab at a prototype for revamping the download instructions page #1277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
derickr
wants to merge
1
commit into
php:master
Choose a base branch
from
derickr:redesign-downloads-page-prototype
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,97 @@ | ||
<?php | ||
if ($_GET['os'] === 'windows' && $_GET['osvariant'] === 'windows-wsl') { | ||
$_GET['os'] = 'linux'; | ||
$_GET['osvariant'] = 'linux-deb-bookworm'; | ||
$_GET['multiversion'] = 'true'; | ||
} | ||
if ($_GET['os'] === 'osx') { | ||
$version = match($_GET['version']) { | ||
'php84' => '@8.4', | ||
'php83' => '@8.3', | ||
'php82' => '@8.2', | ||
'php81' => '@8.1', | ||
default => '' | ||
}; | ||
|
||
$versionDir = match($_GET['version']) { | ||
'php84' => '8.4', | ||
'php83' => '8.3', | ||
'php82' => '8.2', | ||
'php81' => '8.1', | ||
default => '8.4' | ||
}; | ||
|
||
echo <<<ENDOSX | ||
<p> | ||
On the OSX command line shell, enter: | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
brew install php{$version} | ||
</pre></div></div> | ||
<p> | ||
To enable PHP in Apache add the following to httpd.conf and restart Apache: | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
LoadModule php_module \$HOMEBREW_PREFIX/opt/php/lib/httpd/modules/libphp.so | ||
|
||
<FilesMatch \.php$> | ||
SetHandler application/x-httpd-php | ||
</FilesMatch> | ||
</pre></div></div> | ||
<p> | ||
Finally, check DirectoryIndex includes index.php | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
DirectoryIndex index.php index.html | ||
</pre></div></div> | ||
<p> | ||
The php.ini and php-fpm.ini file can be found in: | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
\$HOMEBREW_PREFIX/etc/php/{$versionDir}/ | ||
</pre></div></div> | ||
</p> | ||
ENDOSX; | ||
return; | ||
} | ||
?> | ||
<?php | ||
if ($_GET['os'] === 'linux' && str_starts_with($_GET['osvariant'], 'linux-deb')) { | ||
if ($_GET['version'] === 'default' && $_GET['multiversion'] != 'true') { | ||
echo <<<ENDAPT | ||
<p> | ||
On the command line shell, enter: | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
sudo apt-get update | ||
sudo apt-get install php | ||
</pre></div></div> | ||
ENDAPT; | ||
} else { | ||
$version = match($_GET['version']) { | ||
'php84' => '8.4', | ||
'php83' => '8.3', | ||
'php82' => '8.2', | ||
'php81' => '8.1', | ||
default => '8.4' | ||
}; | ||
echo <<<ENDAPT | ||
<p> | ||
On the command line shell, enter: | ||
</p> | ||
<div class="example"><div class="example-contents screen"><pre> | ||
sudo apt -y install software-properties-common | ||
sudo add-apt-repository ppa:ondrej/php | ||
sudo apt update | ||
sudo apt install php{$version} | ||
</pre></div></div> | ||
ENDAPT; | ||
} | ||
return; | ||
} | ||
?> | ||
<p> | ||
There are no instructions yet. | ||
</p> | ||
|
||
<?php var_dump($_GET); ?> |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,60 @@ | ||
function setSelectBoxes() { | ||
let instructionsDiv = document.getElementById("instructions") | ||
let osSelector = document.getElementById("os") | ||
let variantSelector = document.getElementById("osvariant") | ||
let usageSelector = document.getElementById("usage") | ||
let versionSelector = document.getElementById("version") | ||
let multiversionBox = document.getElementById("multiversion") | ||
|
||
const url = '/downloads-get-instructions.php' + | ||
'?os=' + osSelector.options[osSelector.selectedIndex].value + | ||
'&osvariant=' + variantSelector.options[variantSelector.selectedIndex].value + | ||
'&usage=' + usageSelector.options[usageSelector.selectedIndex].value + | ||
'&version=' + versionSelector.options[versionSelector.selectedIndex].value + | ||
'&multiversion=' + multiversionBox.checked | ||
|
||
fetch(url) | ||
.then(response => { | ||
if (response.ok) { | ||
return response.text() | ||
} else { | ||
throw new Error("Couldn't fetch instructions"); | ||
} | ||
}) | ||
.then(data => { | ||
instructionsDiv.innerHTML = data | ||
}) | ||
.catch(error => console.error("Couldn't fetch instructions: ", error)); | ||
} | ||
|
||
function setSelectOsBoxes() { | ||
let osSelector = document.getElementById("os") | ||
let variantSelector = document.getElementById("osvariant") | ||
|
||
for (var i = variantSelector.length - 1; i >= 0; i--) { | ||
if (!variantSelector.options[i].value.startsWith(osSelector.options[osSelector.selectedIndex].value + "-")) { | ||
variantSelector.options[i].disabled = true | ||
} else { | ||
variantSelector.options[i].disabled = false | ||
variantSelector.selectedIndex = i | ||
} | ||
} | ||
|
||
setSelectBoxes(); | ||
} | ||
|
||
window.onload = function() { | ||
let osSelector = document.getElementById("os") | ||
let variantSelector = document.getElementById("osvariant") | ||
let usageSelector = document.getElementById("usage") | ||
let versionSelector = document.getElementById("version") | ||
let multiversionBox = document.getElementById("multiversion") | ||
|
||
osSelector.addEventListener("change", setSelectOsBoxes) | ||
variantSelector.addEventListener("change", setSelectBoxes) | ||
usageSelector.addEventListener("change", setSelectBoxes) | ||
versionSelector.addEventListener("change", setSelectBoxes) | ||
multiversionBox.addEventListener("change", setSelectBoxes) | ||
|
||
setSelectOsBoxes() | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using PPAs is Ubuntu-specific. For Debian the repository should be set up as per: https://packages.sury.org/php/README.txt