ZIP Imports: Built out reference parsing/updating logic

This commit is contained in:
Dan Brown
2024-11-10 16:03:50 +00:00
parent d13e4d2eef
commit 378f0d595f
5 changed files with 232 additions and 23 deletions

View File

@@ -87,6 +87,17 @@ class PageRepo
return $draft;
}
/**
* Directly update the content for the given page from the provided input.
* Used for direct content access in a way that performs required changes
* (Search index & reference regen) without performing an official update.
*/
public function setContentFromInput(Page $page, array $input): void
{
$this->updateTemplateStatusAndContentFromInput($page, $input);
$this->baseRepo->update($page, []);
}
/**
* Update a page in the system.
*/
@@ -121,7 +132,7 @@ class PageRepo
return $page;
}
protected function updateTemplateStatusAndContentFromInput(Page $page, array $input)
protected function updateTemplateStatusAndContentFromInput(Page $page, array $input): void
{
if (isset($input['template']) && userCan('templates-manage')) {
$page->template = ($input['template'] === 'true');