From eaccfcaa13f50f1c7d216cff38f8e49d05d2a276 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Sun, 30 Aug 2026 16:00:32 -0500 Subject: [PATCH] Follow ReportManagement into FOG\Pages Core bucketed the last 52 flat-namespace classes -- pages, hooks, reports and events -- out of lib/ and into src/{Pages,Hooks,Reports,Events}, so the only core class this tree names by its flat spelling moved: \FOG\ReportManagement is \FOG\Pages\ReportManagement. Eight report classes extend it. Without this they fatal with "Class FOG\ReportManagement not found" the moment someone opens the report -- core's autoloader refuses the flat spelling and logs the correct FQCN rather than resolving it, so the failure is legible, but it is still a failure. tests/core-references-are-qualified.test.php does NOT catch this, and cannot: it is a syntax gate that asks whether a class reference carries a leading backslash, not whether the name resolves. It has no copy of core's class list on purpose, so that it runs without a fogproject checkout beside it. It stayed green through the whole breakage. bin/qualify-core-references.php loses its lib/{pages,hooks,reports,events} pass, which read the directories the move emptied. Its src/ walk already maps these classes, and to the bucketed FQCN a plugin actually has to write -- whereas the retired pass ran afterwards and overwrote each entry with the flat spelling. Running the tool against the moved core tree now reports nothing left to rewrite, which is how the eight edits above were checked. Co-Authored-By: Claude --- bin/qualify-core-references.php | 17 ++++++++--------- ldap/reports/ldap_report.report.php | 2 +- location/reports/location_report.report.php | 2 +- ou/reports/ou_report.report.php | 2 +- .../reports/subnetgroup_report.report.php | 2 +- .../reports/taskstateedit_report.report.php | 2 +- .../reports/tasktypeedit_report.report.php | 2 +- windowskey/reports/windowskey_report.report.php | 2 +- .../reports/wolbroadcast_report.report.php | 2 +- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bin/qualify-core-references.php b/bin/qualify-core-references.php index 9e2c08f..c92c061 100644 --- a/bin/qualify-core-references.php +++ b/bin/qualify-core-references.php @@ -67,15 +67,14 @@ } } $webRoot = dirname($srcRoot); -foreach (['pages', 'hooks', 'reports', 'events'] as $dir) { - foreach (glob($webRoot . '/lib/' . $dir . '/*.php') as $path) { - $short = preg_replace('/\\.(page|hook|report|event)$/', '', basename($path, '.php')); - $src = file_get_contents($path); - if (preg_match('/^\\s*(?:final\\s+|abstract\\s+)*class\\s+(\\w+)/mi', $src, $m)) { - $core[strtolower($m[1])] = 'FOG\\' . $m[1]; - } - } -} +// The lib/{pages,hooks,reports,events} pass that used to run here is gone +// with the directories it read. Those 52 classes were the last holdouts in +// the flat `namespace FOG;`, kept there because discovery derived their name +// from the filename; they are PSR-4 files under src/{Pages,Hooks,Reports, +// Events} now, so the src/ walk above already maps them -- and maps them to +// the bucketed FQCN a plugin actually has to write. Keeping the pass would +// have been worse than redundant: it ran AFTER the walk and overwrote each +// entry with the flat `FOG\` spelling, which no longer resolves. foreach (glob($webRoot . '/commons/*.php') as $path) { if (preg_match_all( '/^\\s*(?:final\\s+|abstract\\s+)*class\\s+(\\w+)/mi', diff --git a/ldap/reports/ldap_report.report.php b/ldap/reports/ldap_report.report.php index 21c5fef..930f528 100644 --- a/ldap/reports/ldap_report.report.php +++ b/ldap/reports/ldap_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class LDAP_Report extends \FOG\ReportManagement +class LDAP_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/location/reports/location_report.report.php b/location/reports/location_report.report.php index f2e7792..d827a2a 100644 --- a/location/reports/location_report.report.php +++ b/location/reports/location_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class Location_Report extends \FOG\ReportManagement +class Location_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/ou/reports/ou_report.report.php b/ou/reports/ou_report.report.php index 3f71e62..7e676d8 100644 --- a/ou/reports/ou_report.report.php +++ b/ou/reports/ou_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class OU_Report extends \FOG\ReportManagement +class OU_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/subnetgroup/reports/subnetgroup_report.report.php b/subnetgroup/reports/subnetgroup_report.report.php index 45452b3..7386a93 100644 --- a/subnetgroup/reports/subnetgroup_report.report.php +++ b/subnetgroup/reports/subnetgroup_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class SubnetGroup_Report extends \FOG\ReportManagement +class SubnetGroup_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/taskstateedit/reports/taskstateedit_report.report.php b/taskstateedit/reports/taskstateedit_report.report.php index 80b7314..d565ca7 100644 --- a/taskstateedit/reports/taskstateedit_report.report.php +++ b/taskstateedit/reports/taskstateedit_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class Taskstateedit_Report extends \FOG\ReportManagement +class Taskstateedit_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/tasktypeedit/reports/tasktypeedit_report.report.php b/tasktypeedit/reports/tasktypeedit_report.report.php index 6792007..4e499a5 100644 --- a/tasktypeedit/reports/tasktypeedit_report.report.php +++ b/tasktypeedit/reports/tasktypeedit_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class Tasktypeedit_Report extends \FOG\ReportManagement +class Tasktypeedit_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/windowskey/reports/windowskey_report.report.php b/windowskey/reports/windowskey_report.report.php index 32a138f..2001a3c 100644 --- a/windowskey/reports/windowskey_report.report.php +++ b/windowskey/reports/windowskey_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class WindowsKey_Report extends \FOG\ReportManagement +class WindowsKey_Report extends \FOG\Pages\ReportManagement { /** * The page to display. diff --git a/wolbroadcast/reports/wolbroadcast_report.report.php b/wolbroadcast/reports/wolbroadcast_report.report.php index 11c22c4..67a32be 100644 --- a/wolbroadcast/reports/wolbroadcast_report.report.php +++ b/wolbroadcast/reports/wolbroadcast_report.report.php @@ -19,7 +19,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ -class Wolbroadcast_Report extends \FOG\ReportManagement +class Wolbroadcast_Report extends \FOG\Pages\ReportManagement { /** * The page to display.