xdebugops

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 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. An empty mode disables xdebug; a non-empty mode is validated via podman.NormaliseXdebugMode and enables xdebug with that canonical value. Apply is idempotent: passing the current mode is a no-op that returns NoChange=true without touching the FPM container.

Jump to

Keyboard shortcuts

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