예제 #1
0
파일: dmBase.php 프로젝트: rafaelgou/diem
 public static function checkServer()
 {
     require_once realpath(dirname(__FILE__) . '/../os/dmServerCheck.php');
     $serverCheck = new dmServerCheck();
     print $serverCheck->render();
     exit;
 }
예제 #2
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once realpath(dirname(__FILE__) . '/../os/dmServerCheck.php');
     //    echo "** WARNING **\n";
     //    echo "*  The PHP CLI can use a different php.ini file\n";
     //    echo "*  than the one used with your web server.\n";
     //    echo "*  If this is the case, please launch this\n";
     //    echo "*  utility from your web server : http://mysite.com/dm_check.php\n";
     //    echo "** WARNING **\n";
     $this->warnings = array();
     $this->errors = array();
     $this->checks = array();
     $serverCheck = new dmServerCheck();
     foreach ($serverCheck->getChecks() as $checkSpace => $checks) {
         $this->renderHead($checkSpace);
         foreach ($checks as $check) {
             $this->renderCheck($check);
             if ('error' === $check->getDiagnostic()) {
                 $this->errors[] = $check;
             } elseif ('warning' === $check->getDiagnostic()) {
                 $this->warnings[] = $check;
             }
             $this->checks[] = $check;
             usleep(200000);
         }
     }
     if (count($this->warnings)) {
         $this->logBlock(count($this->warnings) . ' warnings : ' . implode(', ', $this->warnings), 'COMMENT_LARGE');
     }
     if (count($this->errors)) {
         $this->logBlock(sprintf('%d/%d check(s) failed : ' . implode(', ', $this->errors), count($this->errors), count($this->checks)), 'ERROR_LARGE');
     } else {
         $this->logBlock('The server matches Symfony & Diem requirements', 'INFO_LARGE');
     }
     if (count($this->errors)) {
         throw new dmServerCheckException('Diem can NOT run safely in this environment');
     }
 }