diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ff0b32..a794d9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,10 @@ Only this release needs the command line for the database update. Normal updates - Settings > Ticketing: the email-to-ticket hint no longer names a cron script that has not existed for several releases, and points at Maintenance > Cron instead. - Setup: the command line installer now prints the crontab entry and the reminder to turn cron on, the same two steps the web installer shows on its finish page. - Removed the unused `config_invoice_overdue_reminders` setting. It was seeded on install and read in two places but never actually used by anything; the overdue reminder schedule is fixed in the nightly job. +- Update page: reworked. Release, tracked branch, database version and code commit are now shown whatever state the install is in, instead of only when it is already up to date, and a pending database update no longer hides a pending application update — both appear, in the order they need doing. Pending commits are listed in a readable table rather than a centred one, and the backup warning is stated once instead of twice. +- Update page: **Force Update no longer resets to `origin/master` regardless of the branch you track.** On an install following any other branch it silently moved the files onto master and discarded the code that was actually running. It now resets to the branch in `$repo_branch`, and so does `update_cli.php --force_update`. Installs with no `$repo_branch` in `config.php` still get master, as before. +- Update page: the database update is now offered using a proper version comparison. The old string comparison would have stopped offering updates once a version reached a two-digit part — `2.6.10` sorts below `2.6.9` as plain text. +- Update page: Git output — commit subjects and error text — is escaped before it reaches the page, and the branch name is escaped before it reaches a shell command. The page also no longer runs a second `git fetch` just to read the error message from the first one. - Cron: the nightly run is safe to repeat. Late fees, overdue invoice reminders and autopay retries now apply at most once per invoice per day, so a Run Now after the scheduled pass no longer stacks fees or re-emails clients. Nightly Tasks only accepts the daily schedule. - Ticket SLAs, optional throughout. An SLA sets a response target and an optional resolution target, assigned per client and priority with a global default and an explicit "no SLA" override. Targets are measured against your business hours. Tickets show time remaining and turn yellow at a configurable warning threshold and red on breach, on both the ticket list and the kanban board, and can be filtered by SLA state. Nominated statuses pause the resolution clock for "waiting on customer", preserving the remaining budget. Two new reports, SLA Summary and SLA by Client. With no assignments defined nothing behaves any differently. - Ticket: added an Urgent priority. diff --git a/admin/post/update.php b/admin/post/update.php index 1a2b3b3a..5e28fc13 100644 --- a/admin/post/update.php +++ b/admin/post/update.php @@ -8,11 +8,17 @@ if (isset($_GET['update'])) { enforceAdminPermission(); - //git fetch downloads the latest from remote without trying to merge or rebase anything. Then the git reset resets the master branch to what you just fetched. The --hard option changes all the files in your working tree to match the files in origin/master - + // git fetch downloads the latest from the remote without merging or rebasing anything. + // The hard reset then throws away every local change and makes the working tree match + // the tracked branch exactly. + // + // That reset used to name origin/master outright, so a force update on an install + // tracking any other branch silently moved it onto master and discarded the code it was + // actually running. if (isset($_GET['force_update']) == 1) { + $remote_ref = escapeshellarg("origin/" . getRepoBranch()); exec("git fetch --all"); - exec("git reset --hard origin/master"); + exec("git reset --hard $remote_ref"); } else { exec("git pull"); } diff --git a/admin/update.php b/admin/update.php index 9f2beac2..da75bfd5 100644 --- a/admin/update.php +++ b/admin/update.php @@ -3,106 +3,197 @@ require_once "includes/inc_all_admin.php"; require_once "../includes/database_version.php"; +$repo_branch = getRepoBranch(); +$remote_ref = escapeshellarg("origin/$repo_branch"); + $updates = checkForUpdates(); -$latest_version = $updates->latest_version; $current_version = $updates->current_version; -$result = $updates->result; +$fetch_ok = $updates->result === 0; -$git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format:'
= escapeHtml(implode("\n", $updates->output)) ?>
+
+ Check that Git is installed, that the remote is reachable from this server, and that the web server
+ user can write to the ITFlow directory. The
+ forum can help - include
+ your PHP error log and the output above.
+ = escapeHtml(substr((string) $current_version, 0, 7)) ?>You are up to date
+Everything is going to be alright.
+VM Snapshots are highly recommended over other methods - see the docs. Review the changelog for breaking changes that may require manual remediation.
-Ignore this warning at your own risk.
+ + ++ Both are pending. Update the application files first - + they bring the database migrations that the second step then applies. +
+ + + +
+ = count($pending_commits) ?> commit= count($pending_commits) === 1 ? '' : 's' ?>
+ behind = escapeHtml("origin/$repo_branch") ?>.
+
+
+ Update App runs git pull. Force Update discards every local change and resets
+ the files to = escapeHtml("origin/$repo_branch") ?> - use it only when a
+ normal update will not apply.
+
+
VM Snapshots are highly recommended over other methods - see the docs. Review the changelog for breaking changes that may require manual remediation.
-Ignore this warning at your own risk.
-+ Schema is at = escapeHtml(CURRENT_DATABASE_VERSION) ?> and this code expects + = escapeHtml(LATEST_DATABASE_VERSION) ?>. Parts of the app will error until + this is applied. +
+ + Update Database + ++ + A large instance can take a minute or more. If it fails part way it stops without advancing + the recorded version, so it is safe to run again after fixing the cause. + +
+Application Release Version:
= APP_VERSION ?>
Database Version:
= CURRENT_DATABASE_VERSION ?>
Code Commit:
= $current_version ?>
You are up to date!
Everything is going to be alright
| Commit | -When | -Description | -
|---|
| Commit | +When | +Description | +
|---|---|---|
= escapeHtml($commit[0]) ?> |
+ = escapeHtml($commit[1]) ?> | += escapeHtml($commit[2]) ?> | +