Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wpcomsp-simple-events",
"version": "2.0.4",
"version": "2.0.5",
"description": "A simple Gutenberg-first event management plugin that integrates with WooCommerce Box Office.",
"author": {
"name": "WordPress.com Special Projects Team",
Expand Down Expand Up @@ -65,4 +65,4 @@
"dependencies": {
"ajv": "^8.17.1"
}
}
}
6 changes: 3 additions & 3 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Simple Events Plugin bootstrap file.
*
* @since 1.0.0
* @version 2.0.4
* @version 2.0.5
* @author WordPress.com Special Projects
* @license GPL-3.0-or-later
*
Expand All @@ -13,7 +13,7 @@
* Description: Event management frontend for WooCommerce Box Office.
* Requires at least: 6.2
* Tested up to: 6.4
* Version: 2.0.4
* Version: 2.0.5
* Requires PHP: 8.0
* Author: WordPress.com Special Projects
* Author URI: https://wpspecialprojects.wordpress.com
Expand All @@ -31,7 +31,7 @@
function_exists( 'get_plugin_data' ) || require_once ABSPATH . 'wp-admin/includes/plugin.php';
define( 'SE_METADATA', get_plugin_data( __FILE__, false, false ) );

define( 'SE_VERSION', '2.0.4' );
define( 'SE_VERSION', '2.0.5' );
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Avoid version drift: define SE_VERSION from header metadata

Optional improvement to keep a single source of truth and avoid future mismatches. Define SE_VERSION from SE_METADATA['Version'] so you don’t need to manually update it each release.

Apply this diff:

-define( 'SE_VERSION', '2.0.5' );
+define( 'SE_VERSION', SE_METADATA['Version'] );

Run this script to verify all version references are aligned and no stale 2.0.4 remains:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Extract versions
pkg=$(jq -r '.version' package.json)
php_header=$(sed -nE 's/^\s*\*\s*Version:\s*([0-9.]+)\s*$/\1/p' plugin.php | head -n1)
php_constant=$(rg -nP "define\(\s*'SE_VERSION'\s*,\s*'([^']+)'\s*\);" plugin.php -r '$1' -N -o || true)

echo "package.json version:        $pkg"
echo "plugin.php header Version:   $php_header"
echo "plugin.php SE_VERSION const: ${php_constant:-<derived or not found>}"

# Compare values
[[ "$pkg" == "$php_header" ]] || { echo "Mismatch: package.json vs plugin header."; exit 1; }
if [[ -n "${php_constant}" ]]; then
  [[ "$pkg" == "$php_constant" ]] || { echo "Mismatch: package.json vs SE_VERSION constant."; exit 1; }
fi

echo "Scanning for stale old version references (2.0.4)..."
if rg -nP '\b2\.0\.4\b' -g '!vendor/**' -g '!build/**' -g '!dist/**' ; then
  echo "Found stale 2.0.4 references above."; exit 1
else
  echo "No stale 2.0.4 references found."
fi

Length of output: 3934


To ensure the suggested change will work, let’s first confirm that SE_METADATA is actually defined in the plugin and contains a Version key.


🏁 Script executed:

#!/bin/bash
# Search for where SE_METADATA is defined or populated
rg -n "SE_METADATA" -g "*.php" -C3

Length of output: 412


Use header metadata as the source of truth for SE_VERSION

Derive the plugin constant from the parsed header to avoid manual updates.

  • plugin.php (around line 34)
-define( 'SE_VERSION', '2.0.5' );
+define( 'SE_VERSION', SE_METADATA['Version'] );

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In plugin.php around line 34, SE_VERSION is hardcoded; instead parse the plugin
header and derive the constant from the parsed "Version" header. Use WordPress's
get_file_data(__FILE__, ['Version' => 'Version']) (or a small header-parser
fallback if WP functions are not available), grab the Version value,
sanitize/trim it, default to a safe fallback if missing, and then
define('SE_VERSION', $version) only if not already defined.

define( 'SE_BASENAME', plugin_basename( __FILE__ ) );
define( 'SE_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'SE_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
Expand Down