/** * Create a new cache repository with the given implementation. * * @param \Illuminate\Contracts\Cache\Store $store * @return \Illuminate\Cache\Repository */ public function repository(Store $store) { $repository = new Repository($store); if ($this->app->bound('Illuminate\\Contracts\\Events\\Dispatcher')) { $repository->setEventDispatcher($this->app['Illuminate\\Contracts\\Events\\Dispatcher']); } return $repository; }
/** * Set the event dispatcher instance. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void * @static */ public static function setEventDispatcher($events) { \Illuminate\Cache\Repository::setEventDispatcher($events); }
if (file_exists($configFile = __DIR__ . '/../config.php')) { $app->instance('flarum.config', include $configFile); } date_default_timezone_set('UTC'); $app->instance('config', $config = new ConfigRepository(['view' => ['paths' => [realpath(base_path('resources/views'))], 'compiled' => realpath(storage_path() . '/framework/views')], 'mail' => ['driver' => 'mail'], 'cache' => ['default' => 'file', 'stores' => ['file' => ['driver' => 'file', 'path' => storage_path() . '/framework/cache']], 'prefix' => 'flarum'], 'filesystems' => ['default' => 'local', 'cloud' => 's3', 'disks' => ['flarum-avatars' => ['driver' => 'local', 'root' => public_path('assets/avatars')]]]])); $logger = new Monolog\Logger($app->environment()); $logPath = $app->storagePath() . '/logs/flarum.log'; $handler = new \Monolog\Handler\StreamHandler($logPath, Monolog\Logger::DEBUG); $handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true)); $logger->pushHandler($handler); $app->instance('log', $logger); $app->alias('log', 'Psr\\Log\\LoggerInterface'); $app->singleton('cache', function ($app) { $store = new FileStore(new Filesystem(), storage_path('framework/cache')); $repository = new Repository($store); $repository->setEventDispatcher($app->make('events')); return $repository; }); $app->alias('cache', 'Illuminate\\Contracts\\Cache\\Repository'); $serviceProviders = ['Flarum\\Core\\DatabaseServiceProvider', 'Flarum\\Core\\Settings\\SettingsServiceProvider', 'Flarum\\Locale\\LocaleServiceProvider', 'Illuminate\\Bus\\BusServiceProvider', 'Illuminate\\Filesystem\\FilesystemServiceProvider', 'Illuminate\\Hashing\\HashServiceProvider', 'Illuminate\\Mail\\MailServiceProvider', 'Illuminate\\View\\ViewServiceProvider', 'Illuminate\\Events\\EventServiceProvider', 'Illuminate\\Validation\\ValidationServiceProvider']; foreach ($serviceProviders as $provider) { $app->register(new $provider($app)); } if (Core::isInstalled()) { $settings = $app->make('Flarum\\Core\\Settings\\SettingsRepository'); $app->register(new \Flarum\Core\CoreServiceProvider($app)); $config->set('mail.driver', Core::config('mail_driver')); $config->set('mail.host', Core::config('mail_host')); $config->set('mail.port', Core::config('mail_port')); $config->set('mail.from.address', Core::config('mail_from')); $config->set('mail.from.name', Core::config('forum_title'));