Repository navigation
Expand file tree
/
Copy pathdownloads-get-instructions.php
More file actions
87 lines (76 loc) · 2.27 KB
/
Copy pathdownloads-get-instructions.php
File metadata and controls
87 lines (76 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
$file = 'unknown';
$latestPhpVersion = '8.4';
if (!isset($options)) {
$options = [
'os' => '',
'usage' => '',
'version' => '',
];
}
if ($options['os'] === 'windows') {
if ($options['osvariant'] === 'windows-wsl-debian') {
$options['os'] = 'linux';
$options['osvariant'] = 'linux-debian';
}
if ($options['osvariant'] === 'windows-wsl-ubuntu') {
$options['os'] = 'linux';
$options['osvariant'] = 'linux-ubuntu';
}
}
if ($options['os'] === 'osx' || $options['os'] === 'windows') {
if ($options['version'] === 'default') {
$options['version'] = $latestPhpVersion;
}
}
if (in_array($options['usage'], ['fw-drupal', 'fw-laravel', 'fw-symfony', 'fw-wordpress', 'fw-joomla'])) {
$file = "{$options['usage']}";
$options['os'] = null;
}
$multiversion = false;
if (array_key_exists('multiversion', $options)) {
$multiversion = $options['multiversion'] === 'Y';
}
$source = false;
if (array_key_exists('source', $options)) {
if ($options['source'] === 'Y') {
$source = $options['source'] === 'Y';
}
}
switch ($options['os']) {
case 'linux':
$defaultOrCommunity = ($options['version'] !== 'default' || $multiversion) ? 'community' : 'default';
if ($defaultOrCommunity === 'community' && $options['version'] == 'default') {
$options['version'] = $latestPhpVersion;
}
$file = "{$options['osvariant']}-{$options['usage']}-{$defaultOrCommunity}";
break;
case 'osx':
case 'windows':
if($options['osvariant'] === "{$options['os']}-docker") {
$file = "{$options['osvariant']}-{$options['usage']}";
} else {
$file = "{$options['osvariant']}";
}
break;
}
if ($source) {
$file = "{$options['os']}-source";
}
$version = $options['version'];
$versionNoDot = str_replace('.', '', $version);
if (file_exists(__DIR__ . "/include/download-instructions/{$file}.php")) {
include __DIR__ . "/include/download-instructions/{$file}.php";
if ($source) {
return false;
}
return true;
} else {
?>
<p>
There are no instructions yet. Try using the <a href="https://www.php.net/manual/en/install.php">generic installation from source</a>.
</p>
<?php
return false;
}
?>