Skip to content

Releases

v3.4.1

Choose a tag to compare

@gfazioli gfazioli released this 26 Nov 12:54

Fixes

  • The framework loads the plugin's own Text Domain header when it loads the translations (#148). Until now it used the literal wp-kirk that bones rename rewrites to a slug derived from the plugin name, so a plugin whose Text Domain differs from that slug had to call load_plugin_textdomain() itself. A header without a Text Domain still falls back to that literal.
  • Domain Path defaults to languages when the header has none (it was an undefined-index notice) and its leading slash, as WordPress documents it, is trimmed.

To update a plugin: composer update wpbones/wpbones.

Full Changelog: v3.4.0...v3.4.1

v3.4.0

Choose a tag to compare

@gfazioli gfazioli released this 26 Nov 07:42

What's new

  • ✨ Menu icons for WordPress 7.2 (#146). WordPress 7.2 draws the admin menu with inline SVG icons, and add_menu_page() now takes the name of a registered icon. The icon of config/menus.php now passes these through:

    • an icon name such as core-admin/pin, on WordPress 7.2 and later;
    • none (or the older div);
    • an absolute or protocol-relative URL.

    Dashicons classes and data: URIs work as before, and any other value is still a file in your plugin's public/images folder.

    Up to 3.3.1, none, a URL and an icon name all became a broken image. To keep a Dashicon on earlier WordPress versions, gate the name:

    'icon' => function_exists('wp_is_valid_icon_name') ? 'core-admin/pin' : 'dashicons-admin-post',

    The menu icon of custom post types already reached register_post_type() unchanged, so icon names work there with no change.

Update with composer update wpbones/wpbones.

Full Changelog: v3.3.1...v3.4.0

v3.3.1

Choose a tag to compare

@gfazioli gfazioli released this 23 Nov 10:54

Two fixes: a module whose name ends with p or h loads again, and bones deploy no longer says it succeeded when it copied nothing.

Helpers

  • wpbones_modules() and import() load the module they are named after (#144, fixes #142, reported by @bardrop). The name went through rtrim($file, '.php'), and the second argument of rtrim() is a set of characters, not a suffix: every trailing ., p and h was stripped, so wpbones_modules('shop') required plugin/modules/sho.php, 'graph' required gra.php, 'Help.php' required Hel.php, each ending in a fatal error. It had been so since the helper arrived in 1.8.0. Now .php is appended only when the name does not already end with it.

bones

  • deploy creates a missing destination parent, and a failed copy fails the deploy (#143, fixes #139). php bones deploy /tmp/missing-parent/my-plugin copied nothing: every write failed with a PHP warning, and the deploy still printed βœ… Deploy completed! and exited with 0. The missing parents are now created, once the destination checks have passed, and a folder or file the deploy cannot write stops it with Deploy failed: could not write '<path>' and exit status 1; with --create-zip the staging folder is removed and no zip is written. A . or .. after a missing folder is refused, since it would resolve through a link the checks never followed; deploy ../deploy-version from the plugin works as before.
  • Replacing an existing destination touches only that folder (#143). The folder was emptied through glob(), so a destination whose name holds [, *, ? or { was read as a pattern: replacing x[ab] emptied xa/ and xb/ instead. A symlinked folder inside an old destination was followed and its target emptied too. Both are gone: the deploy walks the folder's real entries and unlinks a link without following it.

Upgrading

composer update wpbones/wpbones. Nothing to change.

Docs: Hooks and Modules Β· Where the deploy goes

Full Changelog: v3.3.0...v3.3.1

v3.3.0

Choose a tag to compare

@gfazioli gfazioli released this 16 Nov 13:25

A coding agent's notes no longer travel with the plugin: php bones deploy leaves the agent instruction files out of the package by default.

bones

  • deploy leaves the agent instruction files out (#140). Up to 3.2.0 the default skip list named README.md and the Dockerfile but none of them, and a web server hands out a plugin's files as they are: a CLAUDE.md in the package, with whatever it says about the code, could be read at wp-content/plugins/<plugin>/CLAUDE.md on every site that installed the plugin. A deploy.php filter was no remedy when the package is built without WordPress, in a Docker build or a CI job, since deploy.php only runs when WordPress is loaded. Now the package never holds, wherever they are and vendor/ included:
    • AGENTS.md and AGENTS.override.md (Codex, Cursor, Copilot and most others), AGENT.md;
    • CLAUDE.md and CLAUDE.local.md (Claude Code), a CLAUDE.md link to AGENTS.md too;
    • GEMINI.md (Gemini CLI).
  • Their folders, .claude/, .codex/, .cursor/, .github/, never shipped: the deploy skips every dot entry.

Upgrading

composer update wpbones/wpbones. Nothing to change. To ship one of these files anyway, take it out with the wpbones_console_deploy_default_skip_files_folders filter.

Docs: What the deploy leaves out

Full Changelog: v3.2.0...v3.3.0

v3.2.0

Choose a tag to compare

@gfazioli gfazioli released this 15 Oct 16:54

A plugin's test suites no longer travel with it: php bones deploy leaves them out of the package by default.

bones

  • deploy leaves the test suites out (#136). Up to 3.1.0 the default skip list named none of them, so a plugin shipped its tests unless its deploy.php listed them, and --wp, which keeps resources/assets, sent every Jest test in there to WordPress.org with the scripts beside it. Now the package never holds:
    • tests/, phpunit.xml, phpunit.xml.dist and phpunit.dist.xml;
    • jest.config.js and jest.config.json;
    • any __tests__, __snapshots__ or __mocks__ folder, or *.test.* / *.spec.* script (.ts, .tsx, .js, .jsx), outside vendor/ and node_modules/: what the jest.config.js written by migrate:to-v2 runs.
  • A package that cannot load is not produced. When the copy's Composer autoloader requires a file the deploy left out β€” autoload-dev naming a file in tests/, with --keep-dev or with no dev package to prune β€” the deploy stops and names it, instead of shipping a plugin that fails on every request.

PHPUnit, Brain Monkey and the rest of require-dev were already removed from the package (2.0.7), and the cache PHPUnit writes never shipped.

Upgrading

composer update wpbones/wpbones. Nothing to change. The test entries in your deploy.php become redundant and can stay. To ship one of these paths anyway, take it out with the wpbones_console_deploy_default_skip_files_folders filter.

Docs: What the deploy leaves out

Full Changelog: v3.1.0...v3.2.0

v3.1.0

Choose a tag to compare

@gfazioli gfazioli released this 07 Oct 13:03

A plugin can now keep its own stubs: every make:* command reads stubs/ first, and php bones stub:publish copies the framework's there to start from.

bones

  • Your own stubs come first (#133, #134). Up to 3.0.0 every make:* command read its template from vendor/wpbones/wpbones/src/Console/stubs, so changing what the generators write meant editing vendor/, and the next composer update put it back. Now a stub in the plugin's stubs/ folder wins, and the command says so (Using stubs/controller.stub). The placeholders ({Namespace}, {ClassName}, {Path} and each stub's own) are filled as before.
  • php bones stub:publish [<stub> ...] [--force] copies the framework's stubs into stubs/: all of them, or the ones you name. A stub already there is kept unless you pass --force, since it is usually one you have edited; an unknown name lists the stubs there are and writes nothing.
  • deploy leaves them out. The .stub files in stubs/ never reach the package. A stubs/ folder that also holds other files keeps them.
  • A stub found nowhere now stops the command before anything is written.

Upgrading

composer update wpbones/wpbones. Nothing to change: without a stubs/ folder every command writes what it wrote in 3.0.0. A published stub no longer follows the framework's: after an update, compare it with vendor/wpbones/wpbones/src/Console/stubs/, or take the new one with php bones stub:publish <stub> --force (your edits go).

Docs: Customizing the stubs

Full Changelog: v3.0.0...v3.1.0

v3.0.0

Choose a tag to compare

@gfazioli gfazioli released this 06 Oct 15:06

WP Bones 3.0 changes what the framework does when a plugin says nothing. The changes are breaking, and php bones migrate:to-v3 converts what it can and lists the rest. Read the upgrade guide before you update: https://wpbones.com/docs/migrating-to-v3

PHP stays 8.1+, React stays 18 (from @wordpress/element), and the build does not change.

πŸ’₯ Migrations run once per site (#40, #119, #121)

  • When a migration runs:
    • each migration runs once per site, in file-name order, and its name is recorded in an option;
    • the pending ones run on activation, on the first request after the plugin's Version changes (however the update arrived: dashboard, ZIP, FTP, git, Composer), and with php bones migrate;
    • a lock keeps concurrent requests from running them twice;
    • a failure stops the run and shows administrators a notice until it runs.
  • What 2.x did instead: it re-ran every migration and every seeder on each activation and dashboard update, inside the update request, with the old code still loaded.
  • Seeders do not run any more: seed data is a migration. migrate:to-v3 converts the seeders, and one with $runOnce seeds only an empty table, as before.
  • The base class is WPBones\Database\Migration. Its constructor has no side effects. The old class still loads, deprecated.
  • New commands: php bones migrate and php bones migrate:status. migrate:create <table> creates the table it is given.
  • plugin/updated.php runs on the first request after an update, in the new code, with $previousVersion.

πŸ’₯ What declares nothing is for administrators (#125)

  • Pages and menus: a page of config/routes.php or pages/, or a menu of config/menus.php, without a capability now needs manage_options. It was read (2.1.2), and before that nothing. To keep the old behaviour, declare 'capability' => 'read'.
  • REST routes: a route without a permission_callback refuses every request with WordPress's rest_forbidden. It was public. To keep it public, declare 'permission_callback' => '__return_true'.

πŸ’₯ Requests that change something carry a nonce (#129)

  • Admin pages: every request to a WP Bones admin page that is not a GET or a HEAD carries the plugin's nonce. The form prints it with $plugin->csrfField(); it can also travel in the query string or in an X-WPBones-Nonce header. The check runs before any load callback or controller method. Up to 2.x, a form on another site could post to these pages with an administrator's cookies.
  • Opting out: a page that checks its own nonce says 'csrf' => false.
  • Ajax: a logged action of a provider without $nonceHash refuses every request. make:ajax now sets $nonceHash for you.
  • useHTTPPost() returns unslashed values.

πŸ’₯ Generated files leave the plugin folder (#128)

  • Where they go: compiled Blade views and single/daily logs go to wp-content/uploads/wpbones/<plugin folder>/, with an index.php at every level and a deny-all .htaccess.
  • Log names carry a hash keyed with AUTH_SALT, so they cannot be guessed where nginx ignores the .htaccess.
  • Blade compiles only when a Blade view renders.
  • No fallback: when uploads cannot be written, a Blade view throws a RuntimeException that says so, and the logs fall back to error_log().
  • Storage::delete() is there for an uninstall.php.

✨ php bones migrate:to-v3

Run it in your plugin's source folder after the update. It converts the migrations and the seeders, then lists for you to review:

  • every page, menu and REST route that declares nothing;
  • every POST form without csrfField();
  • every Ajax provider without a nonce;
  • every second unslash of a useHTTPPost() value.

It rewrites nothing in that list.

Update

composer require "wpbones/wpbones:^3.0"
php bones migrate:to-v3

The 14 boilerplates and their Playground demos are on 3.0. Plugins on ^2.x stay on 2.1.3 until they change their constraint.

Full Changelog: v2.1.3...v3.0.0

v2.1.3

Choose a tag to compare

@gfazioli gfazioli released this 06 Oct 13:37

πŸ”’ Security

  • The default logger writes no file.
    • What was wrong: "errorlog" is the default, and config/plugin.php describes it as writing to WordPress's log only. Every logger() call also appended to <plugin>/storage/logs/<date>.log, in a folder made 0777, which the web server serves as text.
    • What happens now: it is error_log() only and makes no folder. "single" and "daily" still write where they did, and the default storage/logs folder now gets an index.php and a deny-all .htaccess. (#126)
  • Compiled Blade views are no longer readable from the web.
    • What was wrong: Blade compiled into <plugin>/.cache as .bladec, and a direct request returned the compiled PHP of a view.
    • What happens now: views compile to .php, so a direct request runs them out of context instead of reading them. The .bladec files earlier versions left are removed, and .cache is made with wp_mkdir_p() (it was 0777), with an index.php and a deny-all .htaccess. (#126)

WP Bones 3.0 moves both folders out of the plugin.

Update

composer update wpbones/wpbones

Then delete what earlier versions left in storage/logs/ if your plugin logs with the default "errorlog". Those <date>.log files are still in the plugin folder, and the update does not remove log files.

Full Changelog: v2.1.2...v2.1.3

v2.1.2

Choose a tag to compare

@gfazioli gfazioli released this 06 Oct 12:46

πŸ”’ Security

  • Route and pages/ admin pages check the capability they ask for.
    • What was wrong: the pages of config/routes.php and of the pages/ folder are registered with no menu entry, and WordPress lets any logged-in user, a subscriber included, open such a page. The capability key the docs and the Routes boilerplate declare was never read.
    • What happens now: a user without the capability gets WordPress's own 403. The check runs before any load callback or controller method, whatever the HTTP verb.
    • How to set it: a route reads its capability key. A pages/ class adds a public capability() method.
    • The default stays read. Every user with a role on the site has it. A user with no role on the site, or a network user who is not a member of it, is now refused. (#123)
  • A REST route without a permission_callback says it is public.
    • What was wrong: the framework filled in 'permission_callback' => '__return_true' without a word, so a Route::post() with no options was a public write endpoint.
    • What happens now: the route stays public, as before, and a _doing_it_wrong() notice names it. With WP_DEBUG on, it shows as an X-WP-DoingItWrong header on REST responses. Pass '__return_true' to keep a route public on purpose: from WP Bones 3.0 a route without one will not be public. (#123)

πŸ› Fixes

  • The same pages give WordPress their title. On PHP 8.1 and later, every visit to a route or pages/ page logged a strip_tags(): Passing null deprecation from admin-header.php. (#123)

Update

composer update wpbones/wpbones

Then give each page route that is not meant for every logged-in user a capability, and each public REST route a permission_callback: Pages Routing, REST API.

Full Changelog: v2.1.1...v2.1.2

v2.1.1

Choose a tag to compare

@gfazioli gfazioli released this 06 Oct 09:27

πŸ› Fixes

  • Activation reads the plugin header. Since #51 the kernel reads the plugin header on init, and activation comes after init: in Plugin::_activation() the slug was empty and Version was null, so the options delta wrote to an options row with no name, and plugin/activation.php saw no Version. It now reads the header first. The empty-named row earlier activations left behind is harmless and is not removed. (#120)
  • php bones migrate:create <table> creates <table>. The stub ignored the name and always created my_plugin_products. (#120)

Both were found while working on the 3.0 migrations (#40).

Update

composer update wpbones/wpbones

Full Changelog: v2.1.0...v2.1.1