/** * Register a config file namespace. * @return void */ public function loadConfig() { if (!cms_installed()) { return []; } return parent::loadConfig(); }
/** * @param Router $router */ protected function loadSystemRoutes(Router $router) { if (!cms_installed()) { return; } Event::listen('routes.loaded', function () use($router) { $router->get('{slug?}', ['as' => 'frontend.url', 'middleware' => ['web', 'context:frontend'], 'uses' => 'KodiCMS\\Pages\\Http\\Controllers\\FrontendController@run'])->where('slug', '.*'); }, 999); }
/** * @param Router $router */ protected function loadSystemRoutes(Router $router) { if (cms_installed()) { return; } Event::listen('routes.loaded', function () { Route::group(['namespace' => $this->getControllerNamespace()], function () { Route::get('{slug}', ['uses' => 'InstallerController@error', 'as' => 'installer.error'])->where('slug', '(.*)?'); }); }); }
public function register() { $this->registerConsoleCommand(CronRunCommand::class); Event::listen('kernel.handled', function () { if (cms_installed() and config('job.agent', Job::AGENT_SYSTEM) === Job::AGENT_SYSTEM) { Job::runAll(); } }); Event::listen('view.settings.bottom', function () { $agents = Job::agents(); echo view('cron::cron.settings', compact('agents')); }); }
public function register() { $this->registerAliases(['Installer' => \KodiCMS\Support\Facades\Installer::class, 'EnvironmentTester' => \KodiCMS\Support\Facades\EnvironmentTester::class]); $this->registerConsoleCommand([InstallCommand::class, DropDatabaseCommand::class]); if (!cms_installed()) { putenv('APP_ENV=local'); } $this->app->singleton('installer', function ($app) { return new Installer($app['files']); }); $this->app->singleton('installer.environment.tester', function ($app) { return new EnvironmentTester(); }); }
/** * @param \Illuminate\Contracts\Events\Dispatcher $events */ private function registerDatabaseConfig($events) { $events->listen('config.loaded', function () { if (cms_installed()) { try { $databaseConfig = new \KodiCMS\CMS\Helpers\DatabaseConfig(); $this->app->instance('config.database', $databaseConfig); $config = $databaseConfig->getAll(); foreach ($config as $group => $data) { Config::set($group, array_merge(Config::get($group, []), $data)); } } catch (PDOException $e) { } } }, 999); }
/** * Execute the console command. */ public function fire() { list($failed, $tests, $optional) = EnvironmentTester::check(); $this->table($this->testHeaders, $tests); if (!empty($optional)) { $this->info('Optional tests'); $this->table($this->testHeaders, $optional); } if ($failed) { throw new InstallException('Environment test failed'); } if (!$this->confirmToProceed('.env file already exists!', function () { return cms_installed(); })) { return $this->error('Installation is aborted.'); } $db = $this->createDBConnection(); while (!$db && $this->confirm('Do you want enter settings?')) { $this->askOptions(); $db = $this->createDBConnection(); } if (!$db) { return $this->error('Installation is aborted.'); } if (Installer::createEnvironmentFile($this->getConfig())) { $this->info('.env file created successfully.'); } if ($this->confirm('Clear database? [yes/no]')) { $this->dropDatabase(); } Installer::initModules(); $this->migrate(); if ($this->confirm('Install seed data?')) { $this->seed(); } $this->info('Installation completed successfully'); }