Files
librenms-librenms/app/Console/Kernel.php
Tony Murray def8b3e514 Add librenms command (#9619)
* Add librenms command

Hook up to artisan.  Hide dev commands and most other commands if app environment is production.
Register all commands for php artisan or when not in production.

* remove dead end line

* Console application name and version.
Had to shift some stuff from legacy code, but deferred others as it was too extensive of a change.

* switch check order

* always get local version now

* update array format

* whitepace

* fix style
2019-01-08 21:42:56 -06:00

55 lines
1.2 KiB
PHP

<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use LibreNMS\Util\Version;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
if ($this->app->environment() !== 'production') {
require base_path('routes/dev-console.php');
}
}
protected function getArtisan()
{
if (is_null($this->artisan)) {
parent::getArtisan();
$this->artisan->setName(\LibreNMS\Config::get('project_name', 'LibreNMS'));
$this->artisan->setVersion(Version::get()->local());
}
return $this->artisan;
}
}