release: 3.2.0 → 3.3.0 — self-hosted update checker (Gitea API)

WP Logbook is hosted on the author's own Gitea instance
(git.davidtkeane.com), not on WordPress.org, so WP's built-in update
flow doesn't see new releases. This release adds a Settings →
Updates panel that polls Gitea's Releases API and reports whether
a newer version is available.

CHANGES
- inc/wp-notes-updater.php: full rewrite of the previous broken stub
  (it had a hard require on a non-existent vendor path and was never
  included from the main plugin file anyway).
- wp_notes_fetch_latest_release() hits
  /api/v1/repos/<owner>/<repo>/releases/latest, parses, normalises.
  Prefers a .zip asset attached to the release; falls back to
  Gitea's source-archive zip URL.
- wp_notes_update_status() compares against WP_NOTES_VERSION and
  returns 'available' | 'up-to-date' | 'unknown' (the last when no
  release has been tagged yet — graceful first-run UX since the
  repo currently has zero tags).
- New AJAX endpoint wp_notes_check_updates, capability-gated
  (manage_options) + nonce-protected. Force-refreshes the cache.
- Settings page now renders the Updates panel via
  wp_notes_render_updates_panel() — current status text, "Check
  now" button, View on Gitea / View all releases quick links,
  manual-install instructions, and a Download .zip button + View
  release notes link when an update is detected.
- wp-notes.php require_once chain now includes the updater file.

CACHING
- Successful fetches: 12h site transient.
- Negative responses (404 = no releases yet): 1h so a freshly-
  tagged release shows up quickly.

INSTALLATION FLOW (intentionally manual)
The panel does NOT auto-install. Manual path printed in the panel:
download .zip → deactivate → upload via Plugins → Add New → Upload
→ reactivate. Notes live in wp_options so they survive the upgrade.

ALSO IN 3.3.0
- Section heading rename carried from the previous unreleased
  block: "Add New Note" → "New Log Entry"; "Notes Todo List:" →
  "Log entries". Row-level "note" labels intentionally unchanged.

VERSION BUMP
- wp-notes.php header 3.2.0 → 3.3.0
- WP_NOTES_VERSION constant 3.2.0 → 3.3.0
- About page version history leads with v3.3.0 as latest, demotes
  v3.2.0 to previous entry

NOTES FOR FUTURE-CLAUDE
- Gitea repo currently has ZERO release tags. First run will show
  "No releases tagged on the Gitea repo yet." Tag v3.2.0 / v3.3.0
  on Gitea and the checker will start reporting versions.
- Repo coordinates live in three constants at the top of
  inc/wp-notes-updater.php (WP_NOTES_GITEA_HOST, _OWNER, _REPO).
  Override via define() in wp-config.php if the repo ever moves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 09:09:40 +01:00
parent eeaf8a0f87
commit 5c8f1716a3
4 changed files with 314 additions and 42 deletions
+59
View File
@@ -7,6 +7,65 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
## [Unreleased]
---
## [3.3.0] — 2026-05-25
**New feature: self-hosted update checker.** WP Logbook is hosted on
the author's own Gitea instance (`git.davidtkeane.com`), not on
WordPress.org, so WordPress's built-in update flow doesn't see new
releases. This release adds a small **Updates** panel to the
Settings page that polls the Gitea Releases API and tells you when
there's a newer version waiting.
### Added
- **`inc/wp-notes-updater.php`** — full rewrite of the previous
broken stub (which had a hard `require` on a non-existent vendor
path and was never included from the main plugin file anyway).
- **Settings → Updates panel** at the bottom of `Settings → WP
Logbook → Settings`. Shows the current status on load (cached),
with a **Check now** button that force-refreshes against the
Gitea API.
- **`wp_notes_fetch_latest_release()`** — hits
`/api/v1/repos/<owner>/<repo>/releases/latest` on Gitea, parses
the response, normalises into `{version, html_url,
download_url, body, published_at}`. Prefers a `.zip` asset
attached to the release; falls back to Gitea's source-archive
URL (`/archive/<tag>.zip`).
- **`wp_notes_update_status()`** — version-compares against
`WP_NOTES_VERSION` and returns one of `available`,
`up-to-date`, or `unknown` (the last when no release has been
tagged yet — graceful first-time UX).
- **AJAX endpoint `wp_notes_check_updates`** — capability gated
(`manage_options`) + nonce protected. Deletes the cache and
re-fetches.
- **Quick links** in the panel: *View on Gitea* and *View all
releases* — both open the Gitea web UI in a new tab.
### Cached
- Successful release fetches: **12 hours** in a site transient.
- Negative responses (e.g. HTTP 404 = no releases tagged yet):
**1 hour** so a freshly-tagged release shows up quickly.
### Installation flow (manual on purpose)
The panel does NOT auto-install. Manual path (printed in the
panel itself): *download the .zip → deactivate plugin → upload via
Plugins → Add New → Upload → reactivate*. Notes live in
`wp_options` so they survive the upgrade.
### Notes for future-Claude / future-David
- The Gitea repo currently has **zero release tags** — so the very
first run of this checker will show *"No releases tagged on the
Gitea repo yet."* That's by design. Tag the v3.2.0 / v3.3.0 / v4
releases on Gitea as we ship them and the checker will start
reporting versions on its own.
- The Gitea repo coordinates live in three constants at the top of
`inc/wp-notes-updater.php` (`WP_NOTES_GITEA_HOST`, `_OWNER`,
`_REPO`). Override-able via `define()` in `wp-config.php` if the
repo ever moves.
### Also in this release — heading rename carried over from the unreleased block
### Changed — Section headings on My Log page renamed to match the logbook framing
- `Add New Note` → **`New Log Entry`** on the create form postbox.
- `Notes Todo List:` → **`Log entries`** above the active/completed