lancache-autofill/lancache-autofill
ilumos 1a8ceb1ad5 Switching from console app class to full app class
Old: Illuminate\Console\Application
New: Illuminate\Foundation\Application
To allow for loading of service providers
2017-12-09 01:05:15 +00:00

49 lines
1.3 KiB
PHP
Executable file

#!/usr/bin/env php
<?php
use Dotenv\Dotenv;
use Illuminate\Database\Capsule\Manager as Capsule;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
require_once __DIR__ . '/vendor/autoload.php';
// Load environment variables
$dotenv = new Dotenv(__DIR__);
$dotenv->load();
$dotenv->required(['DOWNLOADS_DIRECTORY', 'STEAMCMD_PATH']);
// Create the application
$app = new Illuminate\Foundation\Application(realpath(__DIR__));
// Register the console kernel
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
Zeropingheroes\LancacheAutofill\Console\Kernel::class
);
// Register the exception handler
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
Zeropingheroes\LancacheAutofill\Exceptions\Handler::class
);
// Set up the SQLite database connection
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'sqlite',
'database' => 'database.sqlite',
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();
// Run the console application
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new ArgvInput,
new ConsoleOutput
);
// Send output to the console once finished
$kernel->terminate($input, $status);
exit($status);