forked from fa/breadcrumb-the-shire
Completes the generic module platform that enables modules to contribute
UI elements, runtime JS components, and search resources without any
core hardcoding.
New generic UI slot types:
- topbar.right_item: module-contributed topbar buttons
- layout.body_end_template: module-contributed dialog/overlay templates
- layout.head_style: module-contributed global CSS
- runtime.component: declarative JS component registration with phase ordering
New infrastructure:
- ModuleAutoloader: PSR-4 autoloading for module-local PHP classes
- ModuleRuntimePageBuilder: symlinks module pages into runtime directory
- ModuleRuntimeAssetPublisher: publishes module CSS/JS to web/modules/
- ModulePermissionSynchronizer: syncs module permissions to DB
- CLI scripts: module-runtime-sync, module-build, module-migrate,
module-permissions-sync, module-assets-sync
- {{userId}} placeholder in SearchDataService for user-scoped search queries
- Component runtime with phased initialization (early/default/late)
- AppContainer.protectExistingBindings() to prevent module→core overwrites
- Architecture tests: ModuleStructureContractTest, CoreTemplateIsolationTest,
FrontendComponentRuntimeContractTest, AppContainerIsolationContractTest
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
/**
|
|
* Synchronizes module-declared permissions into the permissions table.
|
|
*
|
|
* Usage: php bin/module-permissions-sync.php
|
|
*
|
|
* Exit codes:
|
|
* 0 — sync successful
|
|
* 1 — error during sync
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
use MintyPHP\App\Module\ModulePermissionSynchronizer;
|
|
use MintyPHP\App\Module\ModuleRegistry;
|
|
use MintyPHP\Repository\Access\PermissionRepository;
|
|
|
|
require_once __DIR__ . '/module-cli-bootstrap.php';
|
|
|
|
function modulePermissionsSyncRun(): int
|
|
{
|
|
$warningsBefore = moduleCliVendorWarningsIgnoredTotal();
|
|
moduleCliBootstrapApp();
|
|
|
|
$exitCode = 0;
|
|
try {
|
|
$synchronizer = new ModulePermissionSynchronizer(
|
|
app(ModuleRegistry::class),
|
|
app(PermissionRepository::class)
|
|
);
|
|
$result = $synchronizer->sync();
|
|
|
|
fwrite(STDOUT, sprintf(
|
|
"module-permissions-sync: created=%d updated=%d unchanged=%d total=%d\n",
|
|
$result['created'],
|
|
$result['updated'],
|
|
$result['unchanged'],
|
|
$result['total']
|
|
));
|
|
} catch (Throwable $exception) {
|
|
fwrite(STDERR, sprintf("module-permissions-sync: FAILED: %s\n", $exception->getMessage()));
|
|
$exitCode = 1;
|
|
}
|
|
|
|
$vendorWarningsIgnored = moduleCliVendorWarningsIgnoredSince($warningsBefore);
|
|
fwrite(STDOUT, sprintf("module-permissions-sync: vendor_warnings_ignored=%d\n", $vendorWarningsIgnored));
|
|
|
|
return $exitCode;
|
|
}
|
|
|
|
if (PHP_SAPI === 'cli' && realpath((string) ($_SERVER['SCRIPT_FILENAME'] ?? '')) === __FILE__) {
|
|
exit(modulePermissionsSyncRun());
|
|
}
|