xdebugops

package
v1.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package xdebugops contains the shared business logic for toggling Xdebug on a PHP version: mode validation, config persistence, ini write, FPM quadlet update, and unit restart. The CLI, UI, and MCP all call into here so the three surfaces stay in lockstep on state transitions and ordering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FPMUnit

func FPMUnit(version string) string

FPMUnit returns the systemd unit name for a PHP version's FPM container. Exposed so callers can print consistent "Run: systemctl --user restart ..." hints when Apply's RestartErr is non-nil.

Types

type Result

type Result struct {
	Version   string
	Mode      string // canonical mode after Apply; "" means xdebug disabled
	Enabled   bool   // convenience: Mode != ""
	NoChange  bool   // true when the requested state already matched; no restart was attempted
	Restarted bool   // true when the FPM unit restart succeeded
	// RestartErr is set when the FPM unit restart failed. Non-fatal: config and
	// ini are already persisted, the caller just needs to surface a hint so
	// the user can restart the unit manually.
	RestartErr error
}

Result describes the outcome of Apply so callers can render their own user-facing message without inspecting the config again.

func Apply

func Apply(version, rawMode string) (Result, error)

Apply toggles Xdebug for version with the default start_with_request=yes (connect on every request). See ApplyWithStart for on-demand modes.

func ApplyWithStart added in v1.25.0

func ApplyWithStart(version, rawMode, start string) (Result, error)

ApplyWithStart toggles Xdebug for version and sets its start_with_request value (yes | trigger | no). An empty mode disables xdebug; a non-empty mode is validated via podman.NormaliseXdebugMode. With "trigger"/"no", debugging is driven on demand (a trigger cookie, or the control socket via `lerd xdebug pause`) instead of every request and worker connecting. It is idempotent: passing the current mode and start returns NoChange=true.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL