Makes the data a site wrote usable by the same site elsewhere: the absolute addresses of one of its copies -- its urls, the folders it runs from -- are written relative, so what production saved still works here, and the other way round (DataSync).
class MMO\admin\helpers\PortableContent
Espace de noms
MMO\admin\helpers
- an url of the site, `https://site.com/base/assets/x.jpg`, becomes `assets/x.jpg`: relative to the application,
as mmo.editor writes its images and links already; the site's url alone becomes `./`. Its `http:` and `https:`
forms, the protocol-relative `//site.com/base/`, and JSON's escaped `https:\/\/site.com\/` are all recognised.
- a folder of the site, `/var/www/site/releases/1.0.3/www/assets`, becomes `{root}/www/assets`: the alias
`\MMO\filename()` resolves wherever the site runs. A target's folder stands for its releases, `current` and
`shared/`, which all hold the application's root; the project's folder here stands for itself.
A text file is rewritten as it is; an SQLite database (`SQLite format 3`) through its text columns, in place; any
other binary file is left alone. What is left that still looks like one of these addresses afterwards is
reported ([`leftovers`](https://mmoframework.fr/fr/documentation/mmo.admin/php/helpers/PortableContent.md#portablecontent-leftovers)): an address the declaration does not know of yet (`sync.urls`, `sync.folders`).
$portable = new PortableContent(['https://acme.com/'], ['/var/www/acme'], ['/home/me/dev/acme']);
$portable->apply('{"src":"https:\/\/acme.com\/assets\/a.jpg","dir":"/var/www/acme/current/db"}');
// {"src":"assets\/a.jpg","dir":"{root}/db"}