Skip to content

Debug ProcessMaker process triggers

tomolimo edited this page Jun 28, 2017 · 13 revisions

This section is under construction

Install and configuration

ProcessMaker

Copy content of zipped file processmaker_debug_triggers.zip into processmaker installation folder You should get a new folder in workflow/public_html/ named triggers processmaker_debug_triggers.zip

XDebug

  1. Install on the PM server the xDebug PHP extension from https://xdebug.org/docs/install (choose the method that fits your operating system)
  2. Configure xDebug extension like following:

[php_xdebug]
zend_extension = "pathtoxdebugext/php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = ip_address_of_your_visual_studio_code
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.remote_autostart = 1
;xdebug.remote_log="c:\temp\xd.log"
xdebug.auto_trace = off
xdebug.collect_assignments = on
xdebug.collect_return = on
xdebug.collect_vars = on
xdebug.dump_undefined = on

Note: ip_address_of_your_visual_studio_code is the IP address of your machine from which you want to start debugging. It's the machine hosting the Visual Studio Code. Don't use the xdebug.remote_connect_back option as it will get the ip address of the GLPI server, and not the ip address of the VSC machine.

VSC

  1. Install Visual Studio Code from https://code.visualstudio.com/ on the client machine
  2. Start VSC, and install "PHP Extension Pack" (writer Felix Becker) from marketplace
  3. 'Open Folder' or 'Create a folder' like /pm/
  4. Switch to 'Debug' view
  5. Start a debug session (it will propose you to choose an environment, select PHP), verify that the 'launch.json' file is like following (adding serverSourceRoot and localSourceRoot):
{
   "version": "0.2.0",
   "configurations": [
      {
         "name": "Listen for XDebug",
         "type": "php",
         "request": "launch",
         "port": 9000,         
         "serverSourceRoot": "_local_path_to_pm_folder_on_server_used_by_xdebug_",
         "localSourceRoot": "_remote_path_to_pm_folder_on_server_used_by_vsc_"
      },
      {
         "name": "Launch currently open script",
         "type": "php",
         "request": "launch",
         "program": "${file}",
         "cwd": "${fileDirname}",
         "port": 9000
      }
   ]
}   

Example of paths for me: local_path_to_pm_folder_on_server_used_by_xdebug: L:\inetpub\wwwroot\pm remote_path_to_pm_folder_on_server_used_by_vsc: \\glpi.com\l$\inetpub\wwwroot\pm

Debug session

  1. In VSC Explorer, open file _remote_path_to_pm_folder_on_server_used_by_vsc_/workflow/engine/classes/class.wsBase.php

  2. Go To line 2323

  3. Toggle a breakpoint

  4. You may disable the 'Everything' breakpoint which is set by default, it's in the 'Debug' view and in the breakpoint list (bottom left). image

  5. Start GLPI in your browser

  6. go to 'Automatic Actions', open pmusers form.

  7. Click on 'Execute', and you should see your VSC with a breakpoint

Clone this wiki locally