first commit after reset
[mixstore.git] / app / check.php
CommitLineData
929ca066
BA
1<?php
2
3require_once dirname(__FILE__).'/SymfonyRequirements.php';
4
5$symfonyRequirements = new SymfonyRequirements();
6
7$iniPath = $symfonyRequirements->getPhpIniConfigPath();
8
9echo "********************************\n";
10echo "* *\n";
11echo "* Symfony requirements check *\n";
12echo "* *\n";
13echo "********************************\n\n";
14
15echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
16
17echo "** ATTENTION **\n";
18echo "* The PHP CLI can use a different php.ini file\n";
19echo "* than the one used with your web server.\n";
20if ('\\' == DIRECTORY_SEPARATOR) {
21 echo "* (especially on the Windows platform)\n";
22}
23echo "* To be on the safe side, please also launch the requirements check\n";
24echo "* from your web server using the web/config.php script.\n";
25
26echo_title('Mandatory requirements');
27
28$checkPassed = true;
29foreach ($symfonyRequirements->getRequirements() as $req) {
30 /** @var $req Requirement */
31 echo_requirement($req);
32 if (!$req->isFulfilled()) {
33 $checkPassed = false;
34 }
35}
36
37echo_title('Optional recommendations');
38
39foreach ($symfonyRequirements->getRecommendations() as $req) {
40 echo_requirement($req);
41}
42
43exit($checkPassed ? 0 : 1);
44
45/**
46 * Prints a Requirement instance
47 */
48function echo_requirement(Requirement $requirement)
49{
50 $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
51 echo ' ' . str_pad($result, 9);
52 echo $requirement->getTestMessage() . "\n";
53
54 if (!$requirement->isFulfilled()) {
55 echo sprintf(" %s\n\n", $requirement->getHelpText());
56 }
57}
58
59function echo_title($title)
60{
61 echo "\n** $title **\n\n";
62}