Documentation
¶
Overview ¶
Package xf provides utilities for XenForo installation detection and management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMetadataNotFound is returned when the metadata file cannot be found. ErrMetadataNotFound = errors.New("metadata not found") )
Functions ¶
func GetXenForoDir ¶
GetXenForoDir finds the XenForo root directory by traversing up from startDir. It also checks the XF_DIR environment variable as a fallback.
func UpdateMetadataVersion ¶
UpdateMetadataVersion updates the version information in the metadata.
func WriteMetadata ¶
WriteMetadata updates the timestamps and writes metadata with mode 0600 when creating the file. Existing file permissions are not changed.
Types ¶
type Metadata ¶
type Metadata struct {
LicenseKey string `json:"license_key"`
InstanceName string `json:"instance_name"`
InstalledProducts []string `json:"installed_products"`
InstalledVersion string `json:"installed_version"`
InstalledVersionID int `json:"installed_version_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Metadata stores CLI-specific information about a XenForo installation. It records the license key, Docker instance name, installed products and version, and creation and update times for use by init and upgrade.
func ReadMetadata ¶
ReadMetadata reads the metadata file. Returns ErrMetadataNotFound if the file doesn't exist.
type Version ¶
Version represents a XenForo version with both string and ID representations. Its ID encodes major, two-digit minor and patch, stability, and release level.
func DetectVersion ¶
DetectVersion reads the core add-on version, checking it against src/XF.php. If the core add-on manifest is absent, it uses src/XF.php alone.
func DetectVersionFS ¶ added in v0.5.0
DetectVersionFS is DetectVersion for a filesystem rooted at the installation. It prefers the numeric ID for parsing but retains the source version string; if no positive ID is found, it parses the version string instead.
func ParseVersionID ¶
ParseVersionID converts a version ID into a Version structure.