Skip to content

Bump version to 1.7 so the upgrade-time file prune runs (fixes audit_functions.php redeclare) - #95

Merged
TheWitness merged 1 commit into
developfrom
fix/bump-version-trigger-prune
Oct 14, 2026
Merged

TheWitness merged 1 commit into
developfrom
fix/bump-version-trigger-prune

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

Bumps the plugin version from 1.6 to 1.7 so the upgrade-time file prune actually runs.

Why

The develop cycle added manifest.json tombstones plus audit_prune_files(), which deletes files that older layouts shipped (notably audit_functions.php and audit_syslog.php, whose functions now live under includes/). audit_prune_files() is only invoked from audit_check_upgrade(), and that path is gated on a version change:

$current = $info['version'];                 // INFO
$old     = db_fetch_cell(... plugin_config); // stored
if ($current != $old) { ... audit_prune_files(); ... }

Because the tombstone work shipped under the same 1.6 version string that installs already had recorded, $current == $old, the prune never fires, and the stale audit_functions.php stays on disk. It then redeclares audit_user_is_admin() (now defined in includes/functions.php), producing a fatal COMPILE_ERROR that disables the plugin:

ERROR PHP COMPILE_ERROR in Plugin 'audit': Cannot redeclare audit_user_is_admin()
(previously declared in .../audit/includes/functions.php:37)
in file: .../audit/audit_functions.php on line: 37

The version was never bumped when the prune mechanism landed — an accidental oversight. Bumping to 1.7 makes $current != $old on upgrade from 1.6, so audit_check_upgrade() re-registers hooks and runs audit_prune_files(), removing the tombstoned files.

Changes

  • INFO: version = 1.6 -> 1.7.
  • CHANGELOG.md: cut the accumulated --- develop --- entries to a new --- 1.7 --- section and document the version bump.
  • tests/Security/ControllerSecurityTest.php: update the version-sync assertions to 1.7.

Note for already-broken installs

A server that already hit the fatal must have plugins/audit/audit_functions.php (and audit_syslog.php) removed manually once and the plugin re-enabled; the fatal can pre-empt the upgrade path from completing. The version bump is what makes every other install self-heal via the prune on upgrade.

…rune

The develop-cycle tombstone/prune work (audit_prune_files()) only runs when INFO version differs from the stored plugin_config version. It shipped under the same 1.6 string, so installs never prune the stale audit_functions.php/audit_syslog.php, which fatally redeclare functions now in includes/. Bump to 1.7 to trigger the prune on upgrade.
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 14, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The consistent version bump correctly activates the existing upgrade and pruning path.

0 open findings

What changed in this PR

Bumps the plugin version to trigger upgrade-time pruning of obsolete files and prevent function redeclaration failures.

Changes:

  • Updates the plugin version from 1.6 to 1.7.
  • Creates the 1.7 changelog section.
  • Synchronizes version assertions in security tests.
File Description
INFO Sets the plugin version to 1.7.
CHANGELOG.md Documents the 1.7 release and prune trigger.
tests/​Security/​ControllerSecurityTest.php Updates version synchronization assertions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@TheWitness
TheWitness merged commit 97d56e2 into develop Oct 14, 2026
6 checks passed
@TheWitness
TheWitness deleted the fix/bump-version-trigger-prune branch October 20, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants