Fixed cli detect count issue.

main
Robert 3 years ago
parent d879ca8a49
commit 9174c069a7
  1. 10
      src/classes/console_app.php
  2. 2
      src/classes/loadall.php

@ -5,8 +5,13 @@ declare(strict_types=1);
namespace tts;
final class console_app {
public static $is_cli = false;
public static function is_cli() {
if (static::$is_cli) {
return true;
}
if (defined('STDIN')) {
return true;
}
@ -19,7 +24,10 @@ final class console_app {
return true;
}
if (empty($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT']) && px_count($_SERVER['argv']) > 0) {
// $argv = $_SERVER['argv'] ?? [];
// && count($argv) > 0
if (!isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT'])) {
return true;
}

@ -26,7 +26,7 @@ final class loadall {
$config_path = $root_path . ltrim($path, "/");
if ($cdir = scandir($config_path)) {
fwrite($fl_handle, "<?php \r\n");
fwrite($fl_handle, "<?php \r\n declare(strict_types=1);\r\n");
fwrite($fl_handle, "/* \r\n");
fwrite($fl_handle, "* This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration! \r\n");
fwrite($fl_handle, "*/ \r\n");

Loading…
Cancel
Save