Path specifications are either pointers to storage files based on entity name and VPID
or a concrete path (optionally with wildcards).
An example:
[
['type' => 'storage-file', 'entity' => 'post', 'id' => VPID, 'parent-id' => null],
['type' => 'storage-file', 'entity' => 'usermeta', 'id' => VPID, 'parent-id' => user-VPID],
['type' => 'all-storage-files', 'entity' => 'option'],
['type' => 'path', 'path' => '/var/www/wp/example.txt'],
['type' => 'path', 'path' => '/var/www/wp/folder/*']
]
public getChangedFiles ( ) : array | ||
return | array |
/** * Calls Git `add -A` on files that are related to the given $changeInfo. * The "exchange format" is an array documented in {@see TrackedChangedInfo::getChangedFiles()}. * * @param TrackedChangeInfo|ChangeInfoEnvelope $changeInfo */ private function stageRelatedFiles($changeInfo) { if ($changeInfo instanceof ChangeInfoEnvelope) { /** @var TrackedChangeInfo $subChangeInfo */ foreach ($changeInfo->getChangeInfoList() as $subChangeInfo) { $this->stageRelatedFiles($subChangeInfo); } return; } $changes = $changeInfo->getChangedFiles(); foreach ($changes as $change) { if ($change["type"] === "storage-file") { $entityName = $change["entity"]; $entityId = $change["id"]; $parentId = $change["parent-id"]; $path = $this->storageFactory->getStorage($entityName)->getEntityFilename($entityId, $parentId); } elseif ($change["type"] === "all-storage-files") { $entityName = $change["entity"]; $path = $this->storageFactory->getStorage($entityName)->getPathCommonToAllEntities(); } elseif ($change["type"] === "path") { $path = $change["path"]; } else { continue; } $this->repository->stageAll($path); } }
public function getChangedFiles() { $change = ["type" => "storage-file", "entity" => $this->getScope(), "id" => $this->getId(), "parent-id" => $this->getParentId()]; return array_merge([$change], parent::getChangedFiles()); }