/** * @param EnvironmentCreatedEvent $event */ protected function environmentCreateDisk(EnvironmentCreatedEvent $event, $disk_name) { $disk_key = $event->environment->reference . '_' . $disk_name; $env_directory = storage_path($disk_name . '/' . $event->environment->reference); if (!File::exists(storage_path($disk_name))) { File::makeDirectory(storage_path($disk_name), 0777); } if (!File::exists(storage_path($disk_name . '/' . $event->environment->reference))) { File::makeDirectory(storage_path($disk_name . '/' . $event->environment->reference), 0777); } if (!File::exists($env_directory)) { File::makeDirectory($env_directory, 0777); } /* * Attach new environment directory to the new env */ $this->r_disk->setDefaultFileSystemDisk($disk_key, $event->environment->reference); $this->r_disk->addFileSystemDisk($disk_key, ['driver' => 'local', 'root' => $env_directory], $event->environment->reference); $this->r_disk->mountElFinderDisk($disk_key, ['alias' => $event->environment->name . ' ' . $disk_name, 'URL' => null], $event->environment->reference); /** * Attach new environment directory to the default env */ if ($event->environment->reference !== EnvironmentsRepositoryEloquent::DEFAULT_ENVIRONMENT_REFERENCE) { $this->r_disk->addFileSystemDisk($disk_key, ['driver' => 'local', 'root' => $env_directory], EnvironmentsRepositoryEloquent::DEFAULT_ENVIRONMENT_REFERENCE); $this->r_disk->mountElFinderDisk($disk_key, ['alias' => $event->environment->name . ' ' . $disk_name, 'URL' => null, 'access' => ['roles' => [User::ROLE_SUPERADMIN], 'permissions' => []]]); } }
/** * Migrate module and core. * * @param array $session_installer * @param array $migrate_opt * @param array $seeder_opt * * @seealso InstallerRepository::testDBConnection() */ public function migrate(array $session_installer, array $migrate_opt = ['--force' => true], array $seeder_opt = ['--force' => true]) { \Artisan::call('module:publish-migration'); \Artisan::call('migrate', $migrate_opt); $this->addEnvironment($session_installer); \Artisan::call('db:seed', $seeder_opt); $this->r_disks->addFileSystemDisk('backups', ['driver' => 'local', 'root' => storage_path('app/default/backups')], EnvironmentsRepositoryEloquent::DEFAULT_ENVIRONMENT_REFERENCE); $this->r_disks->mountElFinderDisk('backups', ['alias' => 'Backups', 'URL' => null, 'access' => ['readonly' => true, 'roles' => [], 'permissions' => []]], EnvironmentsRepositoryEloquent::DEFAULT_ENVIRONMENT_REFERENCE); }