public function createPage(string $cabin, string $path, array $post = [], bool $publish = false, bool $raw = true) : bool
{
$this->db->beginTransaction();
// Get the ID for the parent directory
if (!empty($path)) {
$directory_id = $this->getParentDirFromStr($path, $cabin);
} else {
$directory_id = null;
}
// Create the new page
$pageId = $this->db->insertGet('airship_custom_page', ['active' => $publish, 'cabin' => $cabin, 'directory' => $directory_id, 'url' => $post['url'], 'cache' => !empty($post['cache'])], 'pageid');
// Create the first version of the new page
$this->db->insert('airship_custom_page_version', ['page' => $pageId, 'uniqueid' => $this->uniqueId('airship_custom_page_version'), 'published' => $publish, 'raw' => $raw, 'formatting' => $post['format'] ?? 'HTML', 'bridge_user' => $this->getActiveUserId(), 'metadata' => !empty($post['metadata']) ? \json_encode($post['metadata']) : '[]', 'body' => $post['page_body'] ?? '']);
return $this->db->commit();
}