mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: issue warning notification if php version is less than 5.6.4 (#7418)
* feature: issue warning notification if php version is less than 5.6.4 rename set_notification function in daily.sh to set_notifiable_result print output when a daily.sh process fails * further notifiable clarification * Update the notification message. * make sure to remove the notification when updates are disabled move the notification code into the php check
This commit is contained in:
committed by
Neil Lathwood
parent
aace3b169e
commit
1cd4fcb8b1
22
daily.sh
22
daily.sh
@@ -64,7 +64,7 @@ status_run() {
|
||||
echo "${tmp}" >> ${log_file}
|
||||
echo "Returned: ${exit_code}" >> ${log_file}
|
||||
|
||||
# print OK if the command ran succesfully
|
||||
# print OK if the command ran successfully
|
||||
# or FAIL otherwise (non-zero exit code)
|
||||
if [[ "${exit_code}" == "0" ]]; then
|
||||
printf " \033[0;32mOK\033[0m\n";
|
||||
@@ -73,6 +73,10 @@ status_run() {
|
||||
if [[ "${arg_option}" == "update" ]]; then
|
||||
php "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}"
|
||||
fi
|
||||
if [[ ! -z "${tmp}" ]]; then
|
||||
# print output in case of failure
|
||||
echo "${tmp}"
|
||||
fi
|
||||
fi
|
||||
return ${exit_code}
|
||||
}
|
||||
@@ -97,7 +101,7 @@ call_daily_php() {
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Set critical notifications for the user
|
||||
# Send result of a notifiable process to php code for processing
|
||||
# Globals:
|
||||
# LIBRENMS_DIR
|
||||
# Arguments:
|
||||
@@ -107,12 +111,12 @@ call_daily_php() {
|
||||
# Returns:
|
||||
# Exit-Code of Command
|
||||
#######################################
|
||||
set_notification() {
|
||||
set_notifiable_result() {
|
||||
local args="$@";
|
||||
local arg_type=$1;
|
||||
local arg_result=$2;
|
||||
|
||||
php "${LIBRENMS_DIR}/daily.php" -f set_notification -t ${arg_type} -r ${arg_result};
|
||||
php "${LIBRENMS_DIR}/daily.php" -f handle_notifiable -t ${arg_type} -r ${arg_result};
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -148,10 +152,12 @@ main () {
|
||||
fi
|
||||
|
||||
if [[ -z "$arg" ]]; then
|
||||
status_run 'Checking PHP version' "php ${LIBRENMS_DIR}/daily.php -f check_php_ver" 'check_php_ver'
|
||||
|
||||
up=$(php daily.php -f update >&2; echo $?)
|
||||
if [[ "$up" == "0" ]]; then
|
||||
${DAILY_SCRIPT} no-code-update
|
||||
set_notification update 1 # make sure there are no update notifications if update is disabled
|
||||
set_notifiable_result update 1 # make sure there are no update notifications if update is disabled
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -174,7 +180,7 @@ main () {
|
||||
fi
|
||||
|
||||
if (( $update_res > 0 )); then
|
||||
set_notification update 0
|
||||
set_notifiable_result update 0
|
||||
fi
|
||||
|
||||
if [[ "$old_ver" != "$new_ver" ]]; then
|
||||
@@ -183,10 +189,10 @@ main () {
|
||||
# Run post update checks
|
||||
if [ ! -f "${LIBRENMS_DIR}/vendor/autoload.php" ]; then
|
||||
status_run "Reverting update, check the output of composer diagnose" "git checkout $old_ver" 'update'
|
||||
set_notification update 0
|
||||
set_notifiable_result update 0
|
||||
else
|
||||
status_run "Updated from $old_ver to $new_ver" ''
|
||||
set_notification update 1 # only clear the error if update was a success
|
||||
set_notifiable_result update 1 # only clear the error if update was a success
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user