Concrete5 to Concrete CMS Migration
Last autumn I inherited a twelve-year-old B2B manufacturing portal running Concrete5 5.6.3.5 on an Ubuntu 18.04 VM that nobody dared reboot. It held 1,840 published pages, 42 custom blocks, 6,300 downloadable PDFs and CAD sheets under /files/, and a decade of search rankings built on hyper-specific part-number URLs. The business didn't want a redesign. They wanted off an unsupported PHP 7.2 stack before their cyber-insurance renewal hit, without watching organic leads vanish.
Anyone who has maintained an aging content management system knows the trap. Stakeholders hear "5.6 to v9" and imagine a routine weekend patch. With Concrete CMS, that misconception kills timelines fast. Version 5.7 was a ground-up rewrite that replaced ADOdb, global loaders, and flat page types with Symfony components, Doctrine DBAL, and PSR-4 namespaces. No in-place SQL upgrade path exists from 5.6 to v9. Treating a platform rebuild like a minor update is exactly why enterprise CMS projects overrun by six figures.
We shipped the move in eleven weeks with an 18-minute editorial freeze and zero sustained ranking loss. Here is what broke in production prep: PHP 8.2 deprecations, Doctrine schema diffs, custom block exports, and the redirect maps that kept twelve years of URL equity intact.
Auditing the 5.6 Relic Before Writing Code
Rule one on any legacy move: never trust an agency spreadsheet from 2016. During past ExpressionEngine legacy site audits, half the "mission-critical" templates hadn't served a real request in years. Concrete5 5.6 hoards dead code even harder because old page versions keep deactivated block instances lingering in the database indefinitely.
We queried a production replica to find which custom blocks actually lived on approved, active pages:
SELECT bt.btHandle, COUNT(DISTINCT cvb.cID) AS live_pages
FROM BlockTypes bt
JOIN Blocks b ON b.btID = bt.btID
JOIN CollectionVersionBlocks cvb ON cvb.bID = b.bID
JOIN CollectionVersions cv ON cv.cID = cvb.cID AND cv.cvID = cvb.cvID
JOIN Pages p ON p.cID = cv.cID
WHERE cv.cvIsApproved = 1 AND p.cIsActive = 1 AND p.cIsTemplate = 0
GROUP BY bt.btHandle ORDER BY live_pages DESC;
That query saved us three weeks. Of 42 custom blocks in /blocks/, 14 had zero live instances, and 5 were dead 2019 trade-show banners we collapsed into standard Content blocks. Our porting surface dropped to 23 blocks before sprint one started.
Cross-checking our plan against a practical zero-downtime Concrete5 to Concrete CMS migration guide confirmed the right pipeline: install the legacy Migration Tool package on a 5.6 clone, export CIF (Concrete XML Interchange Format) batches, and import them into a fresh Concrete CMS v9.2 instance on PHP 8.2 and MySQL 8.0. Hand-migrating raw SQL rows across a decade of schema divergence isn't brave—it's self-sabotage.
Untangling PHP 8.2 Breakage in Custom Blocks
Concrete5 5.6 blocks reflect a PHP 5.4 world: no namespaces, raw Loader::db() queries embedded straight inside view.php, and undeclared properties slapped onto $this during on_start(). Turning on full error reporting under PHP 8.2 surfaced four recurring failure patterns across our 23 ported blocks:
- Dynamic property deprecations: old controllers routinely wrote
$this->sku = $row['sku'];without declaring$sku. On PHP 8.2, those notices corrupted JSON responses inside v9's block edit modal. - Nullable database columns passed to string functions: legacy
bt*tables returnednullfrom nullableVARCHARcolumns, triggering endless deprecation warnings insidehtmlspecialchars(),trim(), andstrlen(). - Removed static loaders: every
Loader::db(),Loader::helper(), and globalPagecall had to move to Concrete's service container via$this->app->make(...)and namespacedConcrete\Coreimports. - Deprecated
utf8_encode()hacks: two datasheet blocks still patched around a 2014latin1table withutf8_encode(). Fixing the table charset let us delete those calls outright.
Here is a trimmed v9 controller after stripping ADOdb and typing its properties explicitly:
<?php
declare(strict_types=1);
namespace Application\Block\SpecMatrix;
use Concrete\Core\Block\BlockController;
use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\File\File;
class Controller extends BlockController
{
protected $btTable = 'btSpecMatrix';
public ?string $skuPrefix = null;
public ?int $datasheetFileId = null;
public function view(): void
{
$db = $this->app->make(Connection::class);
$rows = $db->fetchAllAssociative(
'SELECT spec_label, spec_value FROM btSpecMatrixRows WHERE bID = ? ORDER BY sort_order',
[(int) $this->bID]
);
$file = $this->datasheetFileId ? File::getByID($this->datasheetFileId) : null;
$this->set('skuPrefix', (string) ($this->skuPrefix ?? ''));
$this->set('rows', $rows);
$this->set('datasheetUrl', $file ? $file->getDownloadURL() : '');
}
}
Remapping Legacy File IDs Without Manual Re-Linking
The nastiest trap wasn't PHP syntax—it was numeric fID references. In 5.6, custom blocks stored raw integers pointing at the Files table. When v9 ingests 6,300 assets, every file gets a new ID and UUID. Copying datasheetFileId = 4182 verbatim from CIF XML silently points product pages at the wrong hydraulic valve PDF. We exported a JSON manifest from 5.6 mapping each legacy fID to its filename and SHA-256 hash, then wrote custom Migration Tool publisher classes on v9 that resolved every block's file reference by hash during batch import.
Surviving Doctrine Schema Diffs and Strict SQL Mode
Legacy 5.6 blocks defined tables using ADOdb's AXMLS db.xml format (version 0.3), whereas v9 expects Doctrine DBAL XML (version 0.5) or Doctrine ORM entities. Translating 23 schema files took an afternoon; making MySQL 8.0 and Doctrine agree the schema had zero drift took three long days.
Running vendor/bin/concrete orm:schema-tool:update --dump-sql exposed three sharp edges. First, MySQL 8.0 omits integer display widths like INT(10), causing older column annotations to emit phantom ALTER TABLE diffs until we normalized everything to Doctrine 0.5 primitives. Second, our 5.6 dump mixed MyISAM and InnoDB engines alongside three collations (latin1_swedish_ci, utf8_general_ci, and utf8mb4_unicode_ci). Under v9's utf8mb4 defaults, joining custom tables against core tables threw Illegal mix of collations errors, and a composite index across two VARCHAR(255) fields failed InnoDB key-length limits until we switched to ROW_FORMAT=DYNAMIC and capped the indexed column at 191 characters.
Third, MySQL 8.0 enforces NO_ZERO_DATE by default. Our twelve-year-old schema held 840 rows storing 0000-00-00 00:00:00 inside cDatePublic and custom block timestamps. We scrubbed every zero date on the 5.6 staging clone back to its parent page's cDateAdded value before running CIF exports. Here is the clean Doctrine 0.5 db.xml pattern that finally passed orm:schema-tool:validate cleanly:
<schema xmlns="http://www.concrete5.org/doctrine-xml/0.5">
<table name="btSpecMatrix">
<field name="bID" type="integer"><unsigned/><key/></field>
<field name="skuPrefix" type="string" size="120">
<notnull/><default value=""/>
</field>
<field name="datasheetFileId" type="integer"><unsigned/></field>
</table>
<table name="btSpecMatrixRows">
<field name="id" type="integer"><unsigned/><autoincrement/><key/></field>
<field name="bID" type="integer"><unsigned/><notnull/></field>
<field name="spec_label" type="string" size="191"><notnull/></field>
<field name="spec_value" type="text"/>
<field name="sort_order" type="integer"><unsigned/><default value="0"/></field>
<index name="idx_spec_bid"><col>bID</col></index>
</table>
</schema>
Early schema inspection paid one extra dividend: we found 312 orphaned rows in CollectionVersionBlocks pointing at deleted bID records. Purging those orphans before export stopped the Migration Tool from crashing mid-batch on page 1,140.
Preserving Twelve Years of URL Equity and Asset Paths
Engineers obsess over code and schemas, yet URL architecture decides whether a migration survives commercially. We follow the exact same verification playbook we built for a Drupal relaunch without SEO collapse, adapted for Concrete5's quirks.
Concrete5 5.6 served uploads from /files/4813/9201/8821/brochure.pdf. Concrete CMS v9 moves public uploads to /application/files/ and generates new hashed subdirectories on import. Distributor portals, engineering forums, and Google's PDF index held over 1,900 direct backlinks to old /files/ paths. Letting those return 404 would have torched years of authority overnight.
Meanwhile, Concrete5's PagePaths table quietly hoards non-canonical historical paths (ppIsCanonical = 0) across twelve years of page renames. Combine those with ancient /index.php/products/... URLs from 2015, mixed-case slugs, and ?cID=412 links from old email campaigns, and our live URL footprint tripled the actual page count.
Skip cramming 5,000 legacy rules into Concrete's database or a giant .htaccess file. Keep editor-managed canonical aliases in v9's PagePaths, and offload historical URLs plus /files/ asset remaps to an Nginx map block. Nginx resolves hash-table lookups in memory in under 0.4 ms without waking PHP-FPM:
map $uri $c5_legacy_redirect {
default "";
include /etc/nginx/conf.d/c5_page_redirects.map;
include /etc/nginx/conf.d/c5_file_redirects.map;
}
server {
listen 443 ssl http2;
server_name example-mfg.com;
rewrite ^/index\.php/(.*)$ /$1 permanent;
if ($c5_legacy_redirect != "") {
return 301 https://$host$c5_legacy_redirect;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
We generated both map files from three data sources: every 5.6 PagePaths row, eighteen months of Nginx access logs returning HTTP 200, and the top 5,000 Google Search Console landing pages. Our SHA-256 manifest paired every legacy /files/ URL directly with its new /application/files/ path. Before DNS cutover, a Python harness hammered all 4,920 mapped URLs on staging to verify two invariants: zero 404s and zero multi-hop chains (every legacy path had to resolve to a final 200 OK in a single 301 hop).
Cutover Metrics and a Pre-Flight Checklist
Launch night stayed intentionally dull. We lowered DNS TTLs to 60 seconds three days ahead, froze editorial edits at 22:00 UTC, imported a 19-page delta batch, and cut the upstream proxy over in 18 minutes. Tailing live 404 logs for 72 hours surfaced 411 obscure query-string and datasheet links outside our 18-month log window; we appended them to the Nginx map and reloaded cleanly.
At sixty days post-launch, Search Console recorded a 0.4% gain in indexed URLs with steady organic impressions across every product line. Median time-to-first-byte fell from 640 ms on PHP 7.2 and MyISAM to 118 ms on PHP 8.2 with OPcache preloading, InnoDB, and edge redirects.
If a Concrete5 5.6 to v9 migration plan looks clean on paper, someone forgot to count the custom block tables, the zero dates, or the /files/ PDF backlinks.
Keep this short checklist handy before migrating an aging 5.6 install:
- Query
CollectionVersionBlocksagainst active, approved pages first so you never port dead blocks. - Run PHPStan at level 5 across every v9 block controller on PHP 8.2 to catch dynamic properties and nullable string arguments early.
- Export a SHA-256 file manifest from 5.6 to remap both custom block
fIDvalues and/files/redirects deterministically. - Scrub
0000-00-00 00:00:00dates, mixed collations, and orphaned block references on your staging clone before generating CIF batches. - Verify every Search Console and access-log URL against your staging Nginx
mapfile until single-hop 301 coverage hits 100%. - Leave the old 5.6 VM running read-only on an internal VLAN for thirty days—the first time someone asks for an unlinked 2015 PDF, you'll thank yourself.
Comments
Post a Comment