-
tests/lint/check-architecture.php<pre>@@ -21,6 +21,9 @@* bootstrap (keep only <delete>)* - legacy-ajax: TypeScript, JavaScript and templates call DatabaseObjectActions (`WoltLabSuite/Core/Ajax`,* `dboAction`, `className: "…\data\…Action"`, `WCF.Action.*`, `ajax-proxy`), use RPC endpoints+ * - core-table-write: no INSERT/UPDATE/DELETE/REPLACE on the tables of a base plugin (`coreTables` in+ * tests/lint/config.php), write through the commands of the base plugin; reading and the update+ * scripts in files/acp stay allowed** Known findings that cannot be changed yet are listed in tests/lint/config.php (`architectureKnown`: relative file* => list of rules); entries that no longer match make the check fail, so the list can only shrink.@@ -174,6 +177,19 @@$report('clipboardAction.xml', 'clipboard', 'installs clipboard actions, use bulk interactions (keep only <delete>)');}+$coreTables = config()['coreTables'];+if ($coreTables !== []) {+ $tables = \implode('|', \array_map(static fn (string $table): string => \preg_quote($table, '~'), $coreTables));+ $pattern = '~\b(?:INSERT\s+(?:IGNORE\s+)?INTO|REPLACE\s+INTO|UPDATE|DELETE\s+FROM)\s+(' . $tables . ')\b~i';++ // update scripts in files/acp migrate data and may write the tables directly+ foreach (files(['files/lib', 'files_wcf/lib'], ['.php']) as $relative => $path) {+ if (\preg_match($pattern, (string)\file_get_contents($path), $match)) {+ $report($relative, 'core-table-write', "writes {$match[1]} directly, use the commands of the base plugin");+ }+ }+}+$eventListenerXml = ROOT . '/eventListener.xml';if (\is_file($eventListenerXml) && \str_contains((string)\file_get_contents($eventListenerXml), '<import>')) {$report('eventListener.xml', 'legacy-listener', 'imports event listeners, use PSR-14 events and listeners registered in the bootstrap (keep only <delete>)');
-
tests/lint/lib.php<pre>@@ -34,6 +34,7 @@ function config(): array'architectureKnown' => $config['architectureKnown'] ?? [],'jsBuildDir' => $config['jsBuildDir'] ?? null,'jsPhrasesDynamic' => $config['jsPhrasesDynamic'] ?? false,+ 'coreTables' => $config['coreTables'] ?? [],];}