Update to Laravel 5.7 (PHP 7.3 support) (#9800)

* Move assets to 5.7 location

* Add 5.7 SVGs

* add cache data dir

* update QUEUE_DRIVER -> QUEUE_CONNECTION

* Update trusted proxy config

* update composer.json

* 5.5 command loading

* @php and @endphp can't be inline

* Laravel 5.6 logging, Nice!

* Update blade directives

* improved redirects

* remove unneeded service providers

* Improved debugbar loading

* no need to emulate renderable exceptions anymore

* merge updated 5.7 files (WIP)

* Enable CSRF

* database_path() call causes issue in init.php

* fix old testcase name

* generic phpunit 7 fixes

* add missed file_get_contents
Keep migrations table content

* fix duplicate key

* Drop old php versions from travis-ci

* remove hhvm

* fix code climate message

* remove use of deprecated function assertInternalType

* Disable CSRF, we'll enable it separately.
All forms need to be updated to work.

* Update document references
This commit is contained in:
Tony Murray 2019-02-12 17:45:04 -06:00 committed by GitHub
parent 25954ccda6
commit e18f4522d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 3056 additions and 1330 deletions

View File

@ -1,19 +1,15 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
[**.css]
indent_style = space
indent_size = 2
[**.php]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2

2
.gitignore vendored
View File

@ -29,6 +29,8 @@ patches
!/lib/yaml
/vendor
/node_modules
npm-debug.log
yarn-error.log
composer.phar
_ide_helper.php

View File

@ -5,19 +5,12 @@ services:
matrix:
fast_finish: true
include:
- php: 7.2
- php: 7.3
env: SKIP_STYLE_CHECK=1
- php: 7.1
- php: 7.2
env: SKIP_UNIT_CHECK=1
- php: 7.0
env: SKIP_STYLE_CHECK=1 SKIP_UNIT_CHECK=1
- php: 5.6
- php: 7.1
env: SKIP_STYLE_CHECK=1 EXECUTE_BUILD_DOCS=true
# - php: hhvm
# env: SKIP_STYLE_CHECK=1
allow_failures:
- php: hhvm
cache:
directories:

View File

@ -83,48 +83,15 @@ class Laravel
public static function enableCliDebugOutput()
{
if (class_exists('\Log')) {
$logger = Log::getMonolog();
// only install if not existing
$install = true;
$logfile = Config::get('log_file', base_path('logs/librenms.log'));
foreach ($logger->getHandlers() as $handler) {
if ($handler instanceof \Monolog\Handler\StreamHandler) {
if ($handler->getUrl() == 'php://stdout') {
$install = false;
} elseif ($handler->getUrl() == $logfile) {
// send to librenms log file if not a cli app
if (!App::runningInConsole()) {
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
Log::error("$errno $errfile:$errline $errstr");
});
$handler->setLevel(\Monolog\Logger::DEBUG);
}
}
}
}
if ($install) {
$handler = new \Monolog\Handler\StreamHandler(
'php://stdout',
\Monolog\Logger::DEBUG
);
$handler->setFormatter(new CliColorFormatter());
$logger->pushHandler($handler);
}
if (class_exists('\Log') && App::runningInConsole()) {
Log::setDefaultDriver('console');
}
}
public static function disableCliDebugOutput()
{
if (class_exists('Log')) {
$handlers = Log::getMonolog()->getHandlers();
if (isset($handlers[0]) && $handlers[0]->getUrl() == 'php://stdout') {
Log::getMonolog()->popHandler();
}
Log::setDefaultDriver('logfile');
}
}
}

View File

@ -95,7 +95,7 @@ class ModuleTestHelper
if (is_null(self::$module_tables)) {
// only load the yaml once, then keep it in memory
self::$module_tables = Yaml::parse($install_dir . '/tests/module_tables.yaml');
self::$module_tables = Yaml::parse(file_get_contents($install_dir . '/tests/module_tables.yaml'));
}
}

View File

@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
\App\Console\Commands\BashCompletionCommand::class,
//
];
/**
@ -30,12 +30,14 @@ class Kernel extends ConsoleKernel
}
/**
* Register the Closure based commands for the application.
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
if ($this->app->environment() !== 'production') {

View File

@ -27,11 +27,6 @@ class Handler extends ExceptionHandler
public function render($request, Exception $exception)
{
// emulate Laravel 5.5 renderable exceptions
if (method_exists($exception, 'render')) {
return $exception->render($request);
}
return parent::render($request, $exception);
}

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
@ -48,9 +49,9 @@ class RegisterController extends Controller
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:6', 'confirmed'],
]);
}
@ -65,7 +66,7 @@ class RegisterController extends Controller
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'password' => Hash::make($data['password']),
]);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -33,7 +33,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class, // Works in Laravel 5.5
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\LegacyExternalAuth::class,
@ -64,11 +64,29 @@ class Kernel extends HttpKernel
'2fa' => \App\Http\Middleware\VerifyTwoFactor::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
/**
* The priority-sorted list of middleware.
*
* This forces non-global middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Auth\Middleware\Authenticate::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
public function bootstrap()
{

View File

@ -2,9 +2,9 @@
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends BaseEncrypter
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.

View File

@ -2,9 +2,9 @@
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends BaseTrimmer
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.

View File

@ -2,10 +2,17 @@
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends BaseVerifier
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;
/**
* The URIs that should be excluded from CSRF verification.
*

View File

@ -31,43 +31,9 @@ class AppServiceProvider extends ServiceProvider
// load config
Config::load();
// replace early boot logging redirect log to config location, unless APP_LOG is set
Log::getMonolog()->popHandler(); // remove existing errorlog logger
Log::useFiles(config('app.log') ?: Config::get('log_file', base_path('logs/librenms.log')), 'error');
// Blade directives (Yucky because of < L5.5)
Blade::directive('config', function ($key) {
return "<?php if (\LibreNMS\Config::get(($key))): ?>";
});
Blade::directive('notconfig', function ($key) {
return "<?php if (!\LibreNMS\Config::get(($key))): ?>";
});
Blade::directive('endconfig', function () {
return "<?php endif; ?>";
});
Blade::directive('admin', function () {
return "<?php if (auth()->check() && auth()->user()->isAdmin()): ?>";
});
Blade::directive('endadmin', function () {
return "<?php endif; ?>";
});
$this->bootCustomBladeDirectives();
$this->bootCustomValidators();
$this->configureMorphAliases();
// Development service providers
if ($this->app->environment() !== 'production') {
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
if (config('app.debug') && class_exists(\Barryvdh\Debugbar\ServiceProvider::class)) {
// disable debugbar for api routes
if (!Request::is('api/*')) {
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
}
}
}
}
/**
@ -80,6 +46,19 @@ class AppServiceProvider extends ServiceProvider
$this->registerGeocoder();
}
private function bootCustomBladeDirectives()
{
Blade::if('config', function ($key) {
return \LibreNMS\Config::get($key);
});
Blade::if('notconfig', function ($key) {
return !\LibreNMS\Config::get($key);
});
Blade::if('admin', function () {
return auth()->check() && auth()->user()->isAdmin();
});
}
private function configureMorphAliases()
{
Relation::morphMap([

View File

@ -12,8 +12,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'Illuminate\Auth\Events\Login' => ['App\Listeners\AuthEventListener@login'],
'Illuminate\Auth\Events\Logout' => ['App\Listeners\AuthEventListener@logout'],
\Illuminate\Auth\Events\Login::class => ['App\Listeners\AuthEventListener@login'],
\Illuminate\Auth\Events\Logout::class => ['App\Listeners\AuthEventListener@logout'],
];
/**

0
artisan Normal file → Executable file
View File

View File

@ -12,7 +12,7 @@
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
@ -41,11 +41,6 @@ $app->singleton(
App\Exceptions\Handler::class
);
$app->configureMonologUsing(function (Monolog\Logger $logger) use ($app) {
$path = config('app.log') ?: $app->basePath('logs/librenms.log');
$logger->pushHandler(new \Monolog\Handler\StreamHandler($path, \Monolog\Logger::toMonologLevel(config('app.log_level', 'debug'))));
});
/*
|--------------------------------------------------------------------------
| Return The Application

View File

@ -20,7 +20,7 @@
}
],
"require": {
"php": ">=5.6.4",
"php": "^7.1.3",
"ext-pdo": "*",
"ext-pcre": "*",
"ext-curl": "*",
@ -29,6 +29,7 @@
"ext-gd": "*",
"ext-json": "*",
"ext-mbstring": "*",
"laravel/laravel": "5.7.*",
"ezyang/htmlpurifier": "^4.8",
"phpmailer/phpmailer": "^5.2.21",
"slim/slim": "^2.6",
@ -40,27 +41,29 @@
"pear/console_table": "^1.3",
"dapphp/radius": "^2.0",
"php-amqplib/php-amqplib": "^2.0",
"symfony/yaml": "^2.8",
"symfony/yaml": "^4.0",
"rmccue/requests": "^1.7",
"palanik/corsslim": "^1.1",
"influxdb/influxdb-php": "^1.14",
"laravel/laravel": "5.4.*",
"oriceon/toastr-5-laravel": "dev-master",
"wpb/string-blade-compiler": "3.4.x-dev",
"fico7489/laravel-pivot": "2.*",
"wpb/string-blade-compiler": "3.7.x-dev",
"fico7489/laravel-pivot": "^3.0",
"fideloper/proxy": "^4.0",
"doctrine/dbal": "^2.5"
"doctrine/dbal": "^2.9"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"squizlabs/php_codesniffer": "^2.9.1",
"phpunit/phpunit": "5.*",
"jakub-onderka/php-parallel-lint": "*",
"jakub-onderka/php-console-highlighter": "*",
"fojuth/readmegen": "1.*",
"barryvdh/laravel-ide-helper": "^2.4",
"barryvdh/laravel-debugbar": "~2.4",
"justinrainbow/json-schema": "^5.2",
"fzaninotto/faker": "^1.8"
"barryvdh/laravel-ide-helper": "^2.5",
"barryvdh/laravel-debugbar": "^3.2",
"justinrainbow/json-schema": "^5.2"
},
"suggest": {
"ext-memcached": "Required if you utilize distributed polling",
@ -69,10 +72,13 @@
},
"autoload": {
"exclude-from-classmap": [
"/vendor/laravel/laravel/database/"
"/vendor/laravel/laravel/database/",
"/vendor/laravel/laravel/app/",
"/vendor/jakub-onderka/php-parallel-lint/src/JsonSerializable.php"
],
"classmap": [
"database"
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app",
@ -84,21 +90,28 @@
"includes/helpers.php"
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"pre-update-cmd": "LibreNMS\\ComposerHelper::preUpdate",
"pre-install-cmd": "LibreNMS\\ComposerHelper::preInstall",
"post-root-package-install": "LibreNMS\\ComposerHelper::postRootPackageInstall",
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-create-project-cmd": [
"php artisan key:generate"
"@php artisan key:generate --ansi"
],
"post-install-cmd": [
"LibreNMS\\ComposerHelper::postInstall",
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
"Illuminate\\Foundation\\ComposerScripts::postInstall"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
"Illuminate\\Foundation\\ComposerScripts::postUpdate"
]
}
}

3129
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ return [
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'LibreNMS'),
@ -21,7 +22,7 @@ return [
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
| services the application utilizes. Set this in your ".env" file.
|
*/
@ -53,6 +54,8 @@ return [
'url' => env('APP_URL'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
@ -92,6 +95,19 @@ return [
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
@ -107,23 +123,6 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => env('APP_LOG'), // log file to write to
'log_level' => env('APP_LOG_LEVEL', 'error'),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
@ -162,12 +161,6 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
/*
* Package Service Providers...
*/
Kamaln7\Toastr\ToastrServiceProvider::class,
Fideloper\Proxy\TrustedProxyServiceProvider::class,
/*
* Application Service Providers...
*/

View File

@ -36,7 +36,8 @@ return [
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
//
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Str;
return [
/*
@ -57,7 +59,7 @@ return [
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
@ -70,7 +72,7 @@ return [
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'connection' => 'cache',
],
],
@ -86,6 +88,6 @@ return [
|
*/
'prefix' => 'laravel',
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

View File

@ -41,6 +41,7 @@ return [
// 'driver' => 'sqlite',
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
// 'prefix' => '',
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
// ],
'mysql' => [
@ -54,6 +55,7 @@ return [
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
],
@ -67,6 +69,7 @@ return [
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
@ -80,6 +83,7 @@ return [
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
@ -103,7 +107,7 @@ return [
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
@ -116,7 +120,14 @@ return [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'database' => env('REDIS_DB', 0),
],
'cache' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
],
],

View File

@ -10,11 +10,13 @@ return [
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
'api*' // won't work until DebugBar 3.*
'api*'
],
/*
@ -119,6 +121,7 @@ return [
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
],
/*
@ -140,7 +143,7 @@ return [
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
@ -156,6 +159,9 @@ return [
'logs' => [
'file' => null
],
'cache' => [
'values' => true // collect cache values
],
],
/*

View File

@ -37,7 +37,7 @@ return [
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
@ -57,10 +57,11 @@ return [
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],

52
config/hashing.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

100
config/logging.php Normal file
View File

@ -0,0 +1,100 @@
<?php
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'logfile'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'logfile' => [
'driver' => 'stack',
'channels' => ['daily'],
'ignore_exceptions' => false,
],
'console' => [
'driver' => 'stack',
'channels' => ['daily', 'stderr'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => \LibreNMS\Util\CliColorFormatter::class,
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];

View File

@ -120,4 +120,17 @@ return [
],
],
/*
|--------------------------------------------------------------------------
| Log Channel
|--------------------------------------------------------------------------
|
| If you are using the "log" driver, you may specify the logging channel
| if you prefer to keep mail messages separate from other log entries
| for simpler reading. Otherwise, the default channel will be used.
|
*/
'log_channel' => env('MAIL_LOG_CHANNEL'),
];

View File

@ -4,18 +4,16 @@ return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
@ -26,6 +24,8 @@ return [
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
@ -50,18 +50,19 @@ return [
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
'queue' => 'your-queue-name',
'region' => 'us-east-1',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],

View File

@ -17,12 +17,13 @@ return [
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
'region' => env('SES_REGION', 'us-east-1'),
],
'sparkpost' => [
@ -33,6 +34,10 @@ return [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
'webhook' => [
'secret' => env('STRIPE_WEBHOOK_SECRET'),
'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
],
],
];

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Str;
return [
/*
@ -29,7 +31,7 @@ return [
|
*/
'lifetime' => 120,
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
@ -70,7 +72,7 @@ return [
|
*/
'connection' => null,
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
@ -96,7 +98,7 @@ return [
|
*/
'store' => null,
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
@ -122,7 +124,10 @@ return [
|
*/
'cookie' => 'librenms_session',
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
@ -176,4 +181,19 @@ return [
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];

18
config/tinker.php Normal file
View File

@ -0,0 +1,18 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Alias Blacklist
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [],
];

View File

@ -19,33 +19,32 @@ return [
/*
* To trust one or more specific proxies that connect
* directly to your server, use an array of IP addresses:
* directly to your server, use an array or a string separated by comma of IP addresses:
*/
# 'proxies' => ['192.168.1.1'],
// 'proxies' => ['192.168.1.1'],
// 'proxies' => '192.168.1.1, 192.168.1.2',
/*
* Or, to trust all proxies that connect
* directly to your server, use a "*"
*/
# 'proxies' => '*',
// 'proxies' => '*',
/*
* Which headers to use to detect proxy related data (For, Host, Proto, Port)
*
*
* Options include:
*
*
* - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust)
* - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust)
*
* - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer)
*
* - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust)
* - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust)
* - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer)
*
* @link https://symfony.com/doc/current/deployment/proxies.html
*/
'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
// 'headers' => [
// (defined('Illuminate\Http\Request::HEADER_FORWARDED') ? Illuminate\Http\Request::HEADER_FORWARDED : 'forwarded') => 'FORWARDED',
// \Illuminate\Http\Request::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
// \Illuminate\Http\Request::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
// \Illuminate\Http\Request::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
// \Illuminate\Http\Request::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
// ]
];

View File

@ -28,6 +28,9 @@ return [
|
*/
'compiled' => realpath(storage_path('framework/views')),
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

View File

@ -5,7 +5,7 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
* Seed the application's database.
*
* @return void
*/

View File

@ -17,7 +17,7 @@ of the transport config to get it ready for use.
actually interacts with the 3rd party API, invokes the mail command or whatever you want your alert to do.
`configTemplate()` - This is used to define the form that will accept the transport config in the webui and then what
data should be validated and how. Validation is done using [Laravel validation](https://laravel.com/docs/5.4/validation)
data should be validated and how. Validation is done using [Laravel validation](https://laravel.com/docs/5.7/validation)
The following function is __not__ required for new Transports and is for legacy reasons only. `deliverAlertOld()`.

View File

@ -9,7 +9,7 @@ Templates can be assigned to a single or a group of rules and can contain any ki
To attach a template to a rule just open the `Alert Templates` settings page, choose the template to assign and click the yellow button in the `Actions` column. In the appearing popupbox select the rule(s) you want the template to be assigned to and click the `Attach` button. You might hold down the CTRL key to select multiple rules at once.
The templating engine in use is Laravel Blade. We will cover some of the basics here, however the official Laravel docs will have more information [here](https://laravel.com/docs/5.4/blade)
The templating engine in use is Laravel Blade. We will cover some of the basics here, however the official Laravel docs will have more information [here](https://laravel.com/docs/5.7/blade)
## Syntax
@ -107,7 +107,7 @@ In your alert template just use
@endsection
```
More info: https://laravel.com/docs/5.4/blade#extending-a-layout
More info: https://laravel.com/docs/5.7/blade#extending-a-layout
## Examples

View File

@ -1,5 +1,6 @@
<?php
//FIXME remove Deprecated template
/**
* convert-template.inc.php
*
@ -58,55 +59,55 @@ function convert_template($line)
'/%([\w\d]+)\.([\w\d]+)/',// Replaces %something.anything
],
[
'@php echo \1; @endphp ',
"@php\necho \\1;\n@endphp ",
'$value[\'\2\']',
],
$line
);
} else {
$old1 = $line;
$find = [
'/{if %([\w=\s]+)}/',// Replaces {if %something == else}
'/{else}/',// Replaces {else}
'/{\/if}/',// Replaces {/if}
'/{foreach %faults}/',// Replaces {foreach %faults}
'/{foreach %contacts}/',// Replaces {foreach %contacts}
'/{\/foreach}/',// Replaces {/foreach}
'/{calc[ ]*([\w\d\s\%\.\(\)\*\/\-\+\/]+)}/',// Replaces {calc (something*100)}
'/%value.string/',// Replaces %value.string
'/%([\w\d]+)\.([\w\d]+)/',// Replaces %something.anything
'/%([\w\d]+)/',// Replaces %anything
];
$replace = [
' @if ($alert->\1) ',
' @else ',
' @endif ',
' @foreach ($alert->faults as $key => $value)',
' @foreach ($alert->contacts as $key => $value)',
' @endforeach ',
' @php echo \1; @endphp ',
'{{ $value[\'string\'] }}',
'{{ $\1[\'\2\'] }}',
'{{ $alert->\1 }}',
];
$old1 = preg_replace($find, $replace, $old1);
// Revert some over-zealous changes:
$find = [
'/\$alert->key/',
'/\$alert->value/',
];
$replace = [
'$key',
'$value',
];
return preg_replace($find, $replace, $old1);
}
$old1 = $line;
$find = [
'/{if %([\w=\s]+)}/',// Replaces {if %something == else}
'/{else}/',// Replaces {else}
'/{\/if}/',// Replaces {/if}
'/{foreach %faults}/',// Replaces {foreach %faults}
'/{foreach %contacts}/',// Replaces {foreach %contacts}
'/{\/foreach}/',// Replaces {/foreach}
'/{calc[ ]*([\w\d\s\%\.\(\)\*\/\-\+\/]+)}/',// Replaces {calc (something*100)}
'/%value.string/',// Replaces %value.string
'/%([\w\d]+)\.([\w\d]+)/',// Replaces %something.anything
'/%([\w\d]+)/',// Replaces %anything
];
$replace = [
' @if ($alert->\1) ',
' @else ',
' @endif ',
' @foreach ($alert->faults as $key => $value)',
' @foreach ($alert->contacts as $key => $value)',
' @endforeach ',
" @php\necho \\1;\n@endphp ",
'{{ $value[\'string\'] }}',
'{{ $\1[\'\2\'] }}',
'{{ $alert->\1 }}',
];
$old1 = preg_replace($find, $replace, $old1);
// Revert some over-zealous changes:
$find = [
'/\$alert->key/',
'/\$alert->value/',
];
$replace = [
'$key',
'$value',
];
return preg_replace($find, $replace, $old1);
}
die(json_encode([
'status' => 'ok',
'message' => 'Template converted, review and save to update',
'status' => 'ok',
'message' => 'Template converted, review and save to update',
'template' => $new_body,
'title' => $new_title,
'title' => $new_title,
]));

View File

@ -76,6 +76,7 @@ if (empty($config['favicon'])) {
<link rel="manifest" href="images/manifest.json">
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="images/favicon.ico">
<meta name="csrf-token" content="<?php echo csrf_token(); ?>">
<meta name="msapplication-config" content="images/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<?php
@ -148,6 +149,12 @@ foreach ((array)$config['webui']['custom_css'] as $custom_css) {
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600');");
}
// End -->
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
<script type="text/javascript" src="js/overlib_mini.js"></script>
<script type="text/javascript" src="js/toastr.min.js"></script>

1
html/svg/403.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.5 KiB

1
html/svg/404.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1024 1024"><defs><linearGradient id="a" x1="50.31%" x2="50%" y1="74.74%" y2="0%"><stop offset="0%" stop-color="#FFE98A"/><stop offset="67.7%" stop-color="#B63E59"/><stop offset="100%" stop-color="#68126F"/></linearGradient><circle id="c" cx="603" cy="682" r="93"/><filter id="b" width="203.2%" height="203.2%" x="-51.6%" y="-51.6%" filterUnits="objectBoundingBox"><feOffset in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="32"/><feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter><linearGradient id="d" x1="49.48%" x2="49.87%" y1="11.66%" y2="77.75%"><stop offset="0%" stop-color="#F7EAB9"/><stop offset="100%" stop-color="#E5765E"/></linearGradient><linearGradient id="e" x1="91.59%" x2="66.97%" y1="5.89%" y2="100%"><stop offset="0%" stop-color="#A22A50"/><stop offset="100%" stop-color="#EE7566"/></linearGradient><linearGradient id="f" x1="49.48%" x2="49.61%" y1="11.66%" y2="98.34%"><stop offset="0%" stop-color="#F7EAB9"/><stop offset="100%" stop-color="#E5765E"/></linearGradient><linearGradient id="g" x1="78.5%" x2="36.4%" y1="106.76%" y2="26.41%"><stop offset="0%" stop-color="#A22A50"/><stop offset="100%" stop-color="#EE7566"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><rect width="1024" height="1024" fill="url(#a)"/><use fill="black" filter="url(#b)" xlink:href="#c"/><use fill="#FFF6CB" xlink:href="#c"/><g fill="#FFFFFF" opacity=".3" transform="translate(14 23)"><circle cx="203" cy="255" r="3" fill-opacity=".4"/><circle cx="82" cy="234" r="2"/><circle cx="22" cy="264" r="2" opacity=".4"/><circle cx="113" cy="65" r="3"/><circle cx="202" cy="2" r="2"/><circle cx="2" cy="114" r="2"/><circle cx="152" cy="144" r="2"/><circle cx="362" cy="224" r="2"/><circle cx="453" cy="65" r="3" opacity=".4"/><circle cx="513" cy="255" r="3"/><circle cx="593" cy="115" r="3"/><circle cx="803" cy="5" r="3" opacity=".4"/><circle cx="502" cy="134" r="2"/><circle cx="832" cy="204" r="2"/><circle cx="752" cy="114" r="2"/><circle cx="933" cy="255" r="3" opacity=".4"/><circle cx="703" cy="225" r="3"/><circle cx="903" cy="55" r="3"/><circle cx="982" cy="144" r="2"/><circle cx="632" cy="14" r="2"/></g><g transform="translate(0 550)"><path fill="#8E2C15" d="M259 5.47c0 5.33 3.33 9.5 10 12.5s9.67 9.16 9 18.5h1c.67-6.31 1-11.8 1-16.47 8.67 0 13.33-1.33 14-4 .67 4.98 1.67 8.3 3 9.97 1.33 1.66 2 5.16 2 10.5h1c0-5.65.33-9.64 1-11.97 1-3.5 4-10.03-1-14.53S295 7 290 3c-5-4-10-3-13 2s-5 7-9 7-5-3.53-5-5.53c0-2 2-5-1.5-5s-7.5 0-7.5 2c0 1.33 1.67 2 5 2z"/><path fill="url(#d)" d="M1024 390H0V105.08C77.3 71.4 155.26 35 297.4 35c250 0 250.76 125.25 500 125 84.03-.08 160.02-18.2 226.6-40.93V390z"/><path fill="url(#d)" d="M1024 442H0V271.82c137.51-15.4 203.1-50.49 356.67-60.1C555.24 199.3 606.71 86.59 856.74 86.59c72.78 0 124.44 10.62 167.26 25.68V442z"/><path fill="url(#e)" d="M1024 112.21V412H856.91c99.31-86.5 112.63-140.75 39.97-162.78C710.24 192.64 795.12 86.58 856.9 86.58c72.7 0 124.3 10.6 167.09 25.63z"/><path fill="url(#e)" d="M1024 285.32V412H857c99.31-86.6 112.63-140.94 39.97-163L1024 285.32z"/><path fill="url(#f)" d="M0 474V223.93C67.12 190.69 129.55 155 263 155c250 0 331.46 162.6 530 175 107.42 6.71 163-26.77 231-58.92V474H0z"/><path fill="url(#e)" d="M353.02 474H0V223.93C67.12 190.69 129.55 155 263 155c71.14 0 151.5 12.76 151.5 70.5 0 54.5-45.5 79.72-112.5 109-82.26 35.95-54.57 111.68 51.02 139.5z"/><path fill="url(#g)" d="M353.02 474H0v-14.8l302-124.7c-82.26 35.95-54.57 111.68 51.02 139.5z"/></g><g fill="#FFFFFF" opacity=".2" transform="translate(288 523)"><circle cx="250" cy="110" r="110"/><circle cx="420" cy="78" r="60"/><circle cx="70" cy="220" r="70"/></g><g fill="#FFFFFF" fill-rule="nonzero" opacity=".08" transform="translate(135 316)"><path d="M10 80.22a14.2 14.2 0 0 1 20 0 14.2 14.2 0 0 0 20 0l20-19.86a42.58 42.58 0 0 1 60 0l15 14.9a21.3 21.3 0 0 0 30 0 21.3 21.3 0 0 1 30 0l.9.9A47.69 47.69 0 0 1 220 110H0v-5.76c0-9.02 3.6-17.67 10-24.02zm559.1-66.11l5.9-5.86c11.07-11 28.93-11 40 0l10 9.94a14.19 14.19 0 0 0 20 0 14.19 14.19 0 0 1 20 0 16.36 16.36 0 0 0 21.3 1.5l8.7-6.47a33.47 33.47 0 0 1 40 0l4.06 3.03A39.6 39.6 0 0 1 755 48H555a47.77 47.77 0 0 1 14.1-33.89z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

1
html/svg/500.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

1
html/svg/503.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -93,12 +93,12 @@ modules:
oid: rf2Operation
state_name: rf2Operation
states:
- { value: 0, descr: None, graph: 1, generic: 1 }
- { value: 1, descr: Booting, graph: 1, generic: 1 }
- { value: 2, descr: Ok, graph: 1, generic: 0, descr: Ok }
- { value: 3, descr: Testing, graph: 1, generic: 1 }
- { value: 4, descr: Error, graph: 1, generic: 2 }
- { value: 5, descr: 'No data from ODU', graph: 1, generic: 2 }
- { value: 0, graph: 1, generic: 1, descr: None }
- { value: 1, graph: 1, generic: 1, descr: Booting }
- { value: 2, graph: 1, generic: 0, descr: Ok }
- { value: 3, graph: 1, generic: 1, descr: Testing }
- { value: 4, graph: 1, generic: 2, descr: Error }
- { value: 5, graph: 1, generic: 2, descr: 'No data from ODU' }
-
descr: 'R1 Humidity'
index: 'rf1OduHumidity.{{ $index }}'

View File

@ -1,21 +1,25 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
"sass-loader": "^7.1.0",
"vue": "^2.5.17"
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
<phpunit backupGlobals="true"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
@ -32,8 +33,10 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

View File

@ -1,23 +0,0 @@
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>

View File

@ -1,38 +0,0 @@
// Body
$body-bg: #f5f8fa;
// Borders
$laravel-border-color: darken($body-bg, 10%);
$list-group-border: $laravel-border-color;
$navbar-default-border: $laravel-border-color;
$panel-default-border: $laravel-border-color;
$panel-inner-border: $laravel-border-color;
// Brands
$brand-primary: #3097D1;
$brand-info: #8eb4cb;
$brand-success: #2ab27b;
$brand-warning: #cbb956;
$brand-danger: #bf5329;
// Typography
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
$font-family-sans-serif: "Raleway", sans-serif;
$font-size-base: 14px;
$line-height-base: 1.6;
$text-color: #636b6f;
// Navbar
$navbar-default-bg: #fff;
// Buttons
$btn-default-color: $text-color;
// Inputs
$input-border: lighten($text-color, 40%);
$input-border-focus: lighten($brand-primary, 25%);
$input-color-placeholder: lighten($text-color, 30%);
// Panels
$panel-default-heading-bg: #fff;

View File

@ -1,9 +0,0 @@
// Fonts
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600");
// Variables
@import "variables";
// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

View File

@ -9,14 +9,23 @@ require('./bootstrap');
window.Vue = require('vue');
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
const files = require.context('./', true, /\.vue$/i)
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: '#app'
});

View File

@ -8,9 +8,10 @@ window._ = require('lodash');
*/
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');
require('bootstrap');
} catch (e) {}
/**
@ -49,5 +50,7 @@ if (token) {
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// key: process.env.MIX_PUSHER_APP_KEY,
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
// encrypted: true
// });

View File

@ -0,0 +1,23 @@
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Example Component</div>
<div class="card-body">
I'm an example component.
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>

View File

@ -13,80 +13,108 @@ return [
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'numeric' => 'The :attribute must be greater than :value.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute must have more than :value items.',
],
'gte' => [
'numeric' => 'The :attribute must be greater than or equal :value.',
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
'string' => 'The :attribute must be greater than or equal :value characters.',
'array' => 'The :attribute must have :value items or more.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'numeric' => 'The :attribute must be less than :value.',
'file' => 'The :attribute must be less than :value kilobytes.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute must have less than :value items.',
],
'lte' => [
'numeric' => 'The :attribute must be less than or equal :value.',
'file' => 'The :attribute must be less than or equal :value kilobytes.',
'string' => 'The :attribute must be less than or equal :value characters.',
'array' => 'The :attribute must not have more than :value items.',
],
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
'starts_with' => 'The :attribute must start with one of the following: :values',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|--------------------------------------------------------------------------
@ -110,9 +138,9 @@ return [
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/

View File

@ -0,0 +1,20 @@
// Body
$body-bg: #f8fafc;
// Typography
$font-family-sans-serif: "Nunito", sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
// Colors
$blue: #3490dc;
$indigo: #6574cd;
$purple: #9561e2;
$pink: #f66D9b;
$red: #e3342f;
$orange: #f6993f;
$yellow: #ffed4a;
$green: #38c172;
$teal: #4dc0b5;
$cyan: #6cb2eb;

14
resources/sass/app.scss Normal file
View File

@ -0,0 +1,14 @@
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import '~bootstrap/scss/bootstrap';
.navbar-laravel {
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

View File

@ -80,6 +80,12 @@
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600');");
}
// End -->
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
<script type="text/javascript" src="js/overlib_mini.js"></script>
<script type="text/javascript" src="js/toastr.min.js"></script>

View File

@ -1,22 +1,21 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
font-family: 'Nunito', sans-serif;
font-weight: 200;
height: 100vh;
margin: 0;
}
@ -52,7 +51,7 @@
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-size: 13px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
@ -68,12 +67,15 @@
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@if (Auth::check())
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ url('/login') }}">Login</a>
<a href="{{ url('/register') }}">Register</a>
@endif
<a href="{{ route('login') }}">Login</a>
@if (Route::has('register'))
<a href="{{ route('register') }}">Register</a>
@endif
@endauth
</div>
@endif
@ -83,9 +85,11 @@
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laravel.com/docs">Docs</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://blog.laravel.com">Blog</a>
<a href="https://nova.laravel.com">Nova</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>

View File

@ -25,9 +25,7 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
Route::get('locations', 'LocationController@index');
// old route redirects
Route::get('poll-log', function () {
return redirect('pollers/tab=log/');
});
Route::permanentRedirect('poll-log', 'pollers/tab=log/');
// Two Factor Auth
Route::get('2fa', 'TwoFactorController@showTwoFactorForm')->name('2fa.form');
@ -105,29 +103,10 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
});
});
// Debugbar routes need to be here because of catch-all
if (config('app.env') !== 'production' && config('app.debug') && config('debugbar.enabled') !== false) {
Route::get('/_debugbar/assets/stylesheets', [
'as' => 'debugbar-css',
'uses' => '\Barryvdh\Debugbar\Controllers\AssetController@css'
]);
Route::get('/_debugbar/assets/javascript', [
'as' => 'debugbar-js',
'uses' => '\Barryvdh\Debugbar\Controllers\AssetController@js'
]);
Route::get('/_debugbar/open', [
'as' => 'debugbar-open',
'uses' => '\Barryvdh\Debugbar\Controllers\OpenController@handler'
]);
}
// demo helper
Route::get('demo', function () {
return redirect('/');
});
Route::permanentRedirect('demo', '/');
// Legacy routes
Route::any('/{path?}', 'LegacyController@index')->where('path', '.*');
Route::any('/{path?}', 'LegacyController@index')
->where('path', '^((?!_debugbar).)*');
});

View File

@ -1,2 +1,3 @@
*
!data/
!.gitignore

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -35,9 +35,9 @@ class AlertTest extends TestCase
public function testJsonAlertCollection()
{
$rules = get_rules_from_json();
$this->assertInternalType('array', $rules);
$this->assertIsArray($rules);
foreach ($rules as $rule) {
$this->assertInternalType('array', $rule);
$this->assertIsArray($rule);
}
}
@ -58,6 +58,8 @@ class AlertTest extends TestCase
}
}
}
$this->expectNotToPerformAssertions();
}
private function getTransportFiles()

View File

@ -217,13 +217,13 @@ class AuthSSOTest extends DBTestCase
$this->basicEnvironmentEnv();
unset($_SERVER);
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authenticate(null, null);
$this->basicEnvironmentHeader();
unset($_SERVER);
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authenticate(null, null);
}
@ -270,7 +270,7 @@ class AuthSSOTest extends DBTestCase
$a = LegacyAuth::reset();
$this->basicEnvironmentEnv();
$this->assertInternalType('string', $a->getExternalUsername());
$this->assertIsString($a->getExternalUsername());
// Missing
unset($_SERVER['REMOTE_USER']);
@ -310,15 +310,15 @@ class AuthSSOTest extends DBTestCase
$this->assertNull($a->authSSOGetAttr('foobar'));
$this->assertNull($a->authSSOGetAttr(null));
$this->assertNull($a->authSSOGetAttr(1));
$this->assertInternalType('string', $a->authSSOGetAttr('alsoVALID-ATTR'));
$this->assertInternalType('string', $a->authSSOGetAttr('HTTP_VALID_ATTR'));
$this->assertIsString($a->authSSOGetAttr('alsoVALID-ATTR'));
$this->assertIsString($a->authSSOGetAttr('HTTP_VALID_ATTR'));
$config['sso']['mode'] = 'header';
$this->assertNull($a->authSSOGetAttr('foobar'));
$this->assertNull($a->authSSOGetAttr(null));
$this->assertNull($a->authSSOGetAttr(1));
$this->assertNull($a->authSSOGetAttr('alsoVALID-ATTR'));
$this->assertInternalType('string', $a->authSSOGetAttr('VALID-ATTR'));
$this->assertIsString($a->authSSOGetAttr('VALID-ATTR'));
}
public function testTrustedProxies()
@ -395,25 +395,25 @@ class AuthSSOTest extends DBTestCase
//Invalid String
$config['sso']['level_attr'] = 'level';
$_SERVER['level'] = 'foobar';
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authSSOCalculateLevel();
//null
$config['sso']['level_attr'] = 'level';
$_SERVER['level'] = null;
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authSSOCalculateLevel();
//Unset pointer
unset($config['sso']['level_attr']);
$_SERVER['level'] = "9";
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authSSOCalculateLevel();
//Unset attr
$config['sso']['level_attr'] = 'level';
unset($_SERVER['level']);
$this->setExpectedException('LibreNMS\Exceptions\AuthenticationException');
$this->expectException('LibreNMS\Exceptions\AuthenticationException');
$a->authSSOCalculateLevel();
}

View File

@ -25,7 +25,7 @@
namespace LibreNMS\Tests;
use PHPUnit_Framework_ExpectationFailedException as PHPUnitException;
use \PHPUnit\Framework\ExpectationFailedException as PHPUnitException;
class DBSetupTest extends DBTestCase
{
@ -37,6 +37,8 @@ class DBSetupTest extends DBTestCase
throw new PHPUnitException("Errors loading DB Schema: " . $output);
}
}
$this->expectNotToPerformAssertions();
}
public function testSchemaFiles()
@ -65,6 +67,8 @@ class DBSetupTest extends DBTestCase
}
}
}
$this->expectNotToPerformAssertions();
}
public function testSchema()

View File

@ -72,5 +72,7 @@ class DocTest extends TestCase
->each(function ($missing_doc) {
$this->fail("The doc $missing_doc doesn't exist in mkdocs.yml, please add it to the relevant section");
});
$this->expectNotToPerformAssertions();
}
}

View File

@ -67,13 +67,13 @@ class IpTest extends TestCase
$this->assertEquals('2001:db8:85a3::8a2e:370:7334', new IPv6('2001:db8:85a3::8a2e:370:7334'));
$this->assertEquals('::1', new IPv6('::1'));
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
new IPv6('192.168.0.1');
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
new IPv6('127.0.0.1');
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
new IPv4('2001:db8:85a3::8a2e:370:7334');
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
new IPv4('::1');
}
@ -94,10 +94,10 @@ class IpTest extends TestCase
$this->assertEquals('::', IP::fromHexString('00000000000000000000000000000000'));
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
IP::fromHexString("c0 a8 01 01 fe");
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
IP::fromHexString('20 01 0d b8 00 00 00 00 00 00 00 00 00 02 00 00 00 01');
}
@ -126,13 +126,13 @@ class IpTest extends TestCase
$this->assertTrue(IP::parse('2001:db8:85a3::8a2e:370:7334')->inNetwork('2001:db8:85a3::8a2e:370:7334/128'));
$this->assertFalse(IP::parse('2001:db8:85a3::8a2e:370:7335')->inNetwork('2001:db8:85a3::8a2e:370:7334/128'));
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
IP::parse('42')->inNetwork('192.168.1.0/4');
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
IP::parse('192.168.1.256')->inNetwork('192.168.1.0/24');
$this->setExpectedException('LibreNMS\Exceptions\InvalidIpException');
$this->expectException('LibreNMS\Exceptions\InvalidIpException');
IP::parse('192.168.1.0')->inNetwork('192.168.1.0');
}

View File

@ -39,14 +39,18 @@ class LockTest extends TestCase
unset($new_lock);
FileLock::lock('tests');
$this->expectNotToPerformAssertions();
}
public function testFileLockFail()
{
$lock = FileLock::lock('tests');
$this->setExpectedException('LibreNMS\Exceptions\LockException');
$this->expectException('LibreNMS\Exceptions\LockException');
$failed_lock = FileLock::lock('tests');
$this->expectNotToPerformAssertions();
}
public function testFileLockWait()
@ -54,7 +58,7 @@ class LockTest extends TestCase
$lock = FileLock::lock('tests');
$start = microtime(true);
$this->setExpectedException('LibreNMS\Exceptions\LockException');
$this->expectException('LibreNMS\Exceptions\LockException');
$wait_lock = FileLock::lock('tests', 1);
$this->assertGreaterThan(1, microtime(true) - $start, 'Lock did not wait.');

View File

@ -92,7 +92,7 @@ class RrdtoolTest extends TestCase
$config['rrdcached'] = '';
$config['rrdtool_version'] = '1.4';
$this->setExpectedException('LibreNMS\Exceptions\FileExistsException');
$this->expectException('LibreNMS\Exceptions\FileExistsException');
// use this file, since it is guaranteed to exist
rrdtool_build_command('create', __FILE__, 'o');
}

View File

@ -27,7 +27,7 @@ namespace LibreNMS\Tests;
use LibreNMS\Util\Snmpsim;
abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
use SnmpsimHelpers;

View File

@ -101,6 +101,7 @@ if (getenv('DBTEST')) {
'alert_templates',
'config', // not sure about this one
'dbSchema',
'migrations',
'widgets',
);
$truncate = array_diff($tables, $excluded);

View File

@ -1,4 +1,4 @@
let mix = require('laravel-mix');
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
@ -11,5 +11,5 @@ let mix = require('laravel-mix');
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');