No description
  • PHP 81.4%
  • JavaScript 18.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
David Hall 781e5d2a92 1.3.0: find packages without a repository link by name
Tries the owner's repositories named like the folder (and the usual
grav-plugin-x / grav-x-plugin / grav-x forms); only one whose newest
release links back to itself, with a matching slug and type, counts.
2026-11-15 13:50:50 +00:00
admin-next/pages 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00
classes 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00
docs/images Forgejo Updater 1.0.0: update plugins and themes from Forgejo releases in Admin2 2026-11-15 13:10:23 +00:00
tests 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00
.gitattributes Forgejo Updater 1.0.0: update plugins and themes from Forgejo releases in Admin2 2026-11-15 13:10:23 +00:00
.gitignore Forgejo Updater 1.0.0: update plugins and themes from Forgejo releases in Admin2 2026-11-15 13:10:23 +00:00
blueprints.yaml 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00
CHANGELOG.md 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00
LICENSE Forgejo Updater 1.0.0: update plugins and themes from Forgejo releases in Admin2 2026-11-15 13:10:23 +00:00
rawrsome-grav-plugin-updater.php 1.1.0: plugin folder is rawrsome-grav-plugin-updater, matching the renamed repository 2026-11-15 13:26:51 +00:00
rawrsome-grav-plugin-updater.yaml 1.1.0: plugin folder is rawrsome-grav-plugin-updater, matching the renamed repository 2026-11-15 13:26:51 +00:00
README.md 1.3.0: find packages without a repository link by name 2026-11-15 13:50:50 +00:00

Rawrso.me Plugin Updater

A Grav 2 plugin that updates plugins and themes from their Forgejo (or Gitea) repositories, as Grav's package manager does for the official ones. It adds a Plugin updates page to Admin2 that:

  • lists the installed plugins and themes that come from one owner's repositories
  • shows the installed version and the newest release of each, and what's new in between (from the package's CHANGELOG.md)
  • installs an update with one click, checks the site still works, and puts the old version back if it doesn't
  • updates everything with Update all, one package after another
  • puts a replaced version back on request
  • shows a count of available updates in the sidebar

Public repositories need nothing. Private ones need a read-only access token (see below).

The Plugin updates page in Admin2

Requirements

  • Grav 2.2 or later, with Admin2 and the API plugin
  • PHP 8.3 or later, with the zip extension (Grav needs it too)
  • The web server must be able to reach the Forgejo server over HTTPS

Installing

  1. Download the zip of the newest release tag from the repository's Tags page.
  2. Unpack it and upload the rawrsome-grav-plugin-updater folder inside to user/plugins/. Keep that folder name: Grav finds a plugin by it.
  3. Enable the plugin in Admin2.

After that, the plugin updates itself from its own page like any other package.

What counts as a release

A release is a Git tag that looks like a version: v1.2.3 or 1.2.3. Tags such as v2.0.0-beta.1 are pre-releases and are only offered if you switch that on. Nothing else is needed on the Forgejo side: the plugin downloads the zip Forgejo makes for each tag.

The release's blueprints.yaml must carry the same version as its tag (version: 1.2.3 for v1.2.3). If it doesn't, the update is refused.

Which packages it looks after

Set the Forgejo address and owner in the plugin's settings. A plugin or theme belongs to that owner when its blueprints.yaml has a homepage, bugs or docs link to one of the owner's repositories:

homepage: https://code.example.org/me/my-plugin

For a package whose blueprint links elsewhere (a theme whose homepage is your website, say), add it under Other packages with its folder name and repository name. Leave out skips packages you don't want updated here.

A package whose blueprint doesn't link to any of the owner's repositories (an older version, from before it carried the link) is also looked for by name: the owner's repository called the same as its folder, or grav-plugin-<folder>, grav-<folder>-plugin or grav-<folder> (theme in place of plugin for a theme). A name alone isn't enough: the repository's newest release must link back to that same repository, and its blueprint mustn't name a different slug or type. That keeps out plugins from elsewhere, such as Grav's own, that happen to share a name with one of the owner's repositories. Private repositories are only found this way with a token. The page marks these packages "Found by its name"; once updated, they carry their own link.

Packages that are a symbolic link (a working copy linked into the site) or a Git checkout are listed but never updated: update those with Git.

Updating

Update to … on the page:

  1. asks Forgejo again for the package's tags, and only goes ahead if the tag is newer than what's installed
  2. downloads the tag's zip (up to 64 MB) into Grav's tmp folder and unpacks it with Grav's own installer code, which refuses files that would land outside the folder, and oversized archives
  3. checks the release: the same kind of package (plugin or theme), the version its tag says, its main file, what it needs (Grav version and generation, PHP version, other plugins), and no PHP syntax errors
  4. loads the site's home page, any other pages in the settings, and the Admin2 page
  5. moves the installed folder to the backups, puts the new one in its place and clears Grav's cache
  6. loads the same pages again. If one that worked before now fails (no answer, or a server error), the old version goes straight back

The page then lists each step. If the server couldn't load its own pages (some hosts block that), your browser loads the home page instead and says what it got.

Update all (N) does the same for every update that can be installed here, one package after another, and then lists how each went. Each one gets its own checks, backup and automatic put-back, and one that fails or is put back doesn't stop the rest. If the site stops answering altogether, it stops there and says which packages it didn't try. This plugin goes last when it has an update too, so it never replaces its own files halfway through.

A release that needs something this site lacks (a newer Grav, say) is shown with the reason, and isn't counted in the sidebar.

Only one update runs at a time. Every update and every failure is listed under Recent changes.

Backups

Replaced versions are kept in user/data/rawrsome-grav-plugin-updater/backups/<package>/, two per package by default. Put … back swaps the newest older version back in, and keeps the one it replaces.

If an update ever leaves the site so broken that Admin2 won't open, put the old version back by hand: delete (or rename) the package's folder in user/plugins or user/themes, move the newest folder from user/data/rawrsome-grav-plugin-updater/backups/<package>/ into its place, and rename it to the package's folder name.

Private repositories

Without a token, private repositories show as Not found. To include them:

  1. In Forgejo, go to Settings → Applications and make an access token with read access to repositories and nothing else. Safest of all, make it for a separate Forgejo user that can only read the repositories you want updated: then a leaked token exposes only those.
  2. Paste it under Private repositories on the Plugin updates page and save it.

The token:

  • is saved in user/data/rawrsome-grav-plugin-updater/token.php, readable only by the web server's user. The file is PHP that just returns the token, so even a web server that doesn't block user/data/ sends nothing if asked for it
  • is never shown again: the page only says whether one is set
  • goes only to the Forgejo address in the settings, only over HTTPS (or plain HTTP to the same computer, for testing), and never follows a redirect
  • never appears in an error message or log

If you'd rather keep it out of Grav's files, set the RAWRSOME_GRAV_PLUGIN_UPDATER_TOKEN environment variable on the server instead; it takes priority over the saved one.

Settings

Setting Default What it does
Forgejo address https://code.hall.me.uk The server, with no path
Owner david The user or organisation whose repositories hold the packages
Other packages none Folder name and repository for packages whose blueprint doesn't link to their repository
Leave out none Folder names not to check or update
Check for new releases every 24 hours How old the last check may be before the page or sidebar asks Forgejo again (Check now always asks). A check that failed is retried after an hour
Offer pre-releases off Offer tags such as v2.0.0-beta.1
Check the site after an update on Load the pages below and the Admin2 page before and after, and put the old version back if one breaks
Pages to check / Addresses on this site, each starting with /
Old versions to keep 2 Backups kept for each package

The page and its API are for super administrators only: installing a release puts new code on the site.

Limits

  • Updates come one package at a time, by hand. Nothing installs on its own.
  • A plugin's other dependencies aren't installed for you: a release that needs a missing plugin is refused with its name.
  • A theme is replaced as a whole folder. Files you added inside the theme's folder go with the old version into the backups, so keep your changes in a child theme or user/ instead.
  • The check after an update loads pages as a visitor. It catches a release that stops the site loading, not one that breaks a single feature.

Tests

GRAV_ROOT=/path/to/grav php tests/run.php

These run against a fake Forgejo server in memory. tests/mock-forgejo.php is a small stand-in Forgejo for trying the plugin on a real site with PHP's built-in server (see the file). The tests folder is left out of release zips.

Licence

MIT. See LICENSE.