mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Restore vendor contents even if composer is not available (#8223)
* Restore vendor contents even if composer is not available Leave the code in both places for safety. * Instruct users to use the wrapper instead of straight up composer...
This commit is contained in:
6
daily.sh
6
daily.sh
@@ -227,6 +227,12 @@ main () {
|
|||||||
status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
|
status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
|
||||||
;;
|
;;
|
||||||
post-pull)
|
post-pull)
|
||||||
|
# Check for missing vendor dir
|
||||||
|
if [ ! -f vendor/autoload.php ]; then
|
||||||
|
git checkout 609676a9f8d72da081c61f82967e1d16defc0c4e -- vendor/
|
||||||
|
git reset HEAD vendor/ # don't add vendor directory to the index
|
||||||
|
fi
|
||||||
|
|
||||||
status_run 'Updating Composer packages' "${COMPOSER} install --no-dev" 'update'
|
status_run 'Updating Composer packages' "${COMPOSER} install --no-dev" 'update'
|
||||||
|
|
||||||
# Check if we need to revert (Must be in post pull so we can update it)
|
# Check if we need to revert (Must be in post pull so we can update it)
|
||||||
|
@@ -39,7 +39,7 @@ require_once $install_dir . '/includes/common.php';
|
|||||||
|
|
||||||
# composer autoload
|
# composer autoload
|
||||||
if (!is_file($install_dir . '/vendor/autoload.php')) {
|
if (!is_file($install_dir . '/vendor/autoload.php')) {
|
||||||
c_echo("%RError: Missing dependencies%n, run: %Bcomposer install --no-dev%n\n\n");
|
c_echo("%RError: Missing dependencies%n, run: %B./scripts/composer_wrapper.php install --no-dev%n\n\n");
|
||||||
}
|
}
|
||||||
require $install_dir . '/vendor/autoload.php';
|
require $install_dir . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
@@ -103,13 +103,13 @@ if (!str_contains(shell_exec('php scripts/composer_wrapper.php --version'), 'Com
|
|||||||
$dep_check = shell_exec('php scripts/composer_wrapper.php install --no-dev --dry-run');
|
$dep_check = shell_exec('php scripts/composer_wrapper.php install --no-dev --dry-run');
|
||||||
preg_match_all('/Installing ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_missing);
|
preg_match_all('/Installing ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_missing);
|
||||||
if (!empty($dep_missing[0])) {
|
if (!empty($dep_missing[0])) {
|
||||||
print_fail("Missing dependencies!", "composer install --no-dev");
|
print_fail("Missing dependencies!", "./scripts/composer_wrapper.php install --no-dev");
|
||||||
$pre_checks_failed = true;
|
$pre_checks_failed = true;
|
||||||
print_list($dep_missing[1], "\t %s\n");
|
print_list($dep_missing[1], "\t %s\n");
|
||||||
}
|
}
|
||||||
preg_match_all('/Updating ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_outdated);
|
preg_match_all('/Updating ([^ ]+\/[^ ]+) \(/', $dep_check, $dep_outdated);
|
||||||
if (!empty($dep_outdated[0])) {
|
if (!empty($dep_outdated[0])) {
|
||||||
print_fail("Outdated dependencies", "composer install --no-dev");
|
print_fail("Outdated dependencies", "./scripts/composer_wrapper.php install --no-dev");
|
||||||
print_list($dep_outdated[1], "\t %s\n");
|
print_list($dep_outdated[1], "\t %s\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user