Search by

xne (Exponential Network): safe, verified upgrades for Exponential installs. Detect, plan, verified backup, upgrade and automatic rollback, on Linux, macOS and Windows, in pure PHP.

v0.3.0.24 2026-11-29 22:27 UTC

This package is auto-updated.

Last update: 2026-11-29 22:32:38 UTC


README

Version PHP Engines API License: GPL v2+

Safe, verified upgrades for every Exponential install. One command, and a way back.

An upgrade by hand is a list of risky steps: pull the code, copy files, run SQL update files, pick the right update scripts, wipe caches, and hope. When step four fails at midnight, nobody has a clean way back.

xne (product name Exponential Network) turns that into one command. It looks at the install, plans the upgrade, makes a verified backup, upgrades files, libraries and database, checks the result, and when any step fails it rolls everything back by itself. It works on all five database engines Exponential runs on, in pure PHP 7.4 to 8.5, with no shell tool in the engine.

It overlays the kernel's own tools (exp:upgrade, the SQL update files, the autoload generator, ezcache.php); it does not replace them. And it is the only way an Exponential install gets upgraded on the 7x servers.

AI assistants (Claude and others): read doc/AI.md first. Never script an Exponential install upgrade by hand over a shell; use xne.

Requirements

  • PHP 7.4 to 8.5 on the command line (php -v), with zlib (release archives and backups) and json; curl or openssl for HTTPS downloads.
  • The PDO driver of the install's database: pdo_mysql, pdo_pgsql or pdo_sqlite; for MongoDB the mongodb extension, for Oracle oci8. When the PHP on PATH lacks it, point xne at one that has it with --php=....
  • git, only for installs that are git checkouts (the git fast-forward method).
  • Write access to the install, as its owner (or as root/Administrator: xne then runs the install's own tools as the owner of index.php).

Install

xne is a folder of PHP files; nothing is compiled. Get it with git or as an archive of the repository, put it in a fixed place, and make the xne command reachable. Releases are tagged vX.Y.Z.N; check out the newest tag.

Linux (and BSD)

sudo git clone https://github.com/se7enxweb/xne.git /opt/xne
cd /opt/xne && sudo git checkout "$(git tag -l 'v*' --sort=version:refname | tail -1)"
sudo ./install.sh            # shows what it would do
sudo ./install.sh --apply    # links /usr/local/bin/xne, creates /etc/xne, /var/lib/xne (0700), /var/cache/xne
xne version

install.sh never removes anything and can be run again after every update (git fetch --tags, check out the new tag, sudo ./install.sh --apply). Run as root, xne keeps its state in /var/lib/xne and its release cache in /var/cache/xne; run as a normal user, in ~/.xne/lib and ~/.xne/cache.

macOS

git clone https://github.com/se7enxweb/xne.git ~/xne
ln -s ~/xne/bin/xne /usr/local/bin/xne      # or add ~/xne/bin to PATH
xne version

Use the PHP that runs the site (Homebrew php, MAMP's /Applications/MAMP/bin/php/php8.x/bin/php): --php= or XNE_PHP names it. State and cache: ~/.xne/.

Windows

  1. Install PHP 7.4 or newer for the command line (the same PHP the site uses: XAMPP's C:\xampp\php\php.exe, WampServer's C:\wamp64\bin\php\php8.x\php.exe, or a zip from windows.php.net), with extension=openssl, extension=curl and the database's pdo_* enabled in its php.ini (zlib is built in).
  2. Get xne: git clone https://github.com/se7enxweb/xne.git C:\xne, or download the repository archive and unpack it to C:\xne.
  3. Add C:\xne\bin to PATH, or set XNE_PHP to the full path of php.exe when it is not on PATH:
setx XNE_PHP "C:\xampp\php\php.exe"
xne version
xne detect --root="C:\xampp\htdocs\exponential"

In PowerShell the same commands run through xne.ps1 (xne version; when scripts are blocked: powershell -ExecutionPolicy Bypass -File C:\xne\bin\xne.ps1 version). State and cache: %ProgramData%\xne\lib and %ProgramData%\xne\cache. Windows, IIS, XAMPP and WampServer specifics: doc/windows-guide.md.

Every push is tested on Linux (PHP 7.4 and 8.5) and on Windows Server 2022 and 2025 (PHP 8.1 and 8.5), including a real Exponential release upgraded and rolled back on Windows: doc/testing.md.

Quick start

Point --root at the install (the folder with lib/version.php, kernel/ and settings/), or run xne from inside it.

xne detect  --root=/var/www/example.com      # what the install is: version, type, PHP, database, owner
xne traps   --root=/var/www/example.com      # known upgrade traps, each with its fix
xne plan    --root=/var/www/example.com      # what would change; nothing is touched
xne upgrade --root=/var/www/example.com --dry-run
xne upgrade --root=/var/www/example.com      # verified backup, upgrade, health check, automatic rollback on failure
xne backups --root=/var/www/example.com      # the backups, newest first
xne rollback --root=/var/www/example.com     # files and database back to the newest backup

Every command answers PASS, FAIL or REFUSED with a fixed exit code (0, 1, 3; 2 for a usage error), and prints one JSON object with --json. A first upgrade, step by step: doc/upgrade-guide.md. Every command and option: doc/cli.md.

Features

  • One command per job. detect, plan, upgrade, rollback; every command takes --json, --dry-run and --help, and answers with fixed exit codes (0 PASS, 1 FAIL, 2 usage, 3 refused).
  • A verified backup before every upgrade. The database and every file the upgrade will change, read back and checked before anything is written. There is no option to upgrade without one, on purpose.
  • Automatic rollback. Any failure after the backup (files, libraries, database, finish, health check) restores files and database at once; the command exits 1 with rolled_back: true.
  • Two upgrade methods, chosen per install. A verified file patch (the diff against share/filelist.md5, written file by file and checked against the release) or a git fast-forward for git installs.
  • Local edits kept aside. Files changed on the server are copied into the backup's kept/ folder and listed, never silently overwritten.
  • Nothing is deleted. Retired files, and files a rollback takes back, are moved into the backup folder.
  • Kernel libraries stage. When the kernel reports its libraries stage pending, xne runs libraries, database, scripts in that order, with vendor/, composer.json, composer.lock and the Composer extension folders in the verified backup (since 0.3.0.1).
  • Trap detection. Known upgrade traps (a stale lib/ copy above the docroot, a Composer files entry outside the install, shared extension folders, LiteSpeed PHP handlers, kernel class overrides, an unknown DatabaseImplementation, ...) are reported as info, warn or block with the fix: doc/traps.md.
  • Channels. stable, beta, main (nightly, with a warning) and security (only the newest release of the same x.y line), or an exact release with --to=v6.0.15.
  • Ranked release sources. GitLab, GitHub, Packagist and a local source, in an order one setting changes (sources=); releases are downloaded once into the release cache.
  • Health check after every upgrade. Written files equal the release, the release's own share/filelist.md5 matches the files, the install starts from the CLI, exp:upgrade:status shows nothing failed or pending, and every health_url answers 200 to 399.
  • Visitors keep being served by default; with maintenance=page they get the kernel's maintenance page (503 with Retry-After) while admins can still sign in.
  • One run per install. A lock refuses a second run; each install has its own backups (the last backup_keep, default 5, are kept).
  • Checks and notifications. xne check asks network.se7enx.com what each channel offers and which advisories affect the install, and runs the notify hooks (notify_problem_cmd, notify_ok_cmd, notify_event_cmd): any alerting, chat or ticket tool can open and resolve a problem or receive an event.
  • Install keys. A signed install key unlocks monitoring reports; the secret never travels and is never printed.

Database engines and PHP

xne backs up, upgrades and rolls back the database through the install's own [DatabaseSettings] (the password is never shown). A rollback is exact: the tests compare a fingerprint of every table or collection before the backup and after the restore.

Engine DatabaseImplementation PHP extension Backup
MySQL / MariaDB ezmysqli, ezmysql pdo_mysql db.sql.gz, xne's framed SQL dump with row counts
PostgreSQL ezpostgresql pdo_pgsql db.sql.gz, DDL from the catalog, sequences at their positions; restored in one transaction
SQLite sqlite3, ezsqlite3 pdo_sqlite db.sqlite, a consistent copy, integrity-checked
MongoDB expmongodb mongodb db.mongo.jsonl.gz, indexes and documents as canonical extended JSON
Oracle ezoracle oci8 db.oracle.jsonl.gz, DDL from DBMS_METADATA, rows with CLOB/BLOB whole

Proven: MySQL/MariaDB, PostgreSQL and SQLite upgrade 6.0.13 -> 6.0.14 and 6.0.14 -> 6.0.15 by file patch and by git, with exact rollbacks; MongoDB and Oracle a full upgrade of a kickstarted install and an exact xne rollback. Details and limits: doc/engines.md.

PHP 7.4 to 8.5. When xne's own PHP lacks a driver, name one that has it: --php=/usr/bin/php. The engine needs no shell tool, so the same commands run on Linux, Windows, macOS and BSD (the Windows launchers and installer are phase 4).

How an upgrade works

 detect ──▶ plan ──▶ lock ──▶ backup (verified) ──▶ maintenance on? (optional)
                                                          │
                                                          ▼
                                    files: file patch | git fast-forward
                                                          │
                                                          ▼
                      kernel exp:upgrade: [libraries,] database, scripts   (else the SQL update files)
                                                          │
                                                          ▼
                              finish: autoloads + cache clears ──▶ health check
                                                          │
                     ┌──────────── any failure ◀─────────┤
                     ▼                                    ▼ PASS
   automatic rollback: files, libraries,        maintenance off ──▶ backup marked applied
   database, caches (exit 1, rolled_back)                  ──▶ old backups rotated

Results read PASS: upgraded 6.0.14 -> 6.0.15 (backup <id>), FAIL: <reason>; rolled back to backup <id>, or REFUSED: ... when a safety check stopped it before anything changed. Step by step: doc/upgrade-guide.md; going back: doc/rollback-guide.md.

Commands

Global options: --root=DIR, --json, --dry-run, --help, --set key=value (any xne.conf key). Full reference: doc/cli.md.

Command What it does
xne detect version, install type (git, composer, files), PHP, owner, databases, extensions, siteaccesses, kernel tools
xne traps the known upgrade traps of this install, each with its level and fix
xne plan [--channel=stable|beta|main|security] [--to=REF] [--method=auto|filepatch|git] target, file counts, local edits, database steps, traps, warnings, blocked; changes nothing
xne upgrade [plan options] [--dry-run] plan, lock, verified backup, files, libraries/database/scripts, finish, health; auto-rollback on failure
xne rollback [BACKUP-ID] [--no-db] [--dry-run] files and database back to a backup; --git-tag=TAG moves a git install's code to a tag
xne backup a verified backup now
xne backups every backup, newest first, with its state
xne verify-backup [BACKUP-ID] reads a backup back: archive checksum, every file's md5, the dump and its row counts
xne sources [--refresh] the release sources in rank order and the target of each channel
xne config every effective setting and where it came from (secrets never shown)
xne db-fingerprint rows and an md5 per table, plus one fingerprint of all of them
xne check [--no-notify] channels and advisories from network.se7enx.com (else the sources); notifies
xne report [--dry-run] the install's report to the server, at the key's level
xne key:set, xne key:status store an install key from stdin (0600); show its id and fingerprint
xne server:index, server:mirror, server:key:* the API node: release index, GitLab release mirror, install keys (doc/server.md)
xne version, xne help [command] the version; the manual of one command

The API

https://network.se7enx.com/api/v1: no framework, the same class runs behind network.se7enx.com or self-hosted. Every answer is JSON with ok.

Request Answer
GET /status {ok, api: "xne/1", version, index_built, releases}
GET /releases the release index: every release tag (ref, commit, version, stable) and the main branch head
GET /advisories?version=6.0.14 the advisories whose range contains the version
POST /check {"version": "6.0.14"} what each channel offers, advisories, upgrade_available, security. Anonymous checks send only the version
POST /report signed only: the install's report trimmed to the key's level; never content, users or settings values

Signed requests carry X-Xne-Key, X-Xne-Time and an HMAC-SHA256 X-Xne-Signature; a signature more than 300 seconds off is refused, so a captured request cannot be replayed. Details: doc/server.md.

curl -s https://network.se7enx.com/api/v1/status

Safety guarantees

What xne never does:

  • It never changes an install without a verified backup. If the backup fails, nothing is changed.
  • It never leaves a half-upgraded install. Any failure after the backup rolls files and database back at once.
  • It never deletes a file. Retired files and files a rollback takes back are moved into the backup folder; only one class (Guard) moves or removes files.
  • It never overwrites a local edit silently. Each one is kept aside in the backup and listed.
  • It never writes protected files: settings/override, settings/siteaccess, var, config.php, .htaccess and the like.
  • It never runs twice on one install. A lock refuses a second run (exit 3).
  • It never forces git. A git checkout that cannot fast-forward is refused; a GitLab mirror tag that differs is never overwritten.
  • It never works around a blocking trap unless the person responsible accepts that trap by id (--accept=<id>).
  • It never prints a secret. No database password, token or key secret is shown; keys are read from stdin only.
  • It never tags or publishes an Exponential release. xne installs releases; it does not make them.

Versioning

Four positions, X.Y.Z.N: currently 0.3.0.24 (App::VERSION, the VERSION file, xne version, every --json result and GET /api/v1/status). Only the last position counts on: 0.3.0.24 -> 0.3.0.25. Tags are permanent: a published version is never moved or re-cut; a fix is always the next version.

  • 0.3.0.24 (2026-11-29): a site keeps files of its own through a file patch with Keep[] in its settings/override/xne.ini.append.php (never written, no local edit, no health difference); the health check no longer counts protected files or shared files left alone (--shared=skip) as changed kernel files, which rolled a good upgrade back. doc/upgrade-guide.md.

  • 0.3.0.23 (2026-11-29): a rollback restores a MySQL/MariaDB or PostgreSQL database into fresh tables beside the live ones (a fresh database or prefixed tables, a fresh schema) and swaps them in at once, so the site keeps its old data while a long restore loads instead of answering 500; a load that fails leaves the live tables untouched. db_restore=inplace keeps the old way; the result names the way (database_method). doc/rollback-guide.md.

  • 0.3.0.22 (2026-11-29): a link moves by rename on the same file system again, so a Windows junction (an extension's settings folder) moves into and out of a backup; 0.3.0.18 made every link anew, which Windows refuses for a junction without a special right. Only across file systems is a link made anew where it pointed.

  • 0.3.0.21 (2026-11-29): the file moves of 0.3.0.18 work on Windows: PHP there has no lchown(), so every upgrade and rollback that moved a file into or out of a backup stopped ("Call to undefined function lchown()"), and a rename that Windows refuses (a file in use) falls back to a copy again, as before 0.3.0.18. Linux and the other systems with owners are unchanged.

  • 0.3.0.20 (2026-11-29): the tests of 0.3.0.17 to 0.3.0.19 pass on Windows: the git checkouts of GitMethodTest keep their line endings (a runner's core.autocrlf=true rewrote them), and SkipStageTest expects the platform's own argument quoting. 0.3.0.16 to 0.3.0.19 were not tagged: their CI did not run or failed on Windows only in these tests; this release carries all of them.

  • 0.3.0.19 (2026-11-29): a PostgreSQL install ignores a MySQL Socket=. Old siteaccess files with Socket=/var/lib/mysql/mysql.sock made siteaccesses that differ only in it count as several databases (the trap several-databases blocked a hosted upgrade), and the PostgreSQL connection took the socket for its folder and failed. The kernel's PostgreSQL driver never reads Socket=; xne now drops it for PostgreSQL and uses a socket only when it is a folder.

  • 0.3.0.18 (2026-11-29): moves between an install and its backup work across file systems, links kept as links. With the backups on another file system than the install (/var/lib and /var/www on separate datasets), PHP's rename() copied what a site's own composer.json link led to and dropped the link, and moving it back failed: a hosted upgrade stopped half way and its rollback refused ("not uptodate"). Guard now moves a link as a link and a file by copy with its mode and owner across file systems, in both directions; git's index is refreshed before a reset; the site's own files are kept out of git's way also when a failed move left their flag lifted; backups record where each followed link pointed and a rollback makes a lost link again.

  • 0.3.0.17 (2026-11-29): the git method works on checkouts that keep files as their own, and a rollback leaves an untouched database alone. A checkout with skip-worktree files (a composer.json linked into a capture's arc/, robots.txt, share/filelist.md5) or an untracked file the target tracks made git merge --ff-only refuse. The plan now lists them (git.kept_own, git.untracked_same) and blocks on an untracked file with other content; the fast-forward keeps the site's own files (link and flag) and takes in the untracked ones, everything moved through the backup and nothing removed (Guard::guardedMoveBack); the health check and the rollback treat them the same way. Root's git left .git/index and new files owned by root in the owner's checkout; they are given back after every git move. The automatic rollback restored the database even when no step that writes it had started, taking locks the live site waited on (one restore deadlocked); it now restores it only after the libraries, database or scripts step has started. GitMethodTest covers it on a real checkout.

  • 0.3.0.16 (2026-11-29): the libraries stage can be skipped on purpose. An install whose extensions are live git checkouts must never have Composer run over them; with libraries=skip the kernel still reported the libraries stage pending and refused the later stages ("the stage libraries has 1 pending step(s): run it first"), and xne rolled back. --skip-stage=libraries --reason="<why>" now passes --skip-stage=libraries --reason=<why> to a kernel whose exp:upgrade knows them (Exponential main from 2026-11-29): the kernel records the skip for its version and runs its later stages. The plan shows it as database.skip_stage; libraries=skip without a reason is blocked on such a kernel; an older kernel gets nothing and refuses as before. SkipStageTest covers it with a fake kernel that keeps the order rule.

  • 0.3.0.15 (2026-11-28): composer.json keeps every installed package a site requires and the release does not list. Before, only the site's extension packages were kept and any other site requirement was dropped: the plan of a hosted store dropped stripe/stripe-php, which its Stripe checkout runs on, and the libraries stage would have uninstalled it. A kept library keeps the site's own constraint and its locked version (it is left out of the update list). A site requirement now goes only when the release marks it as removed (its replace, its extra.xne.removed[]), when it is a kernel library releases replaced (zetacomponents/*), when it was never installed (not in composer.lock), or when the new --drop=<package>[,vendor/*] names it. The plan lists the kept site packages with their constraints. ComposerTest covers each case.

  • 0.3.0.14 (2026-11-28): the database backup runs in bounded memory. The PostgreSQL dump read each table with a plain query, and pdo_pgsql receives a whole result set into libpq's memory before the first row is read (outside PHP's memory_limit): the backup of a large site grew xne to 6.9 GB RSS and earlyoom killed the upgrade twice during "backup: dumping the postgresql database" (nothing was changed; the backup comes first). Rows are now read through a server-side cursor, 500 at a time, inside one read-only REPEATABLE READ transaction (one consistent snapshot, and it works through pgbouncer); MySQL reads unbuffered as before, through the same row stream. A 300 MB table now dumps with about 30 MB RSS (620 MB before). The verification and the restore read the dump back one statement at a time. DbStreamTest dumps, verifies and restores a table of a few hundred MB in a child PHP with memory_limit=128M and checks its peak RSS, on PostgreSQL and MySQL servers (CI job stream).

  • 0.3.0.13 (2026-11-28): the web server's PHP is no longer held to the PHP constraints of the installed composer.lock. 0.3.0.12 applied them to every candidate, so a Plesk site on PHP 8.5 whose lock still had an older se7enxweb/exponential-php-floor (php >=8.1 <8.4, replaced by the upgrade) got its tools run with PHP 8.3. The constraints now apply only to the fallback when the web PHP is unknown (PlanTest).

  • 0.3.0.12 (2026-11-27): the install's tools and Composer run with the PHP the site runs on. On Plesk the web PHP comes from the vhost whose DocumentRoot is the install root (compared as a directory) and its PHP-FPM pool, and from Velocity's site files; before, a PHP-FPM site had no web PHP and xne took the newest PHP installed, a /usr/bin/php86 preview build, on which Composer refused a package (php <8.6) and the upgrade rolled back. The fallback ranks panel PHPs first and leaves out a newer distribution build, every candidate must satisfy the PHP constraints of composer.lock, and xne plan prints the PHP with its reason (result.php in --json; PlanTest).

  • 0.3.0.11 (2026-11-27): after a file patch xne tells the kernel the code is in place, so exp:upgrade runs the later stages on an install that is a git checkout (its commits are left as they were, and the kernel's code step stayed pending: "the stage code has 1 pending step(s)", then a rollback). It passes --code-applied=<commit> when the target's kernel knows it (Exponential main from 2026-11-27), and on an older kernel --force-order only when exp:upgrade:status shows the code step as the one pending step before the run; xne plan reports the answer as database.code_stage (CodeStageTest).

  • 0.3.0.10 (2026-11-26): xne plan and the upgrade preflight check the PHP extensions the target release requires (ext-* of its composer.json, its composer.lock platform and every package the lock installs, never the dev ones) against the PHP its tools and Composer run with, and block with trap php-extension-missing before anything changes, naming each extension, who requires it, the loaded php.ini and the line to add on Linux and Windows (extension=sockets). Exponential main requires ext-sockets; before, Composer refused it half way.

  • 0.3.0.9 (2026-11-26): a rollback moves aside the extension folders Composer added for a dependency of an updated package (named only by the install's composer.lock afterwards, as exponential-php-floor 1.3 brings some forty extensions), and extension folders are named as the legacy installer names them (ezpublish-legacy-extension-name). On Windows, upgrades from 6.0.13 to 6.0.14 and from 6.0.14 to 6.0.15 run in CI on Windows Server 2022 and 2025, each with an exact rollback (xne CI, Exponential's Windows CI); the Windows limit noted for 0.3.0.8 no longer applies.

  • 0.3.0.8 (2026-11-26): notifications go through generic notify hooks (notify_problem_cmd, notify_ok_cmd, notify_event_cmd): command lines with placeholders and XNE_NOTIFY_* environment, started without a shell, so any alerting, chat or ticket tool can be plugged in (doc/server.md, "Notify hooks"). Windows is proven in CI.

  • 0.3.0.1 (2026-11-24): when the kernel reports its libraries stage pending with an unchanged composer.lock (vendor/ not what the lock names, as on a kickstarted install), xne plans and runs it before the database stage, with the library folders in the verified backup and the same automatic rollback (LibrariesTest).

Status

Phase Scope State
1 Linux CLI: detect, plan, backup, apply (file patch, git), rollback; MySQL/MariaDB, PostgreSQL, SQLite (MongoDB and Oracle since); traps; tests on throwaway installs done
2 API v1, release index, advisories, signed install keys, xne check/report, notify hooks, the GitLab release mirror done; the API is live on network.se7enx.com
3 Setup > Network (admin4 first), portal, Composer method, 4.x/5.x chains, nightly and security channels with auto-apply planned
4 Windows: launchers, MSI, WAMP/XAMPP/IIS, scheduled task, guides planned

Inside the package

Path Contents
bin/xne the CLI (PHP); xne.bat, xne.ps1 Windows launchers (stubs until phase 4)
lib/Xne/ HTTP (curl or streams), tar.gz reader/writer, filelist.md5, INI reader, versions, processes, safe file writes
classes/Xne/Client/ the stages: Detect, Plan, Backup, Apply, Rollback, Health, Traps, Release, Kernel, Guard
classes/Xne/Source/ release sources GitLab, GitHub, Packagist, Local, and the Ranker
classes/Xne/Method/ FilePatch, Git
classes/Xne/Db/ dump, verify, restore and fingerprint per engine, through the install's own settings
classes/Xne/Server/, server/ the API v1, release index, advisories, key registry, GitLab mirror
extension/exp_network/ the Exponential extension (phase 3: Setup > Network, exp:network:*)
cronjobs/ the daily check (xne-check.timer, not installed by default)
etc/xne.conf.example every setting with its meaning
tests/ tests/php/ unit and fake-release end-to-end tests; tests/integration/ real releases on throwaway installs

State: /var/lib/xne/installs/<install>/backups/<id>/. Release cache: /var/cache/xne/.

Documentation

Document For
doc/README.md the index of every guide
doc/cli.md every command, option, setting, exit code and the --json shape
doc/engines.md the five database engines: backup, upgrade and rollback of each, what is proven
doc/server.md the API v1, install keys, check, report, notifications, the GitLab release mirror
doc/AI.md AI assistants: the rule, the commands, reading --json, the safety rules
doc/upgrade-guide.md, doc/rollback-guide.md administrators, step by step
doc/traps.md, doc/troubleshooting.md, doc/testing.md traps, messages, tests
doc/design.md the design and the owner's decisions

Exponential Network: network.se7enx.com.

License

GNU General Public License v2.0 or later, for client and server.