2015-04-25 13:27:04 +00:00
|
|
|
<?php
|
|
|
|
define('LARAVEL_START', microtime(true));
|
|
|
|
|
|
|
|
require __DIR__.'/vendor/autoload.php';
|
|
|
|
|
|
|
|
$app = new Illuminate\Foundation\Application(
|
|
|
|
realpath(__DIR__)
|
|
|
|
);
|
|
|
|
$app->instance('path.public', __DIR__.'/..');
|
|
|
|
|
2015-06-16 23:38:38 +00:00
|
|
|
// DetectEnvironment
|
|
|
|
Dotenv::load($app->basePath(), $app->environmentFile());
|
|
|
|
|
|
|
|
$app->detectEnvironment(function()
|
|
|
|
{
|
|
|
|
return env('APP_ENV', 'production');
|
|
|
|
});
|
2015-05-27 00:39:09 +00:00
|
|
|
|
2015-06-16 23:38:38 +00:00
|
|
|
// LoadConfiguration
|
2015-06-30 21:26:56 +00:00
|
|
|
if (file_exists($configFile = __DIR__.'/../config.php')) {
|
|
|
|
$app->instance('flarum.config', include __DIR__.'/../config.php');
|
|
|
|
}
|
2015-05-27 00:39:09 +00:00
|
|
|
|
2015-06-30 21:26:56 +00:00
|
|
|
$app->instance('config', new \Illuminate\Config\Repository([
|
|
|
|
'view' => [
|
|
|
|
'paths' => [
|
|
|
|
realpath(base_path('resources/views'))
|
|
|
|
],
|
|
|
|
'compiled' => realpath(storage_path().'/framework/views'),
|
|
|
|
],
|
|
|
|
'mail' => [
|
|
|
|
'driver' => env('MAIL_DRIVER', 'smtp'),
|
|
|
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
|
|
|
'port' => env('MAIL_PORT', 587),
|
|
|
|
'from' => ['address' => 'noreply@localhost', 'name' => 'Flarum Demo Forum'],
|
|
|
|
'encryption' => 'tls',
|
|
|
|
'username' => env('MAIL_USERNAME'),
|
|
|
|
'password' => env('MAIL_PASSWORD'),
|
|
|
|
'sendmail' => '/usr/sbin/sendmail -bs',
|
|
|
|
'pretend' => false,
|
|
|
|
],
|
|
|
|
'queue' => [
|
|
|
|
'default' => 'sync',
|
|
|
|
'connections' => [
|
|
|
|
'sync' => [
|
|
|
|
'driver' => 'sync',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'failed' => [
|
|
|
|
'database' => 'mysql', 'table' => 'failed_jobs',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'session' => [
|
|
|
|
'driver' => env('SESSION_DRIVER', 'file'),
|
|
|
|
'lifetime' => 120,
|
|
|
|
'expire_on_close' => false,
|
|
|
|
'encrypt' => false,
|
|
|
|
'files' => storage_path().'/framework/sessions',
|
|
|
|
'connection' => null,
|
|
|
|
'table' => 'sessions',
|
|
|
|
'lottery' => [2, 100],
|
|
|
|
'cookie' => 'laravel_session',
|
|
|
|
'path' => '/',
|
|
|
|
'domain' => null,
|
|
|
|
'secure' => false,
|
|
|
|
],
|
|
|
|
]));
|
2015-04-25 13:27:04 +00:00
|
|
|
|
2015-06-16 23:38:38 +00:00
|
|
|
// ConfigureLogging
|
|
|
|
$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');
|
|
|
|
|
|
|
|
// RegisterFacades
|
|
|
|
use Illuminate\Support\Facades\Facade;
|
|
|
|
|
|
|
|
Facade::clearResolvedInstances();
|
|
|
|
Facade::setFacadeApplication($app);
|
|
|
|
|
|
|
|
// RegisterProviders
|
2015-06-30 21:26:56 +00:00
|
|
|
$serviceProviders = [
|
|
|
|
|
|
|
|
'Illuminate\Bus\BusServiceProvider',
|
|
|
|
'Illuminate\Cache\CacheServiceProvider',
|
|
|
|
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
|
|
|
|
'Illuminate\Cookie\CookieServiceProvider',
|
|
|
|
'Illuminate\Encryption\EncryptionServiceProvider',
|
|
|
|
'Illuminate\Filesystem\FilesystemServiceProvider',
|
|
|
|
'Illuminate\Foundation\Providers\FoundationServiceProvider',
|
|
|
|
'Illuminate\Hashing\HashServiceProvider',
|
|
|
|
'Illuminate\Mail\MailServiceProvider',
|
|
|
|
'Illuminate\Pagination\PaginationServiceProvider',
|
|
|
|
'Illuminate\Pipeline\PipelineServiceProvider',
|
|
|
|
'Illuminate\Queue\QueueServiceProvider',
|
|
|
|
'Illuminate\Session\SessionServiceProvider',
|
|
|
|
'Illuminate\Translation\TranslationServiceProvider',
|
|
|
|
'Illuminate\Validation\ValidationServiceProvider',
|
|
|
|
'Illuminate\View\ViewServiceProvider',
|
|
|
|
|
|
|
|
'Flarum\Core\CoreServiceProvider',
|
|
|
|
'Flarum\Core\DatabaseServiceProvider',
|
|
|
|
'Flarum\Console\ConsoleServiceProvider',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
foreach ($serviceProviders as $provider) {
|
|
|
|
$app->register(new $provider($app));
|
|
|
|
}
|
2015-06-16 23:38:38 +00:00
|
|
|
|
|
|
|
// BootProviders
|
|
|
|
$app->boot();
|
|
|
|
|
2015-04-25 13:27:04 +00:00
|
|
|
use Illuminate\Foundation\Console\Kernel as IlluminateConsoleKernel;
|
|
|
|
|
|
|
|
class ConsoleKernel extends IlluminateConsoleKernel {
|
|
|
|
protected $commands = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$app->singleton(
|
|
|
|
'Illuminate\Contracts\Http\Kernel',
|
|
|
|
'HttpKernel'
|
|
|
|
);
|
|
|
|
|
|
|
|
$app->singleton(
|
|
|
|
'Illuminate\Contracts\Console\Kernel',
|
|
|
|
'ConsoleKernel'
|
|
|
|
);
|
|
|
|
|
|
|
|
$app->singleton(
|
|
|
|
'Illuminate\Contracts\Debug\ExceptionHandler',
|
|
|
|
'Illuminate\Foundation\Exceptions\Handler'
|
|
|
|
);
|
|
|
|
|
|
|
|
return $app;
|