compose

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBundleSchema added in v1.5.0

func AssertBundleSchema(kind string, actual int) error

AssertBundleSchema ensures the bundle's sidecar schema_version meets the runtime's minimum for this kind. A mismatch indicates the bundle was built before a runtime feature that now asserts on its contents (e.g. the php-core share/php/ini/ requirement introduced in the Phase-2 compat closeout, PR #28). Returns a clear error identifying both the kind and the required/actual versions so CI and local diagnostics are unambiguous. Unknown kinds have minimum 0 and always pass.

func Compose

func Compose(layout *Layout, extensions []ExtensionComposition) error

func MergeCompatLayers added in v1.5.0

func MergeCompatLayers(defaults, xdebugFragment, extra map[string]string) map[string]string

MergeCompatLayers returns a single ini-key map composed of (lower-precedence first): defaults → xdebug fragment → extra. Callers pass the result as the `defaults` argument to WriteIniValuesWithDefaults, which then layers user ini-values over the top. Any of the inputs may be nil.

The returned map is always non-nil (may be empty).

func SelectBaseIniFile added in v1.5.0

func SelectBaseIniFile(layout *Layout, filename string) error

SelectBaseIniFile copies the bundle's upstream php.ini-{production,development} template to the effective php.ini location named by layout.IniFile. An empty filename means `ini-file: none` — the target is written empty.

Returns an error if the named source file is not found in layout.IniTemplateDir (which would indicate a builder regression since Task 5 guarantees both files are present in every bundle).

func SymlinkExtension

func SymlinkExtension(soPath, extensionDir, name string) error

func WriteDisableExtension added in v1.2.0

func WriteDisableExtension(confDir, extName string) error

WriteDisableExtension writes a conf.d fragment that documents and enforces non-loading of the named extension. The "00-" filename prefix makes it sort before extension-loading fragments (this codebase writes them as plain "<name>.ini"; see WriteIniFragment).

Because our composed PHP only loads what conf.d explicitly declares, the primary mechanism for disabling is simply the absence of the load directive; this file provides a durable audit trail and defence-in-depth.

func WriteIniFragment

func WriteIniFragment(confDir, extName string, lines []string) error

func WriteIniValuesWithDefaults added in v1.2.0

func WriteIniValuesWithDefaults(confDir string, defaults map[string]string, user []plan.IniValue) error

WriteIniValuesWithDefaults writes compat default ini values first, then user values on top — later writes win because PHP processes the file top-to-bottom. Default keys are written in deterministic (sorted) order. User values are written in their supplied order, matching how shivammathur/setup-php@v2 appends user-specified ini-values on top of the base ini.

If both maps are empty, no file is written and nil is returned.

Types

type ExtensionComposition

type ExtensionComposition struct {
	Name     string
	SOPath   string
	IniLines []string
}

type Layout

type Layout struct {
	RootDir        string
	BinDir         string
	ExtensionDir   string
	ConfDir        string
	IncludeDir     string
	IniTemplateDir string // <bundle>/usr/local/share/php/ini
	IniFile        string // <bundle>/usr/local/lib/php.ini (written by SelectBaseIniFile)
}

Jump to

Keyboard shortcuts

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