Child pages
  • Debug mode in CLI [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

The new "--debug" option is added instead of reusing "-vvv" option to avoid mixing Symfony Console debug output with one produced by In-Portal.

The "Debug Mode" is a mode in which:

  • additional debug information is generated during page load
  • debugger report is presented to end user (developer) when page is shown

It can also be used in production, where real-time-debugging isn't available. Debug mode is activated based on visitor IP address, but in CLI there is no IP address to use and therefore it's always turned off.

With the help of new "--debug" command-line argument to both "tools/cron.php" and "tools/run_event.php" it would be possible to enable debug mode temporarily.

Solution (5.2.x)

  1. in "\Debugger::__construct" method if in PHP_SAPI == 'cli'
    1. if $_SERVER['argv'] contains '--debug' set "$ip_match" to true
    2. don't call "\Debugger::appendRequest" method

Solution (5.3.x)

  1. create "\InPortal\Core\kernel\Console\ConsoleApplication::getDefaultInputDefinition" method, that will:
    1. call parent method to get default input definition
    2. append 'debug' option without parameters to it
    3. return the result
  2. in the "tools/cron.php" and "tools/run_event.php" script forward "--debug" option (if any) to executed "/in-portal" script

Related Tasks