<?php

require_once dirname(__FILE__) . '/../src/libs/Xiidea/Installer/Services/CixRequirements.php';
$cixRequirements = new CixRequirements();
$iniPath = $cixRequirements->getPhpIniConfigPath();
echo "********************************\n";
echo "*                              *\n";
echo "*    CIX 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/check.php script.\n";
echo_title('Mandatory requirements');
$checkPassed = true;
foreach ($cixRequirements->getRequirements() as $req) {
    /** @var $req Requirement */
    echo_requirement($req);
    if (!$req->isFulfilled()) {
        $checkPassed = false;
    }
}
echo_title('Optional recommendations');
foreach ($cixRequirements->getRecommendations() as $req) {
    echo_requirement($req);
        ?>
</li>
                                <?php 
    }
    ?>
                            </ol>
                        <?php 
}
?>

                        <?php 
if ($cixRequirements->hasPhpIniConfigIssue()) {
    ?>
                            <p id="phpini">*
                                <?php 
    if ($cixRequirements->getPhpIniConfigPath()) {
        ?>
                                    Changes to the <strong>php.ini</strong> file must be done in "<strong><?php 
        echo $cixRequirements->getPhpIniConfigPath();
        ?>
</strong>".
                                <?php 
    } else {
        ?>
                                    To change settings, create a "<strong>php.ini</strong>".
                                <?php 
    }
    ?>
                            </p>
                        <?php 
}