There's an implementation in SyntaxHighlight, TrustedXFF, and core's LCStoreStaticArray. They all differ slightly, and given that we're moving away from CDB to static PHP arrays, we should have a single implementation in core that can be reused.
|Open||None||T212460 Adopt static array files for local disk storage of values (epic)|
|Resolved||Legoktm||T200626 Standardize on a single PHP static array writer implementation|
There's an implementation in SyntaxHighlight, TrustedXFF, and core's LCStaticArray.
Also mediawiki-extensions-WikimediaMaintenance:/dumpInterwiki.php, and as of recent wfMakeStaticArrayFile() in MediaWiki core as used by maintenance/generateNormalizerDataMl.php.
Oh, I forgot about wfMakeStaticArrayFile. I think that meets my needs. Theoretically we could put it in the cdb library to match \Cdb\Reader\Hash, but that seems weird since it has nothing to do with cdb.
Tagging as a 1.32 release blocker to clarify on whether we want to librarize this (in cdb, or maybe something else) or whether we're ok with wfMakeStaticArrayFile() becoming a stable interface.
@Legoktm Aye, I apologise for including a new global function in 2018. It looked so nice alongside the wfGetPrecompiledData() function I was replacing at https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/434040/6/includes/GlobalFunctions.php.
Let's at least make it an autoloaded class rather than a global function before this becomes a stable release.