1
|
|
|
<!DOCTYPE html> |
2
|
|
|
<html> |
3
|
|
|
<head> |
4
|
|
|
<title>SSPkS Selftest</title> |
5
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
6
|
|
|
<link rel="stylesheet" href="data/css/style.css" type="text/css" /> |
7
|
|
|
<link rel="stylesheet" href="data/css/style_mobile.css" type="text/css" media="handheld"/> |
8
|
|
|
<!-- Colours from: https://www.materialui.co/colors --> |
9
|
|
|
<style type="text/css"> |
10
|
|
|
.check { |
11
|
|
|
width: 80%; |
12
|
|
|
background-color: #cfd8dc; |
13
|
|
|
vertical-align: middle; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
.check .checkline { |
17
|
|
|
height: 3em; |
18
|
|
|
position: relative; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
.check .description { |
22
|
|
|
height: 3em; |
23
|
|
|
line-height: 3em; |
24
|
|
|
margin-left: 2em; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
.check .description span { |
28
|
|
|
display: inline-block; |
29
|
|
|
line-height: 1em; |
30
|
|
|
vertical-align: middle; |
31
|
|
|
font-weight: bold; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
.checkline .result { |
35
|
|
|
position: absolute; |
36
|
|
|
right: 0px; |
37
|
|
|
bottom: 0px; |
38
|
|
|
height: 3em; |
39
|
|
|
line-height: 3em; |
40
|
|
|
width: 3em; |
41
|
|
|
text-align: center; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
.checkline .result span { |
45
|
|
|
display: inline-block; |
46
|
|
|
line-height: 1em; |
47
|
|
|
vertical-align: middle; |
48
|
|
|
font-size: 2.5em; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
.ok { |
52
|
|
|
background-color: #4caf50; |
53
|
|
|
color: white; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
.error { |
57
|
|
|
background-color: #d50000; |
58
|
|
|
color: white; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
.errortext { |
62
|
|
|
margin-left: 1em; |
63
|
|
|
padding-left: 1em; |
64
|
|
|
margin-right: 4em; |
65
|
|
|
margin-top: 0.3em; |
66
|
|
|
padding-top: 0.3em; |
67
|
|
|
padding-bottom: 0.3em; |
68
|
|
|
background-color: #ffcdd2; |
69
|
|
|
} |
70
|
|
|
</style> |
71
|
|
|
</head> |
72
|
|
|
<body> |
73
|
|
|
<h1>SSPkS Selftest</h1> |
74
|
|
|
<p> |
75
|
|
|
<?php |
76
|
|
|
|
77
|
|
|
function assertTrue($assertion, $description, $error_text) |
78
|
|
|
{ |
79
|
|
|
echo('<div class="check">'); |
80
|
|
|
echo('<div class="checkline">'); |
81
|
|
|
echo('<div class="description"><span>' . $description . '</span></div>'); |
82
|
|
|
if ($assertion === true) { |
83
|
|
|
// All OK |
84
|
|
|
echo('<div class="result ok"><span>✔</span></div>'); |
85
|
|
|
echo('</div>'); // close checkline |
86
|
|
|
} else { |
87
|
|
|
// Not OK |
88
|
|
|
echo('<div class="result error"><span>✖</span></div>'); |
89
|
|
|
echo('</div>'); // close checkline |
90
|
|
|
echo('<div class="errortext">' . $error_text . '</div>'); |
91
|
|
|
} |
92
|
|
|
echo('</div>'); |
93
|
|
|
echo('<br/>'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
assertTrue( |
98
|
|
|
version_compare(phpversion(), '5.6', '>='), |
99
|
|
|
'PHP Version (' . phpversion() . ')', |
100
|
|
|
'Please use a more recent PHP version for optimal performance. PHP 7 preferred.' |
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
assertTrue( |
104
|
|
|
extension_loaded('phar'), |
105
|
|
|
'Phar extension installed', |
106
|
|
|
'Please install/enable the <tt>php-phar</tt> extension.' |
107
|
|
|
); |
108
|
|
|
|
109
|
|
|
assertTrue( |
110
|
|
|
is_dir(dirname(__FILE__) . '/vendor'), |
111
|
|
|
'Composer <tt>vendor</tt> directory exists', |
112
|
|
|
'Please download and run Composer according to the <tt>INSTALL.md</tt>.' |
113
|
|
|
); |
114
|
|
|
|
115
|
|
|
assertTrue( |
116
|
|
|
file_exists(dirname(__FILE__) . '/vendor/autoload.php'), |
117
|
|
|
'Composer <tt>vendor/autoload.php</tt> was generated', |
118
|
|
|
'Please download and run Composer according to the <tt>INSTALL.md</tt>.' |
119
|
|
|
); |
120
|
|
|
|
121
|
|
|
assertTrue( |
122
|
|
|
is_dir(sys_get_temp_dir()), |
123
|
|
|
'System temporary directory (' . sys_get_temp_dir() . ') exists.', |
124
|
|
|
'Make sure your temporary directory exists and is writeable and your environment variables (<tt>TMP</tt>, <tt>TEMP</tt>) are set or set <tt>sys_temp_dir</tt> in your <tt>php.ini</tt>.' |
125
|
|
|
); |
126
|
|
|
|
127
|
|
|
assertTrue( |
128
|
|
|
is_writeable(sys_get_temp_dir()), |
129
|
|
|
'System temporary directory (' . sys_get_temp_dir() . ') is writeable.', |
130
|
|
|
'Make sure your temporary directory is writeable for the web server process.' |
131
|
|
|
); |
132
|
|
|
|
133
|
|
|
// NOTE: (From PHP doc:) A boolean ini value of _off_ will be returned as an empty |
134
|
|
|
// string or "0" while a boolean ini value of _on_ will be returned as "1". |
135
|
|
|
// The function can also return the literal string of INI value. |
136
|
|
|
assertTrue( |
137
|
|
|
(boolval(ini_get('allow_url_fopen')) === true), |
138
|
|
|
'Using URLs in <tt>fopen()</tt> is allowed', |
139
|
|
|
'Please set <tt>allow_url_fopen</tt> to <tt>true</tt> in your <tt>php.ini</tt>.' |
140
|
|
|
); |
141
|
|
|
|
142
|
|
|
assertTrue( |
143
|
|
|
is_writable(dirname(__FILE__) . '/cache/'), |
144
|
|
|
'Directory <tt>cache/</tt> writeable', |
145
|
|
|
'Please make the <tt>cache/</tt> directory writeable for the web server process.' |
146
|
|
|
); |
147
|
|
|
|
148
|
|
|
$test_file = dirname(__FILE__) . '/cache/testfile.$$$'; |
149
|
|
|
|
150
|
|
|
assertTrue( |
151
|
|
|
(file_put_contents($test_file, 'TestData12345678') === 16), |
152
|
|
|
'Can write testfile to <tt>cache/</tt> directory', |
153
|
|
|
'Please make the <tt>cache/</tt> directory writeable for the web server process.' |
154
|
|
|
); |
155
|
|
|
|
156
|
|
|
assertTrue( |
157
|
|
|
unlink($test_file), |
158
|
|
|
'Can remove testfile from <tt>cache/</tt> directory', |
159
|
|
|
'Please make the <tt>cache/</tt> directory writeable for the web server process (also allow deletions).' |
160
|
|
|
); |
161
|
|
|
|
162
|
|
|
/* |
163
|
|
|
assertTrue( |
164
|
|
|
false, |
165
|
|
|
'This is to see how a failed test looks like.', |
166
|
|
|
'Don\'t panic. This is only here during development.' |
167
|
|
|
); |
168
|
|
|
*/ |
169
|
|
|
|
170
|
|
|
?> |
171
|
|
|
</body> |
172
|
|
|
</html> |
173
|
|
|
|