forked from zecure/shadowd_ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.php
executable file
·62 lines (48 loc) · 1.75 KB
/
check.php
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
<?php
require_once dirname(__FILE__).'/SymfonyRequirements.php';
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo "********************************\n";
echo "* *\n";
echo "* Symfony requirements check *\n";
echo "* *\n";
echo "********************************\n\n";
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
echo "** ATTENTION **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR) {
echo "* (especially on the Windows platform)\n";
}
echo "* To be on the safe side, please also launch the requirements check\n";
echo "* from your web server using the web/config.php script.\n";
echo_title('Mandatory requirements');
$checkPassed = true;
foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
echo_requirement($req);
if (!$req->isFulfilled()) {
$checkPassed = false;
}
}
echo_title('Optional recommendations');
foreach ($symfonyRequirements->getRecommendations() as $req) {
echo_requirement($req);
}
exit($checkPassed ? 0 : 1);
/**
* Prints a Requirement instance
*/
function echo_requirement(Requirement $requirement)
{
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
echo ' ' . str_pad($result, 9);
echo $requirement->getTestMessage() . "\n";
if (!$requirement->isFulfilled()) {
echo sprintf(" %s\n\n", $requirement->getHelpText());
}
}
function echo_title($title)
{
echo "\n** $title **\n\n";
}