mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use LibreNMS\Util\Version;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
@@ -12,10 +13,7 @@ class Kernel extends ConsoleKernel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
Commands\Release::class,
|
||||
Commands\Ping::class,
|
||||
];
|
||||
protected $commands = [];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
@@ -37,5 +35,20 @@ class Kernel extends ConsoleKernel
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user