From 73c409dcdc484d4bd167f92eeea8c63915e589e0 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 23 Feb 2016 09:10:56 +1100 Subject: [PATCH 1/3] check if auto-updates are enabled before checking innodb settings (if they are disabled, this would still throw an alert to say innodb needs adjusting even though they arent wanted) --- daily.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/daily.php b/daily.php index cc91d132d..7e42c4066 100644 --- a/daily.php +++ b/daily.php @@ -18,6 +18,10 @@ if (isset($options['d'])) { } if ($options['f'] === 'update') { + if (!$config['update']) { + exit(0); + } + $innodb_buffer = innodb_buffer_check(); if ($innodb_buffer['used'] > $innodb_buffer['size']) { if (!empty($config['alert']['default_mail'])) { @@ -39,19 +43,14 @@ The ' . $config['project_name'] . ' team.'; echo warn_innodb_buffer($innodb_buffer); exit(2); } - else { - if ($config['update']) { - if ($config['update_channel'] == 'master') { - exit(1); - } - elseif ($config['update_channel'] == 'release') { - exit(3); - } - } - else { - exit(0); - } + + if ($config['update_channel'] == 'master') { + exit(1); } + elseif ($config['update_channel'] == 'release') { + exit(3); + } + exit(0); } if ($options['f'] === 'syslog') { From 731c2eb443b9132e64822446da96adeaf124e1a8 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 23 Feb 2016 09:20:14 +1100 Subject: [PATCH 2/3] check if daily.php returns 0 and only do the db clean up if it does (dont update submodules or do a schema upgrade etc) --- daily.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daily.sh b/daily.sh index 17591fa8f..05808c362 100755 --- a/daily.sh +++ b/daily.sh @@ -33,7 +33,11 @@ status_run() { if [ -z "$arg" ]; then up=$(php daily.php -f update >&2; echo $?) - if [ "$up" -eq 1 ]; then + if [ "$up" -eq 0 ]; then + # Updates are disabled. + status_run 'Cleaning up DB' "$0 cleanup" + exit $? + elif [ "$up" -eq 1 ]; then # Update to Master-Branch status_run 'Updating to latest codebase' 'git pull --quiet' elif [ "$up" -eq 3 ]; then From d9098d3c3cbd3f3251341f99a209a0401460e66b Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 23 Feb 2016 13:38:29 +1100 Subject: [PATCH 3/3] if no code is updated, do a schema update check and also a cleanup. move to a separate script call to make it easier to add more tasks if required in the future. --- daily.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/daily.sh b/daily.sh index 05808c362..49dcb075e 100755 --- a/daily.sh +++ b/daily.sh @@ -34,9 +34,8 @@ status_run() { if [ -z "$arg" ]; then up=$(php daily.php -f update >&2; echo $?) if [ "$up" -eq 0 ]; then - # Updates are disabled. - status_run 'Cleaning up DB' "$0 cleanup" - exit $? + $0 no-code-update + exit elif [ "$up" -eq 1 ]; then # Update to Master-Branch status_run 'Updating to latest codebase' 'git pull --quiet' @@ -53,6 +52,12 @@ if [ -z "$arg" ]; then fi else case $arg in + no-code-update) + # Updates of the code are disabled, just check for schema updates + # and clean up the db. + status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php' + status_run 'Cleaning up DB' "$0 cleanup" + ;; post-pull) # List all tasks to do after pull in the order of execution status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'