# Platform Notes Where each platform keeps content, users, URLs, files and schedules, and the traps specific to it. Table and column names below are the platform defaults; confirm them against the actual install (prefixes, versions and plugins change them) before writing export queries. Platform versions and historical checks in these notes are reported by the supplied source author. The scoped exporters below have been revised; component checks do not establish a new end-to-end CMS or plugin migration test. Confirm behavior against the actual installed versions and configuration. ## Contents - [Scoped export helpers](#scoped-export-helpers) - [WordPress](#wordpress) - [Drupal 8 and later](#drupal-8-and-later) - [Joomla 4 to 6](#joomla-4-to-6) - [Magento 2](#magento-2) - [Laravel](#laravel) - [Symfony](#symfony) - [CodeIgniter 4](#codeigniter-4) - [Plain PHP](#plain-php) ## Scoped export helpers The examples below capture selected content and identity data for review. They are not universal CMS exporters or evidence that plugins, permissions or live workflows have migrated. Run them on an owner-approved copy using the relevant CMS CLI. Rendering invokes installed plugin/module code; inspect that code and its side effects first. Save this helper as `export-support.php` beside the exporter, in a private directory outside the web root. Set `MIGRATION_EXPORT_DIR` to an absolute, **new** directory on private storage (its parent must exist), and `MIGRATION_WEB_ROOTS` to every directory the web server publishes, including upload aliases, separated by `PATH_SEPARATOR` (`:` on Linux/macOS); one must contain the CMS root. The helper refuses output beneath them and writes a fresh 0700 directory with 0600 files. It cannot see web-server aliases: confirm no host serves the storage, and never deploy it as frontend assets. ```php migration_inside($cms, $root))) { throw new RuntimeException('Declared public roots must include the CMS root.'); } $requested = getenv('MIGRATION_EXPORT_DIR') ?: ''; $parent = $requested !== '' && $requested[0] === '/' ? realpath(dirname($requested)) : false; $leaf = basename($requested); if ($parent === false || !is_dir($parent) || in_array($leaf, ['', '.', '..'], true)) { throw new RuntimeException('Choose a new absolute private output directory with an existing parent.'); } $dir = rtrim($parent, '/') . '/' . $leaf; foreach ($roots as $root) if (migration_inside($dir, $root)) throw new RuntimeException('Output is public.'); umask(0077); if (file_exists($dir) || is_link($dir) || !mkdir($dir, 0700)) throw new RuntimeException('Use a fresh private directory.'); return $dir; } function migration_ids(string $name, bool $required = true): array { $raw = getenv($name) ?: ''; if ($raw === '' && !$required) return []; if (!preg_match('/^[1-9][0-9]*(,[1-9][0-9]*)*$/D', $raw)) throw new RuntimeException("Set $name to approved numeric IDs."); return array_values(array_unique(array_map('intval', explode(',', $raw)))); } function migration_route(string $url): string { $parts = parse_url($url); if (!is_array($parts) || empty($parts['host'])) throw new RuntimeException('Missing absolute source URL.'); return ($parts['path'] ?? '/') . (isset($parts['query']) ? '?' . $parts['query'] : ''); } function migration_jsonl(string $path, iterable $rows): void { $partial = $path . '.partial'; $handle = fopen($partial, 'xb'); if ($handle === false) throw new RuntimeException('Cannot create private export.'); try { foreach ($rows as $row) { $line = json_encode($row, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n"; for ($offset = 0; $offset < strlen($line); $offset += $written) { $written = fwrite($handle, substr($line, $offset)); if ($written === false || $written === 0) throw new RuntimeException('Export write failed.'); } } if (!fflush($handle) || !fclose($handle)) throw new RuntimeException('Export close failed.'); if (!rename($partial, $path)) throw new RuntimeException('Export finalization failed.'); } finally { if (is_resource($handle)) fclose($handle); } } ``` Requires PHP 8 or later. Treat a run as failed if it raises an error or leaves `.partial` files. Review all completed files, counts and approved IDs before importing; a completed JSONL file alone is not migration acceptance. The rows include extra metadata and arrays: adapt the converter field mapping, import DTOs, stored schema and frontend consumers before claiming those values are preserved. ## WordPress The supplied notes report checks on WordPress 7.1. The scoped exporter below has been revised; its PHP syntax check is not a new CMS or plugin compatibility test. - **Prefix:** `$table_prefix` in `wp-config.php` (default `wp_`). Use the real prefix in every query. - **Content:** `wp_posts`. Filter `post_type IN ('post', 'page')` (plus any custom types the site uses) and `post_status = 'publish'`; `post_name` is the slug, `post_date_gmt` / `post_modified_gmt` are UTC. Rows with `post_type = 'revision'`, `'attachment'` or `'nav_menu_item'` are not pages. - **Rendered HTML:** render approved public content through WordPress while the old site runs: save the example as `wp-export.php` beside the helper and run `wp --path=/path/to/site eval-file /private/work/wp-export.php`. List approved page and post IDs in `MIGRATION_PUBLIC_POST_IDS`; optional `MIGRATION_USER_IDS` selects identity records. Set the private-output variables above. Review password, membership and plugin access rules when approving: the script rejects password-protected and unpublished posts but cannot infer every plugin's privacy rules. ```php post_type, ['page', 'post'], true) || $p->post_status !== 'publish' || $p->post_password !== '') { throw new RuntimeException("Post $id is not eligible for this public snapshot."); } $previous = $GLOBALS['post'] ?? null; $GLOBALS['post'] = $p; try { if (!setup_postdata($p)) throw new RuntimeException('Cannot establish post context.'); $url = get_permalink($p); if (!is_string($url)) throw new RuntimeException('Cannot resolve source permalink.'); $isBuilder = class_exists('\Elementor\Plugin') && get_post_meta($id, '_elementor_edit_mode', true) === 'builder'; // The source post is current; the template-display wrapper would reject it as recursive. $html = $isBuilder ? \Elementor\Plugin::$instance->frontend->get_builder_content($id, true) : apply_filters('the_content', $p->post_content); if (!is_string($html) || ($isBuilder && trim($html) === '')) { throw new RuntimeException("Builder snapshot for post $id is empty; inspect it before export."); } yield ['legacyId' => $id, 'siteId' => get_current_blog_id(), 'siteUrl' => home_url('/'), 'postType' => $p->post_type, 'url' => $url, 'route' => migration_route($url), 'language' => function_exists('pll_get_post_language') ? pll_get_post_language($id) : null, 'translations' => function_exists('pll_get_post_translations') ? pll_get_post_translations($id) : [], 'title' => $p->post_title, 'bodyHtml' => $html, 'published' => true, 'updatedAt' => strtotime($p->post_modified_gmt . ' UTC'), 'authorLegacyId' => (int) $p->post_author, 'summary' => ($p->post_excerpt ?? '') !== '' ? $p->post_excerpt : null, 'publishedAt' => strtotime(($p->post_date_gmt ?? $p->post_modified_gmt) . ' UTC'), 'fields' => function_exists('get_fields') ? get_fields($id) : null, 'seoRawTitle' => get_post_meta($id, '_yoast_wpseo_title', true), 'seoRawDescription' => get_post_meta($id, '_yoast_wpseo_metadesc', true), 'parentLegacyId' => (int) $p->post_parent ?: null, 'menuOrder' => (int) $p->menu_order, 'image' => ($img = get_the_post_thumbnail_url($id, 'large')) ? migration_route($img) : null, 'categories' => array_map(fn($t) => ['name' => html_entity_decode($t->name, ENT_QUOTES | ENT_HTML5, 'UTF-8'), 'slug' => $t->slug], get_the_category($id)), 'tags' => array_map(fn($t) => html_entity_decode($t->name, ENT_QUOTES | ENT_HTML5, 'UTF-8'), wp_get_post_tags($id))]; } finally { wp_reset_postdata(); $GLOBALS['post'] = $previous; } } }; migration_jsonl($dir . '/content.jsonl', $content()); $menus = function () { // titles arrive HTML-encoded (&) $host = parse_url(home_url('/'), PHP_URL_HOST); foreach (wp_get_nav_menus() as $menu) { foreach (wp_get_nav_menu_items($menu->term_id) ?: [] as $i) { $h = parse_url($i->url, PHP_URL_HOST); yield ['menu' => $menu->slug, 'itemId' => (int) $i->ID, 'parentItemId' => (int) $i->menu_item_parent ?: null, 'order' => (int) $i->menu_order, 'title' => html_entity_decode($i->title, ENT_QUOTES | ENT_HTML5, 'UTF-8'), 'route' => $h === null ? $i->url : ($h === $host ? migration_route($i->url) : null), 'externalUrl' => $h !== null && $h !== $host ? $i->url : null, 'targetLegacyId' => $i->type === 'post_type' ? (int) $i->object_id : null]; } } }; migration_jsonl($dir . '/menus.jsonl', $menus()); $users = function () use ($userIds) { foreach ($userIds as $id) { $u = get_userdata($id); if (!$u) throw new RuntimeException("Missing approved user $id."); yield ['legacyId' => $id, 'siteId' => get_current_blog_id(), 'email' => strtolower(trim($u->user_email)), 'displayName' => $u->display_name, 'sourceRoles' => array_values($u->roles)]; } }; migration_jsonl($dir . '/users.jsonl', $users()); // No passwords, tokens or inferred authorization. ``` This captures approved `page`/`post` snapshots (parent, menu order, featured image, categories, tags), every menu in `menus.jsonl` (rebuild navigation from it, not the page list), optional approved users, Polylang language and translation IDs, raw Yoast overrides and ACF values. Add a reviewed adapter for WPML or another provider; never infer language from the slug. Key records by site plus post ID and keep the full source URL, including query strings and trailing slashes. The converter **discards** unmapped fields: map them, and adapt schema, importer and frontend for arrays and ACF structures. Raw Yoast templates are not rendered SEO tags. CLI rendering does not recreate every URL, session, language or request context, nor collect enqueued styles and scripts: compare anonymous and signed-in browser journeys. Searching for shortcodes or `