2declare(strict_types=1);
6$check =
static function(
bool $condition,
string $message) use (&
$failures):
void {
10$dd = (string)file_get_contents(
$root .
'/dbx/modules/dbx/dd/dbxMediaUsage.dd.php');
11$cms = (string)file_get_contents(
$root .
'/dbx/modules/dbxContent_admin/include/dbxContent_cms.class.php');
12$renderer = (string)file_get_contents(
$root .
'/dbx/modules/dbxContent/include/dbxContentRenderer.class.php');
13$scope = (string)file_get_contents(
$root .
'/dbx/modules/dbxContent/include/dbxContentMediaUsageScope.class.php');
14$shop = (string)file_get_contents(
$root .
'/dbx/modules/dbxShop_admin/include/dbxShopAdmin.class.php');
15$ki = (string)file_get_contents(
$root .
'/dbx/modules/dbxKi/include/dbxKiCmsService.class.php');
23$check(str_contains(
$dd,
"\$field['name']='content_lng'"),
'dbxMediaUsage must persist the language of its content target.');
24$check(str_contains(
$dd,
'idx_media_usage_lng_context'),
'The language/context lookup must be indexed.');
27 str_contains(
$migration,
"require_once dirname(__DIR__, 2) . '/dbxContent/include/dbxContentMediaUsageScope.class.php'"),
28 'The media-usage migration must load new release dependencies from its own staged tree.'
33 && str_contains(
$repairMigration,
'content_lng wurde physisch nicht angelegt')
34 && str_contains(
$repairMigration,
"sync_dd_to_db('dbx', 'dbxMediaUsage', 'apply')"),
35 'The repair migration must enforce and verify the physical language schema.'
37$check(str_contains(
$cms,
"slot IN ('hero','gallery','header','teaser','footer')"),
'Page copying must use an explicit copy-slot allowlist.');
38$check(!str_contains(
$cms,
"active = 1 AND slot <> 'inline'"),
'Page copying must never select every non-inline slot (that copied shop data).');
39$check(str_contains(
$cms,
'dbxContentMediaUsageScope::withLanguage'),
'CMS usage reads and writes must be language scoped.');
40$check(str_contains(
$renderer,
'dbxContentMediaUsageScope::withLanguage'),
'Frontend rendering must be language scoped.');
42 str_contains(
$scope,
'if (!class_exists(dbxContentMediaUsageScope::class, false))'),
43 'The staged media-usage scope must be safe to include when the active release already loaded the class.'
45$check(str_contains(
$shop,
"'content_lng' => \$this->shopMediaUsageLng()"),
'Shop usage must be assigned to the stable master language.');
46$check(str_contains(
$shop,
"\$db->delete(") && str_contains(
$shop,
'sourceNeedle'),
'Shop synchronization must replace its own snapshot instead of accumulating inactive rows.');
47$check(str_contains(
$ki,
"slot IN ('hero','gallery','inline','header','teaser','footer')"),
'KI page translation/copy must exclude the shop slot.');
48$check(str_contains(
$cms,
'RecursiveDirectoryIterator') && str_contains(
$cms,
"'/media/_thumbs/'"),
'Thumbnail maintenance must scan the real thumbnail tree recursively.');
51 fwrite(STDERR,
"FAIL\n- " . implode(
"\n- ",
$failures) .
"\n");
55echo
"OK multilingual media-usage, copy, shop and thumbnail contracts.\n";