xf

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package xf provides utilities for XenForo installation detection and management.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrMetadataNotFound is returned when the metadata file cannot be found.
	ErrMetadataNotFound = errors.New("metadata not found")
)

Functions

func GetXenForoDir

func GetXenForoDir(startDir string) (string, error)

GetXenForoDir finds the XenForo root directory by traversing up from startDir. It also checks the XF_DIR environment variable as a fallback.

func UpdateMetadataVersion

func UpdateMetadataVersion(xfDir string, version *Version) error

UpdateMetadataVersion updates the version information in the metadata.

func WriteMetadata

func WriteMetadata(xfDir string, meta *Metadata) error

WriteMetadata writes metadata to the metadata file.

Types

type Metadata

type Metadata struct {
	// LicenseKey is the license key used for this installation
	LicenseKey string `json:"license_key"`

	// InstanceName is the Docker instance name
	InstanceName string `json:"instance_name"`

	// InstalledProducts tracks which products were installed
	InstalledProducts []string `json:"installed_products"`

	// InstalledVersion is the version that was installed
	InstalledVersion string `json:"installed_version"`

	// InstalledVersionID is the version ID that was installed
	InstalledVersionID int `json:"installed_version_id"`

	// CreatedAt is when the installation was created
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is when the metadata was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

Metadata stores CLI-specific information about a XenForo installation. This file is created during `init` and used by `upgrade` to remember settings.

func ReadMetadata

func ReadMetadata(xfDir string) (*Metadata, error)

ReadMetadata reads the metadata file. Returns ErrMetadataNotFound if the file doesn't exist.

type Version

type Version struct {
	String string // e.g., "2.3.8"
	ID     int    // e.g., 2030871
	// contains filtered or unexported fields
}

Version represents a XenForo version with both string and ID representations.

func DetectVersion

func DetectVersion(xfDir string) (*Version, error)

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

func DetectVersionFS(installation fs.FS) (*Version, error)

DetectVersionFS is DetectVersion for a filesystem rooted at the installation.

func ParseVersionID

func ParseVersionID(versionID int) *Version

ParseVersionID converts a version ID into a Version structure.

Jump to

Keyboard shortcuts

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