/** * @return Application */ protected function getApp() { if ($this->app !== null) { return $this->app; } date_default_timezone_set('UTC'); $app = new Application($this->basePath, $this->publicPath); if ($this->storagePath) { $app->useStoragePath($this->storagePath); } $app->instance('env', 'production'); $app->instance('flarum.config', $this->config); $app->instance('config', $config = $this->getIlluminateConfig($app)); $this->registerLogger($app); $this->registerCache($app); $app->register('Flarum\\Database\\DatabaseServiceProvider'); $app->register('Flarum\\Settings\\SettingsServiceProvider'); $app->register('Flarum\\Locale\\LocaleServiceProvider'); $app->register('Illuminate\\Bus\\BusServiceProvider'); $app->register('Illuminate\\Filesystem\\FilesystemServiceProvider'); $app->register('Illuminate\\Hashing\\HashServiceProvider'); $app->register('Illuminate\\Mail\\MailServiceProvider'); $app->register('Illuminate\\View\\ViewServiceProvider'); $app->register('Illuminate\\Validation\\ValidationServiceProvider'); if ($app->isInstalled() && $app->isUpToDate()) { $settings = $app->make('Flarum\\Settings\\SettingsRepositoryInterface'); $config->set('mail.driver', $settings->get('mail_driver')); $config->set('mail.host', $settings->get('mail_host')); $config->set('mail.port', $settings->get('mail_port')); $config->set('mail.from.address', $settings->get('mail_from')); $config->set('mail.from.name', $settings->get('forum_title')); $config->set('mail.encryption', $settings->get('mail_encryption')); $config->set('mail.username', $settings->get('mail_username')); $config->set('mail.password', $settings->get('mail_password')); $app->register('Flarum\\Core\\CoreServiceProvider'); $app->register('Flarum\\Api\\ApiServiceProvider'); $app->register('Flarum\\Forum\\ForumServiceProvider'); $app->register('Flarum\\Admin\\AdminServiceProvider'); foreach ($this->extendCallbacks as $callback) { $app->call($callback); } $app->register('Flarum\\Extension\\ExtensionServiceProvider'); } $app->boot(); $this->app = $app; return $app; }