예제 #1
0
use Illuminate\Cache\FileStore;
use Illuminate\Cache\Repository;
use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Filesystem\Filesystem;
define('FLARUM_START', microtime(true));
require __DIR__ . '/vendor/autoload.php';
// franzliedke/studio currently doesn't autoload files (see issue below), so we
// will need to load them manually if we're using studio.
// https://github.com/franzliedke/studio/issues/29
if (file_exists(__DIR__ . '/core')) {
    require __DIR__ . '/core/src/helpers.php';
    require __DIR__ . '/core/vendor/swiftmailer/swiftmailer/lib/swift_required.php';
}
$app = new Application(realpath(__DIR__));
$app->instance('path.public', __DIR__ . '/..');
Illuminate\Container\Container::setInstance($app);
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);