Skip to content

Commit

Permalink
file handling wip
Browse files Browse the repository at this point in the history
  • Loading branch information
philippejadin committed Sep 24, 2021
1 parent b9c779f commit 7d86952
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/Console/Commands/ImportGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use \Cviebrock\EloquentSluggable\Services\SlugService;

use Illuminate\Support\Facades\Storage as FacadesStorage;

use Illuminate\Support\Str;

/**
* Import content command
Expand Down Expand Up @@ -95,6 +95,9 @@ public function handle()
// any function called from now on, can (and will) use this group model for it's inner working
$this->group = $group;

// store original group id, we'll need it
$this->originalGroupId = $data->id;


// handle memberships
foreach ($data->memberships as $membership) {
Expand Down Expand Up @@ -144,11 +147,13 @@ public function handle()

// delete tmp files

/*
if (Storage::deleteDirectory('imports/' . $this->argument('group'))) {
$this->info('Temp files deleted');
} else {
$this->error('Could not delete temp files');
}
*/

$this->line('Group imported successfuly');
}
Expand Down Expand Up @@ -449,6 +454,15 @@ function createFile($data)
$file->save();

// now we have a file let's handle the content
// this part is tightly coupled to the way files are stored on disk, there is something wrong here but it does the job.
// Should be a responsability of the file model... well it's an interim solution while importing content, it will be dirty
$original_path = ('imports/' . $this->argument('group') . '/files/' . $data->id . '/' . basename($file->path));

// move the file to it's new location

// change the path

// profit


return $file;
Expand Down

0 comments on commit 7d86952

Please sign in to comment.