Skip to content
docsv0.1.0

LockFileManager

Manages the milpa.lock file. The lock file records the exact state of installed plugins: - Which plugins are installed - Their exact versions - Their source (local or github:owner/repo) - Installation timestamp - Content hash for integrity checks Location: {rootPath}/milpa.lock

LockFileManager::__construct()

public function __construct(string $rootPath):

Parameters

Parameters of __construct()
NameTypeDescription
$rootPathstring

LockFileManager::generate()

public function generate(array $plugins, string $milpaVersion = '2.0.0'): void

Generate or update the lock file from current installed plugins.

Parameters

Parameters of generate()
NameTypeDescription
$pluginsarray<array{name: string, version: string, source?: ?string, installedAt?: ?string, composerDeps?: ?array<string>}>
$milpaVersionstring

LockFileManager::read()

public function read(): ?array

Read the lock file. Returns null if it doesn't exist.

LockFileManager::verify()

public function verify(): bool

Verify the lock file integrity by recomputing the content hash.

LockFileManager::exists()

public function exists(): bool

Check if the lock file exists.

LockFileManager::getPath()

public function getPath(): string

Get the lock file path.

LockFileManager::getPluginLock()

public function getPluginLock(string $pluginName): ?array

Get installed plugin info from the lock file.

Parameters

Parameters of getPluginLock()
NameTypeDescription
$pluginNamestring