mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Implement system for user packages in composer (#13718)
This commit is contained in:
@@ -28,6 +28,7 @@ namespace LibreNMS\Validations;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
use LibreNMS\ComposerHelper;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Util\EnvHelper;
|
||||
use LibreNMS\Util\Git;
|
||||
@@ -101,12 +102,17 @@ class Updates extends BaseValidation
|
||||
$modifiedcmd = 'git diff --name-only --exit-code';
|
||||
$validator->execAsUser($modifiedcmd, $cmdoutput, $code);
|
||||
if ($code !== 0 && ! empty($cmdoutput)) {
|
||||
$result = ValidationResult::warn(
|
||||
'Your local git contains modified files, this could prevent automatic updates.',
|
||||
'You can fix this with ./scripts/github-remove'
|
||||
);
|
||||
$result->setList('Modified Files', $cmdoutput);
|
||||
$validator->result($result);
|
||||
|
||||
// Check so it's not only plugins that "pests" the diff
|
||||
if (! ($cmdoutput === ['composer.json', 'composer.lock'] && ComposerHelper::getPlugins())) {
|
||||
$result = ValidationResult::warn(
|
||||
'Your local git contains modified files, this could prevent automatic updates.',
|
||||
'You can fix this with ./scripts/github-remove'
|
||||
);
|
||||
|
||||
$result->setList('Modified Files', $cmdoutput);
|
||||
$validator->result($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user