1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

ZIP Imports: Finished off core import logic

This commit is contained in:
Dan Brown
2024-11-11 15:06:46 +00:00
parent 378f0d595f
commit 48c101aa7a
5 changed files with 113 additions and 28 deletions

View File

@@ -79,18 +79,21 @@ class ImportController extends Controller
$import = $this->imports->findVisible($id);
$parent = null;
if ($import->getType() === 'page' || $import->getType() === 'chapter') {
if ($import->type === 'page' || $import->type === 'chapter') {
$data = $this->validate($request, [
'parent' => ['required', 'string']
]);
$parent = $data['parent'];
}
// TODO - Run import
// TODO - Validate again before
// TODO - Check permissions before (create for main item, create for children, create for related items [image, attachments])
$entity = $this->imports->runImport($import, $parent);
if ($entity) {
$this->logActivity(ActivityType::IMPORT_RUN, $import);
return redirect($entity->getUrl());
}
// TODO - Redirect to result
// TODO - Or redirect back with errors
return 'failed';
}
/**