partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

check.php (1217B)


      1 <?php
      2 
      3 require_once dirname(__FILE__).'/../../../app/SymfonyRequirements.php';
      4 require_once dirname(__FILE__).'/../../../app/PartKeeprRequirements.php';
      5 
      6 $partKeeprRequirements = new PartKeeprRequirements();
      7 $iniPath = $partKeeprRequirements->getPhpIniConfigPath();
      8 
      9 $errors = [];
     10 $warnings = [];
     11 $success = true;
     12 
     13 foreach ($partKeeprRequirements->getRequirements() as $req) {
     14     /**
     15      * @var Requirement
     16      */
     17     if (!$req->isFulfilled()) {
     18         $success = false;
     19         $errors[] = '<b>'.$req->getTestMessage().'</b><br/>'.$req->getHelpHtml().'<br/>';
     20     }
     21 }
     22 
     23 foreach ($partKeeprRequirements->getRecommendations() as $recommendation) {
     24     /**
     25      * @var Requirement
     26      */
     27     if (!$recommendation->isFulfilled()) {
     28         $warnings[] = '<b>'.$recommendation->getTestMessage().'</b><br/>'.$recommendation->getHelpHtml().'<br/>';
     29     }
     30 }
     31 
     32 if ($success === false) {
     33     $errors[] = 'The php.ini file used: '.get_cfg_var('cfg_file_path');
     34     $errors[] = '<a target="_blank" href="https://wiki.partkeepr.org/wiki/KB00004:Symfony2 Requirements">Read moreā€¦</a>';
     35 }
     36 echo json_encode(['success' => $success, 'message' => 'Symfony2/PartKeepr Requirements', 'warnings' => $warnings, 'errors' => $errors]);