Prechádzať zdrojové kódy

Move constant NO_CLI to Http
As the constant file it's only used by the worker.

Joanhey 6 rokov pred
rodič
commit
c3378e878f
3 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 0 2
      Lib/Constants.php
  2. 2 0
      Protocols/Http.php
  3. 1 1
      Worker.php

+ 0 - 2
Lib/Constants.php

@@ -31,8 +31,6 @@ define('WORKERMAN_SEND_FAIL', 2);
 define('OS_TYPE_LINUX', 'linux');
 define('OS_TYPE_WINDOWS', 'windows');
 
-define('NO_CLI', PHP_SAPI !== 'cli'); 
-
 // Compatible with php7
 if(!class_exists('Error'))
 {

+ 2 - 0
Protocols/Http.php

@@ -722,3 +722,5 @@ class HttpCache
 }
 
 HttpCache::init();
+
+define('NO_CLI', PHP_SAPI !== 'cli');

+ 1 - 1
Worker.php

@@ -542,7 +542,7 @@ class Worker
     protected static function checkSapiEnv()
     {
         // Only for cli.
-        if (NO_CLI) {
+        if (PHP_SAPI !== 'cli') {
             exit("Only run in command line mode \n");
         }
         if (DIRECTORY_SEPARATOR === '\\') {