Platform layer and own data (4.20)
Goal: BuilderOS remains a WordPress plugin, but its email, scheduled tasks, files, data and front end stop depending on WordPress internals, so that a future platform can import a site in a single step. The public contract (REST routes, hooks, MCP names and the bos, bos crm and bos jobs WP-CLI groups) doesn’t change.
Platform layer (Builder_OS_Platform, includes/platform/). A facade with four services and their WordPress implementation in includes/platform/wp/: mail() (send( Builder_OS_Mail_Message ); the CRM, forms, appointments and reviews send through here, and Builder_OS_SMTP still configures PHPMailer), tasks() (ensure, recurring, once, next, unschedule), files() (uploads() and area( nombre, privada ), with index.php and deny rules in private areas) and http(). Options have no adapter: they are key and value, and the Builder_OS_Data registry already declares all of them per module (any export comes from there). A lint (node tests/platform-lint.js --check) forbids calling wp_mail, WP-Cron functions and wp_upload_dir outside platform/wp/ (with the documented exception of the backup engine, whose state must survive a restore) and freezes the number of direct HTTP calls per file: a new file starts at zero.
Scheduled tasks without visits (the runner).
- The job queue (
bos_jobs,/jobs/tick,wp bos jobs …) belongs to the core and is always available, with the CRM on or not. Scheduled tasks aretype='task'rows in that table, with a small index in the optionbuilder_os_tasks_indexsoensure()andnext()cost nothing per visit. - Engine: the option
builder_os_tasks_backendiswp-cron(default: nothing changes from 4.19) orrunner(own queue). The constantBUILDEROS_TASKS_BACKENDoverrides the option.wp bos platform tasks runner|wp-cron(or the button on the “Scheduled tasks” card in Settings) switches engine and moves what is scheduled, without duplicating or losing any task (hook lock and idempotent switch). Without an argument,wp bos platform taskslists the tasks. - Execution: each runner pass takes the due tasks with the queue’s atomic reservation, boots the modules that own those hooks (
Builder_OS_Modules::boot_for_hooks), marks the request as cron (wp_doing_cron) and calls the action. A recurring task advances to its next future time (missed passes are merged into one) and a failure never kills it: it recordslast_errorand is rescheduled; a one-off task retries with backoff and, if it keeps failing, ends up dead and visible inwp bos jobs list. A hook lock prevents two passes from overlapping. - Who provides the pulse (triggers). T1, server cron (the best):
* * * * * wp bos jobs run --budget=50 --path=<ruta del WordPress>or* * * * * curl -fsS "<dirección de /jobs/tick con la clave>" > /dev/null(both lines, with a copy button, are in Settings → Scheduled tasks;wp bos jobs cron-urlprints the address). T2, a WP-Cron event every minute that skips the pass if an external cron ran less than 90 s ago. T3, local loop: only withDISABLE_WP_CRONand no external cron in more than 5 minutes, a non-blocking signed request to/jobs/tick(timestamp and HMAC, 120 s validity) when closing a dashboard screen and at most one per minute on the front end (turned off withBUILDEROS_TASKS_LOOPBACKset tofalse). T4, the usual panel heartbeat. - Waker from app.builderos.site (4.20.1). With a license, the BuilderOS server calls each site’s tick address every 5 minutes, so no server cron is needed.
Builder_OS_Wakeup(optionbuilder_os_wakeup:enabled—on by default—,hash,at,proximo,error) registers withPOST {base}/api/despertador(the base and authentication are those of the comments:Builder_OS_Support::api(), license token +X-BOS-Site+X-BOS-Install) with the JSON body{"tick_url": <Builder_OS_Jobs::cron_url()>, "intervalo": 300}; the response is200 {"ok":true,"proximo":<unix>}or{error, mensaje}(401, 403, 400, 429, 503). It registers after activating or updating (first dashboard visit with no registration), daily (taskbuilder_os_wakeup_daily) and when the key or the tick address changes (one-off taskbuilder_os_wakeup_register). Without a token nothing is sent, and nothing but the address and the interval is ever sent. The “Wake up from app.builderos.site” switch in Settings › Scheduled tasks (admin-postbos_wakeup_toggle) turns it off withDELETE /api/despertador. The server’s call carries the headerX-BOS-Despertador: 1;rest_tickrecords it as originwake(it counts as an external pass and is the health’s “last external notice”). With the waker active and a notice in the last 24 h, the “Scheduled tasks without visits” step is done and the card moves the cron lines to “Advanced options” (“If you prefer your own cron…”). - Health:
wp bos platform statusandwp bos jobs stats(keytasks) report the engine, whether WP-Cron is disabled, the last pass by origin (REST, CLI, cron, local loop, panel), overdue tasks (more than 2 intervals) and the statusok,degradedorstalled. The “Scheduled tasks without visits” step in “Getting started” is mandatory if WP-Cron is disabled and no external cron called in 24 hours, and recommended otherwise; with the own engine and tasks stalled for more than an hour, the bell warns. With thewp-cronengine the step doesn’t apply. - The dormant WP-Cron mirror. With the own engine, each task also leaves its event in WP-Cron, hidden from
wp-cron.php(filterpre_get_ready_cron_jobs), so it never runs twice. If you go back to a version without a runner (4.19), those events are still there and run as always: you no longer need to runwp bos platform tasks wp-cronbefore downgrading (it is still the clean way to go back within 4.20). Pending one-off tasks are lost when going back to 4.19, and anytaskrows left are marked dead by 4.19 (harmless). - Uninstall:
Builder_OS_Data::unschedulealso deletes the task rows and thebuilder_os_tasks_*options.
Own data engine (Builder_OS_Store) and wp bos platform. It moves content types that live in wp_posts to own tables without risk, one entity at a time (today: form messages and wizards).
- Tables:
bos_form_entriesandbos_form_entry_meta(form messages and partial submissions),bos_wizards(wizards),bos_content(page sync baseline) andbos_content_blocks(block index). All are declared in the manifest, created withBuilder_OS_Schema(InnoDB and utf8mb4) and deleted on uninstall. - Phases per entity (option
builder_os_store; errors store ids and field names, never values):legacy→copying→verifying→mirror; plusfailed(reads the old data) androlled_back. Inlegacy,failedandrolled_back, WordPress’s data is read and written. Incopyingandverifying, WordPress’s is still written first and each write is copied to the table. Inmirror(the stable state of 4.20) the table is read (if a row is missing, WordPress’s is read and repaired) and written to the table and to the WordPress mirror, with the same 4.19 metadata. Meanwhilewp_postsremains the authority for ids, so asubmission_idis still a post id. Enteringcopyingempties the target table (WordPress’s data rules; this also cleans leftovers after restoring an earlier backup). - Jobs:
store.migrate(batches of 200 or until the queue asks to yield) andstore.verify(count, row-by-row hash, repairs and deletes orphans; with no errors it moves tomirrorwith an atomic switch; with errors,failedand a notice in the bell). AGET_LOCKlock per entity prevents two processes from changing phase at once. On a network, per site. - WP-CLI (internal group
wp bos platform, outside the contract):status(engines, health, queue, tables without an owner, character sets and each entity’s phase),tasks [runner|wp-cron],migrate <entidad> [--async],verify <entidad>,rollback <entidad>(instant return to WordPress’s data: the old data is always complete) andreindex(rebuilds the block index and the baseline and verifies them). The “BuilderOS data” card in Tools does the same with buttons (“Back to WordPress”, “Retry”); failures go to the bell. - Form messages (
Builder_OS_Form_Entries,includes/modules/forms/): a repository with one canonical row (promoted columns: form, email, status, date, etc.; multi-value metadata goes inbos_form_entry_metaas a JSON list). Keys used only by internal queues (_bos_fi_job_*,_bos_fi_due_*) stay only in WordPress. Wizards (Builder_OS_Wizards_Store): a table with the same phase scheme. Tests compare the output with “golden files” generated with 4.19 code. - Content (
Builder_OS_Content): each page’s sync baseline (_bos_pkg_sections, block names only) moves tobos_contentwith the metadata as authority until 4.21 (a downgrade to 4.19 only writes the metadata); andbos_content_blocksis a derived index maintained on save and with the jobscontent.reindexandcontent.verify. The sevenpost_content LIKEsearches (block usage, package changes, performance audit, converter) use the index only when its status iscomplete; otherwise they keep usingLIKE. Rendering never reads these tables and section content stays inpost_content. - Not migrated (block editors, versions, translations or pages with a public link): templates, popups, emails and pSEO rows. Uninstall deletes options and tables; the backup engine doesn’t use the runner.
Front-end policy (“What you don’t use from WordPress”, Builder_OS_Front). Option builder_os_front (settings comments, feeds, oembed: auto, on or off; emojis: on or off (off by default); block_assets: auto or keep; theme: keep, styles, remove or strict; parts: built-in header and footer; legacy). Detection (builder_os_front_detect, renewed daily and on publish or moderation) looks at whether there are posts, comments approved in the last year, own feeds and Jetpack; the effective value is the manual setting or, with auto, what was detected. It only acts on the front end and with the “On the whole site” scope; the dashboard doesn’t change.
- It removes: generator, RSD, wlwmanifest and shortlink (always); comments, feeds and oEmbed when the site doesn’t use them; emojis; WordPress block CSS when the page only carries BuilderOS blocks; and styles and scripts served from the active theme (
remove).stylesremoves only the theme’s stylesheets (the 4.19 rule).strict(only if chosen) also removes what the theme hooks into the header, footer andwp_enqueue_scripts, and can disable theme features (carts, popups, analytics). XML-RPC is handled by Security. - Built-in header and footer: while the site has none of its own,
Builder_OS_Canvas::render_partpaints a builder template (or, if it needs post context, a minimal header and footer) without creating any post; a page marked as canvas never receives them. - Sites that already existed: the
front_policyupdate step storeslegacy = on(the policy touches nothing and the 4.19 settings apply: emojis and embeds in Performance, comments in Security, theme styles in Header and footer, which are kept) andparts = off. Saving the card adopts the policy (legacy = off). A new site starts with the policy active. To go back: one setting per feature,theme = keepor the “Canvas only” scope. New options:builder_os_front,builder_os_front_detect; daily taskbuilder_os_front_detect.
Rollback procedure (from 4.20 to 4.19.0).
| Layer | Within 4.20 | Downgrading to 4.19.0 |
|---|---|---|
| Code | restore the previous backup | n/a |
| Email, files, HTTP | not needed (same behavior as in WordPress) | safe |
| Tasks | wp bos platform tasks wp-cron or BUILDEROS_TASKS_BACKEND='wp-cron' | the dormant WP-Cron mirror keeps the recurring ones: nothing needed beforehand. Pending one-off ones are lost |
| Form messages and wizards | wp bos platform rollback <entidad> or the “Back to WordPress” button | safe: posts and metadata are mirrored and the ids are the same |
| Content baseline and index | rollback content (reads only the metadata) | safe: the metadata is kept |
| Front-end policy | one setting per feature, theme=keep, scope=canvas | old keys are kept |
| CRM (indexes, utf8mb4) | additive | 4.19 ignores the new indexes and the token_v column |
| Appointment and review links | those sent in 4.19 are valid until their deadline | 4.19 accepts the new tokens (same format) and issues its own 3-part links. 4-part links sent by email under 4.20 stop opening while 4.19 lasts, and 3-part ones issued by 4.19 for those rows don’t open on returning to 4.20. It is advisable to resend the links |
| Schema version | n/a | 4.19 sees an equal or higher number and does nothing |
The “finalization” (deleting the old data, moving id authority to the tables and removing the baseline mirror) belongs to 4.21 and will only happen after 14 days or more in mirror on real sites with clean checks.
Salt rotation. The signatures of 4-part appointment and review links (and that of cart recovery links) come from the salts in wp-config.php. Changing the salts (or restoring the database on another site) invalidates all those links already sent: opening them gives “invalid link”, with no further hints. After rotating them, resend the links for pending appointments and review requests. The old 3-part links use a key stored in the database and don’t change.
For the AI (chapter 25) and the checklist. A foreign physical llms.txt is set aside by Builder_OS_SEO_Llms_Takeover (never deletes; .bak-AAAAMMDD copy, notice with undo); the filter builder_os_llms_generators adds known generators (label, signature, active, disable, restore). The app.builderos.site waker (Builder_OS_Wakeup) isn’t touched from other modules. A new email, task, file or HTTP call goes through Builder_OS_Platform, never through wp_mail, wp_schedule_* or wp_upload_dir (the lint fails). A new own content type that lives in tables: a Builder_OS_Store engine entity with phases, mirror and rollback, never a one-time migration. Rendering doesn’t read new tables. A new task is declared in the manifest (cron) and must be safe if repeated.