Repository navigation
v0.24.1 — hotfix: survive duplicate-load (two plugin folders)
What's fixed in v0.24.1
Activating the connector while a second copy of the same plugin already exists in wp-content/plugins/ no longer hits a fatal Cannot redeclare function deckwp_connect_on_activate().
Reproduction
Operator uploads a fresh release ZIP from a GitHub source archive (unpacks to deckwp-connect-main/) without first deleting the existing deckwp-connect/ folder. WordPress loads both plugin files in the same request; PHP fatals on the second top-level function declaration.
The fix
Two layers of defense in deckwp-connect.php:
- Duplicate-load guard at the top of the file —
if (defined('DECKWP_CONNECT_VERSION')) { return; }. The second copy bails before doing anything. The first copy's constants, functions, and class identity stay authoritative. - Every top-level
function ... ()declaration wrapped infunction_exists()— as a fallback for any codepath that somehow bypasses the early return.
Why early-return instead of just function_exists everywhere
define() collisions only throw E_NOTICE and silently keep the FIRST value. Without the early return, the second copy's __FILE__ / plugin_basename(__FILE__) would attempt to populate DECKWP_CONNECT_FILE / DECKWP_CONNECT_BASENAME — which already hold the first copy's values, leading to subtle bugs where the second copy's path is silently discarded. Skipping the second copy's file load entirely makes the resulting behavior easier to reason about.
Workaround if you're already on a stuck install
Until v0.24.1 lands, manually:
- Delete the duplicate folder via FTP (whichever was uploaded most recently), OR
- Rename the new folder over the old: delete the old
deckwp-connect/, renamedeckwp-connect-main/→deckwp-connect/, then activate.
After v0.24.1 is installed, this scenario stops being fatal regardless of how future uploads are arranged.
No behavior change for one-folder installs
If you've only ever had one copy of the plugin (which is the normal case for DeckWP-dashboard auto-installed sites), v0.24.1 is a transparent no-op. The guards only kick in when there's actually a second copy in plugins/.
Upgrading: drop in deckwp-connect.zip or self-update via the DeckWP dashboard. No DB migration. No wire contract change.