mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix validate using non-builtin functions too early (#11436)
* fix validate using non-builtin functions too early
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\ValidationResult;
|
||||
use LibreNMS\Validator;
|
||||
@@ -82,18 +81,18 @@ if (!file_exists('config.php')) {
|
||||
|
||||
$pre_checks_failed = false;
|
||||
$syntax_check = `php -ln config.php`;
|
||||
if (!Str::contains($syntax_check, 'No syntax errors detected')) {
|
||||
if (strpos($syntax_check, 'No syntax errors detected') === false) {
|
||||
print_fail('Syntax error in config.php');
|
||||
echo $syntax_check;
|
||||
$pre_checks_failed = true;
|
||||
}
|
||||
|
||||
$first_line = rtrim(`head -n1 config.php`);
|
||||
if (!Str::startsWith($first_line, '<?php')) {
|
||||
if (!strpos($first_line, '<?php') === 0) {
|
||||
print_fail("config.php doesn't start with a <?php - please fix this ($first_line)");
|
||||
$pre_checks_failed = true;
|
||||
}
|
||||
if (Str::contains(`tail config.php`, '?>')) {
|
||||
if (strpos(`tail config.php`, '?>') !== false) {
|
||||
print_fail("Remove the ?> at the end of config.php");
|
||||
$pre_checks_failed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user