mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
ZIP Imports: Fleshed out continue page, Added testing
This commit is contained in:
@@ -23,9 +23,8 @@ class ImportController extends Controller
|
||||
* Show the view to start a new import, and also list out the existing
|
||||
* in progress imports that are visible to the user.
|
||||
*/
|
||||
public function start(Request $request)
|
||||
public function start()
|
||||
{
|
||||
// TODO - Test visibility access for listed items
|
||||
$imports = $this->imports->getVisibleImports();
|
||||
|
||||
$this->setPageTitle(trans('entities.import'));
|
||||
@@ -64,7 +63,6 @@ class ImportController extends Controller
|
||||
*/
|
||||
public function show(int $id)
|
||||
{
|
||||
// TODO - Test visibility access
|
||||
$import = $this->imports->findVisible($id);
|
||||
|
||||
$this->setPageTitle(trans('entities.import_continue'));
|
||||
@@ -74,12 +72,23 @@ class ImportController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function run(int $id)
|
||||
{
|
||||
// TODO - Test access/visibility
|
||||
|
||||
$import = $this->imports->findVisible($id);
|
||||
|
||||
// TODO - Run import
|
||||
// Validate again before
|
||||
// TODO - Redirect to result
|
||||
// TOOD - Or redirect back with errors
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an active pending import from the filesystem and database.
|
||||
*/
|
||||
public function delete(int $id)
|
||||
{
|
||||
// TODO - Test visibility access
|
||||
$import = $this->imports->findVisible($id);
|
||||
$this->imports->deleteImport($import);
|
||||
|
||||
|
@@ -3,11 +3,14 @@
|
||||
namespace BookStack\Exports;
|
||||
|
||||
use BookStack\Activity\Models\Loggable;
|
||||
use BookStack\Users\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $path
|
||||
* @property string $name
|
||||
* @property int $size - ZIP size in bytes
|
||||
@@ -17,6 +20,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property int $created_by
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property User $createdBy
|
||||
*/
|
||||
class Import extends Model implements Loggable
|
||||
{
|
||||
@@ -59,4 +63,9 @@ class Import extends Model implements Loggable
|
||||
{
|
||||
return "({$this->id}) {$this->name}";
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user