From fa9b9be8683f025e02cda5cf095ca8c0de808b07 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Mon, 31 Aug 2026 09:59:11 -0500 Subject: [PATCH] Lay every plugin out like core: src//.php Namespacing left the plugins half-migrated. Every class moved into FOG\Plugins\, but the files stayed where they were, so a plugin declared FOG\Plugins\LDAP\LDAPManager out of a file called class/ldapmanager.class.php and core needed a scan-and-cache mechanism -- 176 file_get_contents on a cold cache -- to reconcile the two. The layout now follows the namespace. A plugin is laid out exactly like core and discovered by exactly the mechanism core uses on itself: /src//.php declares FOG\Plugins\\\ with the file name equal to the class name and strtolower() equal to the plugin's directory name. The directory does not move: it is plugins.pName, the ?node= value, the .view permission string and the js/ URL, so there is no schema migration and no RBAC churn. class/ splits three ways by what a class extends -- FOGController to src/Items/, FOGManagerController to src/Managers/, plain FOGBase helpers to src/Util/. pages/ hooks/ events/ reports/ tasks/ reg-task/ map straight across. Report classes keep their underscored names, as core's own do, because the menu key, the base64 `f` parameter and the permission node are all derived from that name. Every move is a git mv, so per-file history follows. Gates: - tests/plugin-layout.test.php replaces plugins-are-namespaced.test.php. It holds all three rules -- file name equals class name including case, path equals namespace, segment lowercases to the directory -- plus a floor, no class_alias() and no leftover pre-1.6 directory. The test it replaces matched on the six discovery suffixes and had no minimum, so after this move it would have matched zero files and exited 0. - tests/references-resolve.test.php is new, and exists because core-references-are-qualified.test.php cannot see this failure. Bucketing means `class NtfyHandler extends Ntfy` now spans two namespaces: the bare name still names a class this tree declares, so the older gate stays green, php -l is happy, and the fatal arrives mid-request. This asks the question PHP asks -- given this file's namespace and its use imports, does the name resolve? All three layout rules and the resolution gate were mutation-verified. Requires fogproject core that understands this layout; older core and these plugins is a server with no working plugins, which is why the FOG_PLUGINS_VERSION pin moves in the same release. Co-Authored-By: Claude --- README.md | 44 ++- bin/qualify-core-references.php | 20 +- .../Hooks/AddBootMenuItem.php} | 2 +- .../Hooks/AddCaponeAPI.php} | 2 +- .../Hooks/AddCaponeJS.php} | 2 +- .../Hooks/AddCaponeMenuItem.php} | 2 +- .../capone.class.php => src/Items/Capone.php} | 2 +- .../Managers/CaponeManager.php} | 2 +- .../Pages/CaponeManagement.php} | 2 +- .../Util/CaponeTasking.php} | 2 +- .../Hooks/AddHelloWorldAPI.php} | 2 +- .../Hooks/AddHelloWorldJS.php} | 2 +- .../Hooks/AddHelloWorldMenuItem.php} | 8 +- .../Items/HelloWorld.php} | 18 +- .../Managers/HelloWorldManager.php} | 2 +- .../Pages/HelloWorldManagement.php} | 2 +- .../Tasks/HelloWorldHeartbeat.php} | 16 +- .../Hooks/AddLDAPAPI.php} | 4 +- .../Hooks/AddLDAPGroupTabs.php} | 2 +- .../Hooks/AddLDAPJS.php} | 2 +- .../Hooks/AddLDAPMenuItem.php} | 2 +- .../Hooks/AddLDAPType.php} | 2 +- .../Hooks/LDAPDeleteMassItems.php} | 4 +- .../Hooks/LDAPPluginHook.php} | 4 +- .../ldap.class.php => src/Items/LDAP.php} | 2 +- .../Items/LDAPGroup.php} | 2 +- .../Items/LDAPGroupRoleAssociation.php} | 2 +- .../Items/LDAPGroupUserGroupAssociation.php} | 2 +- .../Items/LDAPUserGrant.php} | 2 +- .../Managers/LDAPGroupManager.php} | 2 +- .../LDAPGroupRoleAssociationManager.php} | 2 +- .../LDAPGroupUserGroupAssociationManager.php} | 2 +- .../Managers/LDAPManager.php} | 4 +- .../Managers/LDAPUserGrantManager.php} | 2 +- .../Pages/LDAPGroupManagement.php} | 4 +- .../Pages/LDAPManagement.php} | 4 +- .../Reports/LDAP_Report.php} | 2 +- .../Hooks/AddLocationAPI.php} | 2 +- .../Hooks/AddLocationGroup.php} | 2 +- .../Hooks/AddLocationHost.php} | 2 +- .../Hooks/AddLocationImport.php} | 2 +- .../Hooks/AddLocationJS.php} | 2 +- .../Hooks/AddLocationMenuItem.php} | 2 +- .../Hooks/AddLocationType.php} | 2 +- .../Hooks/AddServiceConfiguration.php} | 2 +- .../Hooks/LocationChangeItems.php} | 26 +- .../Hooks/LocationDeleteMassItems.php} | 2 +- .../Items/Location.php} | 2 +- .../Items/LocationAssociation.php} | 2 +- .../Managers/LocationAssociationManager.php} | 2 +- .../Managers/LocationManager.php} | 2 +- .../Pages/LocationManagement.php} | 2 +- .../Reports/Location_Report.php} | 2 +- .../Events/ImageComplete_Ntfy.php} | 4 +- .../Events/ImageFail_Ntfy.php} | 4 +- .../Events/LoginFailure_Ntfy.php} | 4 +- .../Events/SnapinComplete_Ntfy.php} | 4 +- .../Events/SnapinTaskComplete_Ntfy.php} | 4 +- .../Hooks/AddNtfyAPI.php} | 2 +- .../Hooks/AddNtfyJS.php} | 2 +- .../Hooks/AddNtfyMenuItem.php} | 2 +- .../ntfy.class.php => src/Items/Ntfy.php} | 2 +- .../Managers/NtfyManager.php} | 2 +- .../Pages/NtfyManagement.php} | 2 +- .../Util/NtfyException.php} | 2 +- .../Util/NtfyExtends.php} | 2 +- .../Util/NtfyHandler.php} | 4 +- .../Hooks/AddOIDCAPI.php} | 4 +- .../Hooks/AddOIDCGroupTabs.php} | 2 +- .../Hooks/AddOIDCJS.php} | 2 +- .../Hooks/AddOIDCMenuItem.php} | 2 +- .../Hooks/AddOIDCRoutes.php} | 4 +- .../Hooks/OIDCDeleteMassItems.php} | 4 +- .../Hooks/OIDCLoginRedirect.php} | 4 +- .../Hooks/OIDCLogout.php} | 5 +- .../oidc.class.php => src/Items/OIDC.php} | 2 +- .../Items/OIDCGroup.php} | 2 +- .../Items/OIDCGroupRoleAssociation.php} | 2 +- .../Items/OIDCGroupUserGroupAssociation.php} | 2 +- .../Items/OIDCIdentity.php} | 2 +- .../Items/OIDCUserGrant.php} | 2 +- .../Managers/OIDCGroupManager.php} | 2 +- .../OIDCGroupRoleAssociationManager.php} | 2 +- .../OIDCGroupUserGroupAssociationManager.php} | 2 +- .../Managers/OIDCIdentityManager.php} | 2 +- .../Managers/OIDCManager.php} | 2 +- .../Managers/OIDCUserGrantManager.php} | 2 +- .../Pages/OIDCGroupManagement.php} | 4 +- .../Pages/OIDCManagement.php} | 4 +- .../Util/OIDCFlow.php} | 8 +- .../Hooks/AddOUAPI.php} | 2 +- .../Hooks/AddOUGroup.php} | 2 +- .../Hooks/AddOUHost.php} | 2 +- .../Hooks/AddOUJS.php} | 2 +- .../Hooks/AddOUMenuItem.php} | 2 +- .../Hooks/AddOUType.php} | 2 +- .../Hooks/OUChangeItems.php} | 6 +- .../Hooks/OUDeleteMassItems.php} | 2 +- ou/{class/ou.class.php => src/Items/OU.php} | 2 +- .../Items/OUAssociation.php} | 2 +- .../Managers/OUAssociationManager.php} | 2 +- .../Managers/OUManager.php} | 2 +- .../Pages/OUManagement.php} | 2 +- .../Reports/OU_Report.php} | 2 +- .../Items/PersistentGroups.php} | 2 +- .../Managers/PersistentGroupsManager.php} | 2 +- .../Events/ImageComplete_PushBullet.php} | 4 +- .../Events/ImageFail_PushBullet.php} | 4 +- .../Events/LoginFailure_PushBullet.php} | 4 +- .../Events/SnapinComplete_PushBullet.php} | 4 +- .../Events/SnapinTaskComplete_PushBullet.php} | 4 +- .../Hooks/AddPushbulletAPI.php} | 2 +- .../Hooks/AddPushbulletJS.php} | 2 +- .../Hooks/AddPushbulletMenuItem.php} | 2 +- .../Items/Pushbullet.php} | 2 +- .../Managers/PushbulletManager.php} | 2 +- .../Pages/PushbulletManagement.php} | 2 +- .../Util/PushbulletException.php} | 2 +- .../Util/PushbulletExtends.php} | 2 +- .../Util/PushbulletHandler.php} | 4 +- .../Events/ImageComplete_Slack.php} | 2 +- .../Events/ImageFail_Slack.php} | 2 +- .../Events/LoginFailure_Slack.php} | 2 +- .../Events/SnapinComplete_Slack.php} | 2 +- .../Events/SnapinTaskComplete_Slack.php} | 2 +- .../Hooks/AddSlackAPI.php} | 2 +- .../Hooks/AddSlackJS.php} | 2 +- .../Hooks/AddSlackMenuItem.php} | 2 +- .../slack.class.php => src/Items/Slack.php} | 4 +- .../Managers/SlackManager.php} | 2 +- .../Pages/SlackManagement.php} | 2 +- .../Util/SlackException.php} | 2 +- .../Util/SlackHandler.php} | 4 +- .../Hooks/AddSubnetGroupAPI.php} | 2 +- .../Hooks/AddSubnetGroupHost.php} | 2 +- .../Hooks/AddSubnetGroupJS.php} | 2 +- .../Hooks/AddSubnetGroupMenuItem.php} | 2 +- .../Hooks/AddSubnetGroupType.php} | 2 +- .../Hooks/RemoveSubnetGroupGroup.php} | 2 +- .../Items/SubnetGroup.php} | 2 +- .../Managers/SubnetGroupManager.php} | 4 +- .../Pages/SubnetGroupManagement.php} | 2 +- .../Reports/SubnetGroup_Report.php} | 2 +- .../Hooks/AddTaskStateEditJS.php} | 2 +- .../Hooks/AddTaskStateType.php} | 2 +- .../Hooks/AddTaskstateeditMenuItem.php} | 2 +- .../Items/Taskstateedit.php} | 2 +- .../Managers/TaskstateeditManager.php} | 2 +- .../Pages/TaskstateeditManagement.php} | 2 +- .../Reports/Taskstateedit_Report.php} | 2 +- .../Hooks/AddTaskTypeEditJS.php} | 2 +- .../Hooks/AddTaskTypeType.php} | 2 +- .../Hooks/AddTasktypeeditMenuItem.php} | 2 +- .../Items/Tasktypeedit.php} | 2 +- .../Managers/TasktypeeditManager.php} | 2 +- .../Pages/TasktypeeditManagement.php} | 2 +- .../Reports/Tasktypeedit_Report.php} | 2 +- tests/booleans-are-tinyint.test.php | 11 +- .../foreign-keys-applied-per-plugin.test.php | 16 +- tests/group-tab-permissions.test.php | 4 +- tests/imaging-notification-detail.test.php | 19 +- tests/oidc-auto-redirect.test.php | 12 +- tests/oidc-flow-safety.test.php | 20 +- tests/oidc-profile-refresh.test.php | 2 +- tests/oidc-provider-safety.test.php | 34 +-- tests/oidc-single-logout.test.php | 8 +- .../plugin-id-columns-are-classified.test.php | 8 +- tests/plugin-layout.test.php | 229 +++++++++++++++ tests/plugins-are-namespaced.test.php | 216 -------------- tests/references-resolve.test.php | 278 ++++++++++++++++++ tests/report-titles-are-registered.test.php | 16 +- tests/tables-carry-column-defaults.test.php | 12 +- .../Hooks/AddWindowsKeyImage.php} | 2 +- .../Hooks/AddWindowsKeyJS.php} | 2 +- .../Hooks/AddWindowsKeyMenuItem.php} | 2 +- .../Hooks/AddWindowskeyAPI.php} | 2 +- .../Hooks/ChangeHostKey.php} | 2 +- .../Hooks/WindowsKeyDeleteMassItems.php} | 2 +- .../Items/WindowsKey.php} | 2 +- .../Items/WindowsKeyAssociation.php} | 2 +- .../WindowsKeyAssociationManager.php} | 2 +- .../Managers/WindowsKeyManager.php} | 2 +- .../Pages/WindowsKeyManagement.php} | 2 +- .../Reports/WindowsKey_Report.php} | 2 +- .../Hooks/AddBroadcastAddresses.php} | 2 +- .../Hooks/AddWOLBroadcastAPI.php} | 2 +- .../Hooks/AddWOLBroadcastJS.php} | 2 +- .../Hooks/AddWOLBroadcastMenuItem.php} | 2 +- .../Hooks/AddWOLBroadcastType.php} | 2 +- .../Items/Wolbroadcast.php} | 2 +- .../Managers/WolbroadcastManager.php} | 2 +- .../Pages/WOLBroadcastManagement.php} | 2 +- .../Reports/Wolbroadcast_Report.php} | 2 +- 193 files changed, 927 insertions(+), 501 deletions(-) rename capone/{hooks/addbootmenuitem.hook.php => src/Hooks/AddBootMenuItem.php} (98%) rename capone/{hooks/addcaponeapi.hook.php => src/Hooks/AddCaponeAPI.php} (99%) rename capone/{hooks/addcaponejs.hook.php => src/Hooks/AddCaponeJS.php} (97%) rename capone/{hooks/addcaponemenuitem.hook.php => src/Hooks/AddCaponeMenuItem.php} (98%) rename capone/{class/capone.class.php => src/Items/Capone.php} (98%) rename capone/{class/caponemanager.class.php => src/Managers/CaponeManager.php} (99%) rename capone/{pages/caponemanagement.page.php => src/Pages/CaponeManagement.php} (99%) rename capone/{reg-task/caponetasking.class.php => src/Util/CaponeTasking.php} (99%) rename helloworld/{hooks/addhelloworldapi.hook.php => src/Hooks/AddHelloWorldAPI.php} (97%) rename helloworld/{hooks/addhelloworldjs.hook.php => src/Hooks/AddHelloWorldJS.php} (98%) rename helloworld/{hooks/addhelloworldmenuitem.hook.php => src/Hooks/AddHelloWorldMenuItem.php} (90%) rename helloworld/{class/helloworld.class.php => src/Items/HelloWorld.php} (66%) rename helloworld/{class/helloworldmanager.class.php => src/Managers/HelloWorldManager.php} (98%) rename helloworld/{pages/helloworldmanagement.page.php => src/Pages/HelloWorldManagement.php} (99%) rename helloworld/{tasks/helloworldheartbeat.task.php => src/Tasks/HelloWorldHeartbeat.php} (84%) rename ldap/{hooks/addldapapi.hook.php => src/Hooks/AddLDAPAPI.php} (98%) rename ldap/{hooks/addldapgrouptabs.hook.php => src/Hooks/AddLDAPGroupTabs.php} (99%) rename ldap/{hooks/addldapjs.hook.php => src/Hooks/AddLDAPJS.php} (98%) rename ldap/{hooks/addldapmenuitem.hook.php => src/Hooks/AddLDAPMenuItem.php} (99%) rename ldap/{hooks/addldaptype.hook.php => src/Hooks/AddLDAPType.php} (97%) rename ldap/{hooks/ldapdeletemassitems.hook.php => src/Hooks/LDAPDeleteMassItems.php} (98%) rename ldap/{hooks/ldappluginhook.hook.php => src/Hooks/LDAPPluginHook.php} (99%) rename ldap/{class/ldap.class.php => src/Items/LDAP.php} (99%) rename ldap/{class/ldapgroup.class.php => src/Items/LDAPGroup.php} (99%) rename ldap/{class/ldapgrouproleassociation.class.php => src/Items/LDAPGroupRoleAssociation.php} (97%) rename ldap/{class/ldapgroupusergroupassociation.class.php => src/Items/LDAPGroupUserGroupAssociation.php} (97%) rename ldap/{class/ldapusergrant.class.php => src/Items/LDAPUserGrant.php} (98%) rename ldap/{class/ldapgroupmanager.class.php => src/Managers/LDAPGroupManager.php} (98%) rename ldap/{class/ldapgrouproleassociationmanager.class.php => src/Managers/LDAPGroupRoleAssociationManager.php} (98%) rename ldap/{class/ldapgroupusergroupassociationmanager.class.php => src/Managers/LDAPGroupUserGroupAssociationManager.php} (98%) rename ldap/{class/ldapmanager.class.php => src/Managers/LDAPManager.php} (99%) rename ldap/{class/ldapusergrantmanager.class.php => src/Managers/LDAPUserGrantManager.php} (98%) rename ldap/{pages/ldapgroupmanagement.page.php => src/Pages/LDAPGroupManagement.php} (99%) rename ldap/{pages/ldapmanagement.page.php => src/Pages/LDAPManagement.php} (99%) rename ldap/{reports/ldap_report.report.php => src/Reports/LDAP_Report.php} (98%) rename location/{hooks/addlocationapi.hook.php => src/Hooks/AddLocationAPI.php} (99%) rename location/{hooks/addlocationgroup.hook.php => src/Hooks/AddLocationGroup.php} (99%) rename location/{hooks/addlocationhost.hook.php => src/Hooks/AddLocationHost.php} (99%) rename location/{hooks/addlocationimport.hook.php => src/Hooks/AddLocationImport.php} (99%) rename location/{hooks/addlocationjs.hook.php => src/Hooks/AddLocationJS.php} (97%) rename location/{hooks/addlocationmenuitem.hook.php => src/Hooks/AddLocationMenuItem.php} (99%) rename location/{hooks/addlocationtype.hook.php => src/Hooks/AddLocationType.php} (97%) rename location/{hooks/addserviceconfiguration.hook.php => src/Hooks/AddServiceConfiguration.php} (98%) rename location/{hooks/locationchangeitems.hook.php => src/Hooks/LocationChangeItems.php} (91%) rename location/{hooks/locationdeletemassitems.hook.php => src/Hooks/LocationDeleteMassItems.php} (98%) rename location/{class/location.class.php => src/Items/Location.php} (99%) rename location/{class/locationassociation.class.php => src/Items/LocationAssociation.php} (98%) rename location/{class/locationassociationmanager.class.php => src/Managers/LocationAssociationManager.php} (97%) rename location/{class/locationmanager.class.php => src/Managers/LocationManager.php} (99%) rename location/{pages/locationmanagement.page.php => src/Pages/LocationManagement.php} (99%) rename location/{reports/location_report.report.php => src/Reports/Location_Report.php} (98%) rename ntfy/{events/imagecomplete_ntfy.event.php => src/Events/ImageComplete_Ntfy.php} (97%) rename ntfy/{events/imagefail_ntfy.event.php => src/Events/ImageFail_Ntfy.php} (96%) rename ntfy/{events/loginfailure_ntfy.event.php => src/Events/LoginFailure_Ntfy.php} (95%) rename ntfy/{events/snapincomplete_ntfy.event.php => src/Events/SnapinComplete_Ntfy.php} (95%) rename ntfy/{events/snapintaskcomplete_ntfy.event.php => src/Events/SnapinTaskComplete_Ntfy.php} (96%) rename ntfy/{hooks/addntfyapi.hook.php => src/Hooks/AddNtfyAPI.php} (97%) rename ntfy/{hooks/addntfyjs.hook.php => src/Hooks/AddNtfyJS.php} (97%) rename ntfy/{hooks/addntfymenuitem.hook.php => src/Hooks/AddNtfyMenuItem.php} (98%) rename ntfy/{class/ntfy.class.php => src/Items/Ntfy.php} (97%) rename ntfy/{class/ntfymanager.class.php => src/Managers/NtfyManager.php} (98%) rename ntfy/{pages/ntfymanagement.page.php => src/Pages/NtfyManagement.php} (99%) rename ntfy/{class/ntfyexception.class.php => src/Util/NtfyException.php} (95%) rename ntfy/{class/ntfyextends.class.php => src/Util/NtfyExtends.php} (99%) rename ntfy/{class/ntfyhandler.class.php => src/Util/NtfyHandler.php} (98%) rename oidc/{hooks/addoidcapi.hook.php => src/Hooks/AddOIDCAPI.php} (98%) rename oidc/{hooks/addoidcgrouptabs.hook.php => src/Hooks/AddOIDCGroupTabs.php} (99%) rename oidc/{hooks/addoidcjs.hook.php => src/Hooks/AddOIDCJS.php} (98%) rename oidc/{hooks/addoidcmenuitem.hook.php => src/Hooks/AddOIDCMenuItem.php} (99%) rename oidc/{hooks/addoidcroutes.hook.php => src/Hooks/AddOIDCRoutes.php} (98%) rename oidc/{hooks/oidcdeletemassitems.hook.php => src/Hooks/OIDCDeleteMassItems.php} (98%) rename oidc/{hooks/oidcloginredirect.hook.php => src/Hooks/OIDCLoginRedirect.php} (97%) rename oidc/{hooks/oidclogout.hook.php => src/Hooks/OIDCLogout.php} (97%) rename oidc/{class/oidc.class.php => src/Items/OIDC.php} (99%) rename oidc/{class/oidcgroup.class.php => src/Items/OIDCGroup.php} (99%) rename oidc/{class/oidcgrouproleassociation.class.php => src/Items/OIDCGroupRoleAssociation.php} (97%) rename oidc/{class/oidcgroupusergroupassociation.class.php => src/Items/OIDCGroupUserGroupAssociation.php} (97%) rename oidc/{class/oidcidentity.class.php => src/Items/OIDCIdentity.php} (99%) rename oidc/{class/oidcusergrant.class.php => src/Items/OIDCUserGrant.php} (98%) rename oidc/{class/oidcgroupmanager.class.php => src/Managers/OIDCGroupManager.php} (98%) rename oidc/{class/oidcgrouproleassociationmanager.class.php => src/Managers/OIDCGroupRoleAssociationManager.php} (98%) rename oidc/{class/oidcgroupusergroupassociationmanager.class.php => src/Managers/OIDCGroupUserGroupAssociationManager.php} (98%) rename oidc/{class/oidcidentitymanager.class.php => src/Managers/OIDCIdentityManager.php} (98%) rename oidc/{class/oidcmanager.class.php => src/Managers/OIDCManager.php} (99%) rename oidc/{class/oidcusergrantmanager.class.php => src/Managers/OIDCUserGrantManager.php} (98%) rename oidc/{pages/oidcgroupmanagement.page.php => src/Pages/OIDCGroupManagement.php} (99%) rename oidc/{pages/oidcmanagement.page.php => src/Pages/OIDCManagement.php} (99%) rename oidc/{class/oidcflow.class.php => src/Util/OIDCFlow.php} (99%) rename ou/{hooks/addouapi.hook.php => src/Hooks/AddOUAPI.php} (98%) rename ou/{hooks/addougroup.hook.php => src/Hooks/AddOUGroup.php} (99%) rename ou/{hooks/addouhost.hook.php => src/Hooks/AddOUHost.php} (99%) rename ou/{hooks/addoujs.hook.php => src/Hooks/AddOUJS.php} (98%) rename ou/{hooks/addoumenuitem.hook.php => src/Hooks/AddOUMenuItem.php} (99%) rename ou/{hooks/addoutype.hook.php => src/Hooks/AddOUType.php} (97%) rename ou/{hooks/ouchangeitems.hook.php => src/Hooks/OUChangeItems.php} (92%) rename ou/{hooks/oudeletemassitems.hook.php => src/Hooks/OUDeleteMassItems.php} (98%) rename ou/{class/ou.class.php => src/Items/OU.php} (98%) rename ou/{class/ouassociation.class.php => src/Items/OUAssociation.php} (98%) rename ou/{class/ouassociationmanager.class.php => src/Managers/OUAssociationManager.php} (98%) rename ou/{class/oumanager.class.php => src/Managers/OUManager.php} (99%) rename ou/{pages/oumanagement.page.php => src/Pages/OUManagement.php} (99%) rename ou/{reports/ou_report.report.php => src/Reports/OU_Report.php} (98%) rename persistentgroups/{class/persistentgroups.class.php => src/Items/PersistentGroups.php} (92%) rename persistentgroups/{class/persistentgroupsmanager.class.php => src/Managers/PersistentGroupsManager.php} (99%) rename pushbullet/{events/imagecomplete_pushbullet.event.php => src/Events/ImageComplete_PushBullet.php} (96%) rename pushbullet/{events/imagefail_pushbullet.event.php => src/Events/ImageFail_PushBullet.php} (96%) rename pushbullet/{events/loginfailure_pushbullet.event.php => src/Events/LoginFailure_PushBullet.php} (95%) rename pushbullet/{events/snapincomplete_pushbullet.event.php => src/Events/SnapinComplete_PushBullet.php} (94%) rename pushbullet/{events/snapintaskcomplete_pushbullet.event.php => src/Events/SnapinTaskComplete_PushBullet.php} (95%) rename pushbullet/{hooks/addpushbulletapi.hook.php => src/Hooks/AddPushbulletAPI.php} (98%) rename pushbullet/{hooks/addpushbulletjs.hook.php => src/Hooks/AddPushbulletJS.php} (97%) rename pushbullet/{hooks/addpushbulletmenuitem.hook.php => src/Hooks/AddPushbulletMenuItem.php} (98%) rename pushbullet/{class/pushbullet.class.php => src/Items/Pushbullet.php} (96%) rename pushbullet/{class/pushbulletmanager.class.php => src/Managers/PushbulletManager.php} (98%) rename pushbullet/{pages/pushbulletmanagement.page.php => src/Pages/PushbulletManagement.php} (98%) rename pushbullet/{class/pushbulletexception.class.php => src/Util/PushbulletException.php} (94%) rename pushbullet/{class/pushbulletextends.class.php => src/Util/PushbulletExtends.php} (98%) rename pushbullet/{class/pushbullethandler.class.php => src/Util/PushbulletHandler.php} (99%) rename slack/{events/imagecomplete_slack.event.php => src/Events/ImageComplete_Slack.php} (98%) rename slack/{events/imagefail_slack.event.php => src/Events/ImageFail_Slack.php} (98%) rename slack/{events/loginfailure_slack.event.php => src/Events/LoginFailure_Slack.php} (97%) rename slack/{events/snapincomplete_slack.event.php => src/Events/SnapinComplete_Slack.php} (97%) rename slack/{events/snapintaskcomplete_slack.event.php => src/Events/SnapinTaskComplete_Slack.php} (98%) rename slack/{hooks/addslackapi.hook.php => src/Hooks/AddSlackAPI.php} (99%) rename slack/{hooks/addslackjs.hook.php => src/Hooks/AddSlackJS.php} (97%) rename slack/{hooks/addslackmenuitem.hook.php => src/Hooks/AddSlackMenuItem.php} (98%) rename slack/{class/slack.class.php => src/Items/Slack.php} (97%) rename slack/{class/slackmanager.class.php => src/Managers/SlackManager.php} (98%) rename slack/{pages/slackmanagement.page.php => src/Pages/SlackManagement.php} (99%) rename slack/{class/slackexception.class.php => src/Util/SlackException.php} (94%) rename slack/{class/slackhandler.class.php => src/Util/SlackHandler.php} (99%) rename subnetgroup/{hooks/addsubnetgroupapi.hook.php => src/Hooks/AddSubnetGroupAPI.php} (98%) rename subnetgroup/{hooks/addsubnetgrouphost.hook.php => src/Hooks/AddSubnetGroupHost.php} (98%) rename subnetgroup/{hooks/addsubnetgroupjs.hook.php => src/Hooks/AddSubnetGroupJS.php} (97%) rename subnetgroup/{hooks/addsubnetgroupmenuitem.hook.php => src/Hooks/AddSubnetGroupMenuItem.php} (99%) rename subnetgroup/{hooks/addsubnetgrouptype.hook.php => src/Hooks/AddSubnetGroupType.php} (97%) rename subnetgroup/{hooks/removesubnetgroupgroup.hook.php => src/Hooks/RemoveSubnetGroupGroup.php} (97%) rename subnetgroup/{class/subnetgroup.class.php => src/Items/SubnetGroup.php} (97%) rename subnetgroup/{class/subnetgroupmanager.class.php => src/Managers/SubnetGroupManager.php} (97%) rename subnetgroup/{pages/subnetgroupmanagement.page.php => src/Pages/SubnetGroupManagement.php} (99%) rename subnetgroup/{reports/subnetgroup_report.report.php => src/Reports/SubnetGroup_Report.php} (97%) rename taskstateedit/{hooks/addtaskstateeditjs.hook.php => src/Hooks/AddTaskStateEditJS.php} (97%) rename taskstateedit/{hooks/addtaskstatetype.hook.php => src/Hooks/AddTaskStateType.php} (96%) rename taskstateedit/{hooks/addtaskstateeditmenuitem.hook.php => src/Hooks/AddTaskstateeditMenuItem.php} (98%) rename taskstateedit/{class/taskstateedit.class.php => src/Items/Taskstateedit.php} (92%) rename taskstateedit/{class/taskstateeditmanager.class.php => src/Managers/TaskstateeditManager.php} (95%) rename taskstateedit/{pages/taskstateeditmanagement.page.php => src/Pages/TaskstateeditManagement.php} (99%) rename taskstateedit/{reports/taskstateedit_report.report.php => src/Reports/Taskstateedit_Report.php} (97%) rename tasktypeedit/{hooks/addtasktypeeditjs.hook.php => src/Hooks/AddTaskTypeEditJS.php} (97%) rename tasktypeedit/{hooks/addtasktypetype.hook.php => src/Hooks/AddTaskTypeType.php} (96%) rename tasktypeedit/{hooks/addtasktypeeditmenuitem.hook.php => src/Hooks/AddTasktypeeditMenuItem.php} (98%) rename tasktypeedit/{class/tasktypeedit.class.php => src/Items/Tasktypeedit.php} (92%) rename tasktypeedit/{class/tasktypeeditmanager.class.php => src/Managers/TasktypeeditManager.php} (95%) rename tasktypeedit/{pages/tasktypeeditmanagement.page.php => src/Pages/TasktypeeditManagement.php} (99%) rename tasktypeedit/{reports/tasktypeedit_report.report.php => src/Reports/Tasktypeedit_Report.php} (97%) create mode 100644 tests/plugin-layout.test.php delete mode 100644 tests/plugins-are-namespaced.test.php create mode 100644 tests/references-resolve.test.php rename windowskey/{hooks/addwindowskeyimage.hook.php => src/Hooks/AddWindowsKeyImage.php} (99%) rename windowskey/{hooks/addwindowskeyjs.hook.php => src/Hooks/AddWindowsKeyJS.php} (97%) rename windowskey/{hooks/addwindowskeymenuitem.hook.php => src/Hooks/AddWindowsKeyMenuItem.php} (99%) rename windowskey/{hooks/addwindowskeyapi.hook.php => src/Hooks/AddWindowskeyAPI.php} (98%) rename windowskey/{hooks/changehostkey.hook.php => src/Hooks/ChangeHostKey.php} (98%) rename windowskey/{hooks/windowskeydeletemassitems.hook.php => src/Hooks/WindowsKeyDeleteMassItems.php} (98%) rename windowskey/{class/windowskey.class.php => src/Items/WindowsKey.php} (98%) rename windowskey/{class/windowskeyassociation.class.php => src/Items/WindowsKeyAssociation.php} (97%) rename windowskey/{class/windowskeyassociationmanager.class.php => src/Managers/WindowsKeyAssociationManager.php} (97%) rename windowskey/{class/windowskeymanager.class.php => src/Managers/WindowsKeyManager.php} (99%) rename windowskey/{pages/windowskeymanagement.page.php => src/Pages/WindowsKeyManagement.php} (99%) rename windowskey/{reports/windowskey_report.report.php => src/Reports/WindowsKey_Report.php} (97%) rename wolbroadcast/{hooks/addbroadcastaddresses.hook.php => src/Hooks/AddBroadcastAddresses.php} (97%) rename wolbroadcast/{hooks/addwolbroadcastapi.hook.php => src/Hooks/AddWOLBroadcastAPI.php} (97%) rename wolbroadcast/{hooks/addwolbroadcastjs.hook.php => src/Hooks/AddWOLBroadcastJS.php} (97%) rename wolbroadcast/{hooks/addwolbroadcastmenuitem.hook.php => src/Hooks/AddWOLBroadcastMenuItem.php} (98%) rename wolbroadcast/{hooks/addwolbroadcasttype.hook.php => src/Hooks/AddWOLBroadcastType.php} (96%) rename wolbroadcast/{class/wolbroadcast.class.php => src/Items/Wolbroadcast.php} (96%) rename wolbroadcast/{class/wolbroadcastmanager.class.php => src/Managers/WolbroadcastManager.php} (98%) rename wolbroadcast/{pages/wolbroadcastmanagement.page.php => src/Pages/WOLBroadcastManagement.php} (99%) rename wolbroadcast/{reports/wolbroadcast_report.report.php => src/Reports/Wolbroadcast_Report.php} (97%) diff --git a/README.md b/README.md index 7e2c203..4c1d865 100644 --- a/README.md +++ b/README.md @@ -41,18 +41,37 @@ Each directory is one plugin, laid out exactly as it appears under ``` / config/plugin.config.php the manifest - class/ model + manager (schema migrations live here) - pages/ the management page - hooks/ hook registrations - tasks/ scheduled background work (optional) + src/ ALL PHP, laid out exactly like core's src/ + Items/ models + Managers/ managers (schema migrations live here) + Pages/ the management page + Hooks/ hook registrations + Events/ event listeners (optional) + Reports/ reports (optional) + Tasks/ scheduled background work (optional) + Util/ plain helpers (optional) js/ fog...js ``` -A `tasks/.task.php` declares a class extending `PluginTask` with an +**`/src//.php` declares +`FOG\Plugins\\\`**, with the file name equal to the +class name and `strtolower()` equal to the plugin's directory name. +`tests/plugin-layout.test.php` gates both. The autoloader derives the path from +the class name, so a file in the wrong place does not load and a class in the +wrong bucket is never registered. See +[ADR 0035](https://github.com/FOGProject/fogproject/blob/working-1.6/docs/adr/0035-a-plugin-is-laid-out-like-core.md); +the pre-1.6 `class/ pages/ hooks/` layout is refused with a message naming the +plugin. + +`Pages`, `Hooks`, `Events`, `Reports` and `Tasks` are the buckets core +enumerates. Everything else is autoload-only, so the name is yours — these are +core's, and using them means someone who knows core knows your plugin. + +A `src/Tasks/.php` declares a class extending `PluginTask` with an `$interval` and a `run()`, and the `FOGPluginRunner` daemon runs it while the plugin is active and installed — a plugin never ships a systemd unit of its own. It runs as the web user rather than root, and `run()` has to be -idempotent. See `helloworld/tasks/helloworldheartbeat.task.php` for a worked +idempotent. See `helloworld/src/Tasks/HelloWorldHeartbeat.php` for a worked example and ADR 0010 in `FOGProject/fogproject` for why it is shaped this way. Requires FOG **1.6.0-beta.3350** or newer. The runner itself landed in @@ -72,10 +91,10 @@ the rest. | `ldap` | 1.6.0 | Authenticate FOG users against an LDAP or AD directory | | `location` | 1.6.0 | Serve images from the storage node nearest a host — multi-site installs | | `ntfy` | 1.6.0 | Notifications via ntfy.sh or a self-hosted ntfy server | +| `oidc` | 1.6.0 | Sign in through an OpenID Connect provider; the reference for a plugin that adds a route rather than a resource | | `ou` | 1.6.0 | Predefine Active Directory OUs and associate them with hosts | | `persistentgroups` | 1.6.0 | On joining a group, copy image, AD, printer and location settings from a template host named after that group | | `pushbullet` | 1.6.0 | Pushbullet notifications | -| `site` | 1.6.0 | Group hosts into sites; limit which hosts a user can see | | `slack` | 1.6.0 | Slack API integration | | `subnetgroup` | 1.6.0 | Assign hosts to groups automatically by IP subnet | | `taskstateedit` | 1.6.0 | Edit and create task states | @@ -83,12 +102,12 @@ the rest. | `windowskey` | 1.6.0 | Associate Windows product keys with images | | `wolbroadcast` | 1.6.0 | Wake-on-LAN across separate broadcast addresses | -`site` is a special case. Per +`site` used to be listed here and is not a plugin any more. Per [ADR 0006](https://github.com/FOGProject/fogproject/blob/working-1.6/docs/adr/0006-site-object-scope-boundary.md) the object-scope boundary is default-allow, so **with no listener the boundary -does not exist**. `site` is therefore always shipped and must not become -something an admin can uninstall or a half-failed upgrade can remove. It lives -here as source; it is not a candidate for the external plugin root. +does not exist** — which made a plugin an admin could uninstall, or a +half-failed upgrade could remove, the wrong home for it. Site moved into +`FOGProject/fogproject` proper; nothing here replaces it. ## Writing a plugin @@ -96,7 +115,8 @@ The full guide is [`docs/plugin-development.md`](https://github.com/FOGProject/fogproject/blob/working-1.6/docs/plugin-development.md) in the FOG repository — manifest fields, the `schema()` migration contract, hook events, the permission registry, and the gotchas that cost the most time. -`helloworld/` here is the working skeleton it describes. +`helloworld/` here is the working skeleton it describes, and §11b of that guide +is the port table for a plugin still on the pre-1.6 layout. Third-party plugins belong in your own repository. Ship a `.tar.gz` holding one directory named for the plugin with `config/plugin.config.php` inside it, diff --git a/bin/qualify-core-references.php b/bin/qualify-core-references.php index c92c061..51fa4d1 100644 --- a/bin/qualify-core-references.php +++ b/bin/qualify-core-references.php @@ -2,15 +2,21 @@ /** * Rewrites bare references to FOG core classes into fully qualified ones. * - * Plugins are global-namespace by design (ADR 0009) and have always named - * core classes bare -- `extends Hook`, `Route::listem()`, `new Image()`. - * Those resolve only because every file under fogproject's packages/web/src/ - * ends in a class_alias() re-exporting itself globally, and that alias set is - * being retired (fogproject docs/composer-psr4-plan.md, ADR 0013 §2). + * Plugins used to be global-namespace and named core classes bare -- + * `extends Hook`, `Route::listem()`, `new Image()`. Those resolved only + * because every file under fogproject's packages/web/src/ ended in a + * class_alias() re-exporting itself globally, and that alias set was retired + * (fogproject docs/composer-psr4-plan.md, ADR 0013 §2). * * This qualifies them: `extends \FOG\Base\Hook`, `\FOG\Router\Route::listem()`. - * The plugin stays in the global namespace -- only the names it reaches into - * core with change. + * It changes only the names a plugin reaches into CORE with; its own + * namespace declaration is not this tool's business. + * + * Written for that one-time sweep and kept as a check. Plugins have since + * taken namespaces of their own and then core's layout as well (ADR 0035), so + * a plugin file is src//.php declaring + * FOG\Plugins\\\ -- which this tool does not care + * about, since it walks by file extension and rewrites by token. * * The map is read from a fogproject checkout rather than hardcoded, because * the bucket a class lives in is fogproject's to decide and a stale copy here diff --git a/capone/hooks/addbootmenuitem.hook.php b/capone/src/Hooks/AddBootMenuItem.php similarity index 98% rename from capone/hooks/addbootmenuitem.hook.php rename to capone/src/Hooks/AddBootMenuItem.php index 0f15bb3..75c75e7 100644 --- a/capone/hooks/addbootmenuitem.hook.php +++ b/capone/src/Hooks/AddBootMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Hooks; /** * Creates the capone menu item. diff --git a/capone/hooks/addcaponeapi.hook.php b/capone/src/Hooks/AddCaponeAPI.php similarity index 99% rename from capone/hooks/addcaponeapi.hook.php rename to capone/src/Hooks/AddCaponeAPI.php index 55b76cc..8270fc3 100644 --- a/capone/hooks/addcaponeapi.hook.php +++ b/capone/src/Hooks/AddCaponeAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Hooks; /** * Injects capone stuff into the api system. diff --git a/capone/hooks/addcaponejs.hook.php b/capone/src/Hooks/AddCaponeJS.php similarity index 97% rename from capone/hooks/addcaponejs.hook.php rename to capone/src/Hooks/AddCaponeJS.php index eb9e104..4b66457 100644 --- a/capone/hooks/addcaponejs.hook.php +++ b/capone/src/Hooks/AddCaponeJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/capone/hooks/addcaponemenuitem.hook.php b/capone/src/Hooks/AddCaponeMenuItem.php similarity index 98% rename from capone/hooks/addcaponemenuitem.hook.php rename to capone/src/Hooks/AddCaponeMenuItem.php index ce71095..49b8ecc 100644 --- a/capone/hooks/addcaponemenuitem.hook.php +++ b/capone/src/Hooks/AddCaponeMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Hooks; /** * Adds the capone menu item. diff --git a/capone/class/capone.class.php b/capone/src/Items/Capone.php similarity index 98% rename from capone/class/capone.class.php rename to capone/src/Items/Capone.php index d036c40..d4bf9ef 100644 --- a/capone/class/capone.class.php +++ b/capone/src/Items/Capone.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Items; /** * Handles the database for Capone plugin diff --git a/capone/class/caponemanager.class.php b/capone/src/Managers/CaponeManager.php similarity index 99% rename from capone/class/caponemanager.class.php rename to capone/src/Managers/CaponeManager.php index 5de2434..43837fb 100644 --- a/capone/class/caponemanager.class.php +++ b/capone/src/Managers/CaponeManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Managers; /** * Manager class for Capone diff --git a/capone/pages/caponemanagement.page.php b/capone/src/Pages/CaponeManagement.php similarity index 99% rename from capone/pages/caponemanagement.page.php rename to capone/src/Pages/CaponeManagement.php index 1a1b3b3..79aad10 100644 --- a/capone/pages/caponemanagement.page.php +++ b/capone/src/Pages/CaponeManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Pages; /** * The capone page. diff --git a/capone/reg-task/caponetasking.class.php b/capone/src/Util/CaponeTasking.php similarity index 99% rename from capone/reg-task/caponetasking.class.php rename to capone/src/Util/CaponeTasking.php index a58c952..9e298bd 100644 --- a/capone/reg-task/caponetasking.class.php +++ b/capone/src/Util/CaponeTasking.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Capone; +namespace FOG\Plugins\Capone\Util; /** * This is only used for capone plugin. diff --git a/helloworld/hooks/addhelloworldapi.hook.php b/helloworld/src/Hooks/AddHelloWorldAPI.php similarity index 97% rename from helloworld/hooks/addhelloworldapi.hook.php rename to helloworld/src/Hooks/AddHelloWorldAPI.php index 913c4c6..5aeadb1 100644 --- a/helloworld/hooks/addhelloworldapi.hook.php +++ b/helloworld/src/Hooks/AddHelloWorldAPI.php @@ -15,7 +15,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Hooks; /** * Injects Hello World into the API system. diff --git a/helloworld/hooks/addhelloworldjs.hook.php b/helloworld/src/Hooks/AddHelloWorldJS.php similarity index 98% rename from helloworld/hooks/addhelloworldjs.hook.php rename to helloworld/src/Hooks/AddHelloWorldJS.php index 315e74d..5302734 100644 --- a/helloworld/hooks/addhelloworldjs.hook.php +++ b/helloworld/src/Hooks/AddHelloWorldJS.php @@ -15,7 +15,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Hooks; /** * Injects the Hello World JS files. diff --git a/helloworld/hooks/addhelloworldmenuitem.hook.php b/helloworld/src/Hooks/AddHelloWorldMenuItem.php similarity index 90% rename from helloworld/hooks/addhelloworldmenuitem.hook.php rename to helloworld/src/Hooks/AddHelloWorldMenuItem.php index b0b26a8..8049e2e 100644 --- a/helloworld/hooks/addhelloworldmenuitem.hook.php +++ b/helloworld/src/Hooks/AddHelloWorldMenuItem.php @@ -4,8 +4,10 @@ * * Hooks register callbacks against named events in their constructor, but * ONLY after confirming the plugin is installed (the $pluginsinstalled - * guard). Class AddHelloWorldMenuItem must live in the file - * addhelloworldmenuitem.hook.php (lowercased class name + .hook.php). + * guard). Class AddHelloWorldMenuItem must live in src/Hooks/ under its own + * exact name -- src/Hooks/ is the directory core LISTS to find hooks to + * construct, so a hook filed anywhere else registers nothing and says + * nothing (fogproject ADR 0035). * * PHP version 5 * @@ -16,7 +18,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Hooks; /** * Adds the Hello World menu item. diff --git a/helloworld/class/helloworld.class.php b/helloworld/src/Items/HelloWorld.php similarity index 66% rename from helloworld/class/helloworld.class.php rename to helloworld/src/Items/HelloWorld.php index bc98eb3..ec5cb09 100644 --- a/helloworld/class/helloworld.class.php +++ b/helloworld/src/Items/HelloWorld.php @@ -9,10 +9,18 @@ * * NOTE: FOG's own autoloader, Initiator::autoload(), resolves the class -- * there is no spl_autoload fallback (fogproject ADR 0013 §2b removed it, since - * it let a plugin shadow a core class by filename). The filename still has to - * match the class name (case-insensitively), because that match is how - * Initiator finds the file. So class HelloWorld must live in the file - * helloworld.class.php, and declares namespace FOG\Plugins\Helloworld. + * it let a plugin shadow a core class by filename). It DERIVES the file from + * the class name, so path and name are the same fact written twice: + * FOG\Plugins\HelloWorld\Items\HelloWorld is + * helloworld/src/Items/HelloWorld.php and nothing else. Rename one, rename + * both. The plugin directory stays lowercase -- it is also the routing node + * and the permission string -- while the namespace segment carries the + * casing, and lowercasing the segment must land back on the directory name + * (fogproject ADR 0035). + * + * Items/ is not enumerated by anything: a model is loaded when something + * names it. Pages/, Hooks/, Events/, Reports/ and Tasks/ ARE enumerated, so + * a class in the wrong one of those is loadable and never registered. * * PHP version 5 * @@ -23,7 +31,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Items; /** * Hello World example plugin (model). diff --git a/helloworld/class/helloworldmanager.class.php b/helloworld/src/Managers/HelloWorldManager.php similarity index 98% rename from helloworld/class/helloworldmanager.class.php rename to helloworld/src/Managers/HelloWorldManager.php index aec9ff1..7a017e3 100644 --- a/helloworld/class/helloworldmanager.class.php +++ b/helloworld/src/Managers/HelloWorldManager.php @@ -20,7 +20,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Managers; /** * Hello World example plugin (manager). diff --git a/helloworld/pages/helloworldmanagement.page.php b/helloworld/src/Pages/HelloWorldManagement.php similarity index 99% rename from helloworld/pages/helloworldmanagement.page.php rename to helloworld/src/Pages/HelloWorldManagement.php index f27c6cc..38de70a 100644 --- a/helloworld/pages/helloworldmanagement.page.php +++ b/helloworld/src/Pages/HelloWorldManagement.php @@ -22,7 +22,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Pages; /** * Hello World example plugin (management page). diff --git a/helloworld/tasks/helloworldheartbeat.task.php b/helloworld/src/Tasks/HelloWorldHeartbeat.php similarity index 84% rename from helloworld/tasks/helloworldheartbeat.task.php rename to helloworld/src/Tasks/HelloWorldHeartbeat.php index d4d2bba..f1fbfbe 100644 --- a/helloworld/tasks/helloworldheartbeat.task.php +++ b/helloworld/src/Tasks/HelloWorldHeartbeat.php @@ -21,10 +21,16 @@ * runner keeps next-run times in memory, so a service restart makes every * task immediately due, and a run that throws is retried next cycle. * - * NAMING, and this one bites: the class name must match the filename minus - * .task.php, and it shares ONE global namespace with every other class in - * FOG -- core models included. A file named host.task.php would collide with - * the core Host model. Prefix with your plugin's name, as here. + * NAMING: the file is src/Tasks/.php and the class is + * FOG\Plugins\HelloWorld\Tasks\ -- the path IS the name (fogproject + * ADR 0035), and src/Tasks/ is the directory the runner lists to find work to + * do. A task filed elsewhere is loadable and never runs. + * + * Your namespace is your own, so a class called Host here would not collide + * with the core Host model. What is still shared is the SHORT name, which is + * what getClass('X') and FOGController::getManager() resolve, and core wins + * that: a plugin class whose short name matches a core class is reachable + * only by its FQCN. Prefixing with the plugin's name, as here, sidesteps it. * * PHP version 5 * @@ -35,7 +41,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Helloworld; +namespace FOG\Plugins\HelloWorld\Tasks; /** * Counts this plugin's rows on a schedule and writes the number to the log. diff --git a/ldap/hooks/addldapapi.hook.php b/ldap/src/Hooks/AddLDAPAPI.php similarity index 98% rename from ldap/hooks/addldapapi.hook.php rename to ldap/src/Hooks/AddLDAPAPI.php index 3d191ac..a53cd9d 100644 --- a/ldap/hooks/addldapapi.hook.php +++ b/ldap/src/Hooks/AddLDAPAPI.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; + +use FOG\Plugins\LDAP\Items\LDAPGroup; /** * Injects LDAP stuff into the api system. diff --git a/ldap/hooks/addldapgrouptabs.hook.php b/ldap/src/Hooks/AddLDAPGroupTabs.php similarity index 99% rename from ldap/hooks/addldapgrouptabs.hook.php rename to ldap/src/Hooks/AddLDAPGroupTabs.php index 74ea486..28b92d8 100644 --- a/ldap/hooks/addldapgrouptabs.hook.php +++ b/ldap/src/Hooks/AddLDAPGroupTabs.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; /** * Associates directory groups from the role and user group pages. diff --git a/ldap/hooks/addldapjs.hook.php b/ldap/src/Hooks/AddLDAPJS.php similarity index 98% rename from ldap/hooks/addldapjs.hook.php rename to ldap/src/Hooks/AddLDAPJS.php index f522aaa..db6860f 100644 --- a/ldap/hooks/addldapjs.hook.php +++ b/ldap/src/Hooks/AddLDAPJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/ldap/hooks/addldapmenuitem.hook.php b/ldap/src/Hooks/AddLDAPMenuItem.php similarity index 99% rename from ldap/hooks/addldapmenuitem.hook.php rename to ldap/src/Hooks/AddLDAPMenuItem.php index 59005b9..d491114 100644 --- a/ldap/hooks/addldapmenuitem.hook.php +++ b/ldap/src/Hooks/AddLDAPMenuItem.php @@ -13,7 +13,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; /** * Adds the menu item for this plugin diff --git a/ldap/hooks/addldaptype.hook.php b/ldap/src/Hooks/AddLDAPType.php similarity index 97% rename from ldap/hooks/addldaptype.hook.php rename to ldap/src/Hooks/AddLDAPType.php index 2235eb7..a6c9f8d 100644 --- a/ldap/hooks/addldaptype.hook.php +++ b/ldap/src/Hooks/AddLDAPType.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; /** * Adds the ldap type to the reports/exports items diff --git a/ldap/hooks/ldapdeletemassitems.hook.php b/ldap/src/Hooks/LDAPDeleteMassItems.php similarity index 98% rename from ldap/hooks/ldapdeletemassitems.hook.php rename to ldap/src/Hooks/LDAPDeleteMassItems.php index 1c952ba..ea364ee 100644 --- a/ldap/hooks/ldapdeletemassitems.hook.php +++ b/ldap/src/Hooks/LDAPDeleteMassItems.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; + +use FOG\Plugins\LDAP\Items\LDAPUserGrant; /** * Deletes the LDAP plugin elements en-mass. diff --git a/ldap/hooks/ldappluginhook.hook.php b/ldap/src/Hooks/LDAPPluginHook.php similarity index 99% rename from ldap/hooks/ldappluginhook.hook.php rename to ldap/src/Hooks/LDAPPluginHook.php index e99dc8b..578d4a1 100644 --- a/ldap/hooks/ldappluginhook.hook.php +++ b/ldap/src/Hooks/LDAPPluginHook.php @@ -13,7 +13,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Hooks; + +use FOG\Plugins\LDAP\Items\LDAPUserGrant; /** * LDAPPluginHook enables our checks as required diff --git a/ldap/class/ldap.class.php b/ldap/src/Items/LDAP.php similarity index 99% rename from ldap/class/ldap.class.php rename to ldap/src/Items/LDAP.php index 3d63835..9874efd 100644 --- a/ldap/class/ldap.class.php +++ b/ldap/src/Items/LDAP.php @@ -13,7 +13,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Items; /** * LDAP Authentication plugin diff --git a/ldap/class/ldapgroup.class.php b/ldap/src/Items/LDAPGroup.php similarity index 99% rename from ldap/class/ldapgroup.class.php rename to ldap/src/Items/LDAPGroup.php index 89d20ff..23655f8 100644 --- a/ldap/class/ldapgroup.class.php +++ b/ldap/src/Items/LDAPGroup.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Items; /** * A directory group this server is willing to recognise. diff --git a/ldap/class/ldapgrouproleassociation.class.php b/ldap/src/Items/LDAPGroupRoleAssociation.php similarity index 97% rename from ldap/class/ldapgrouproleassociation.class.php rename to ldap/src/Items/LDAPGroupRoleAssociation.php index 02c088b..2cadc69 100644 --- a/ldap/class/ldapgrouproleassociation.class.php +++ b/ldap/src/Items/LDAPGroupRoleAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Items; /** * Association between a directory group and a FOG role. diff --git a/ldap/class/ldapgroupusergroupassociation.class.php b/ldap/src/Items/LDAPGroupUserGroupAssociation.php similarity index 97% rename from ldap/class/ldapgroupusergroupassociation.class.php rename to ldap/src/Items/LDAPGroupUserGroupAssociation.php index dab49e3..59b27ed 100644 --- a/ldap/class/ldapgroupusergroupassociation.class.php +++ b/ldap/src/Items/LDAPGroupUserGroupAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Items; /** * Association between a directory group and a FOG user group. diff --git a/ldap/class/ldapusergrant.class.php b/ldap/src/Items/LDAPUserGrant.php similarity index 98% rename from ldap/class/ldapusergrant.class.php rename to ldap/src/Items/LDAPUserGrant.php index fe83803..29f22ba 100644 --- a/ldap/class/ldapusergrant.class.php +++ b/ldap/src/Items/LDAPUserGrant.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Items; /** * A record of one role or user group this plugin granted to one user. diff --git a/ldap/class/ldapgroupmanager.class.php b/ldap/src/Managers/LDAPGroupManager.php similarity index 98% rename from ldap/class/ldapgroupmanager.class.php rename to ldap/src/Managers/LDAPGroupManager.php index 7971b4c..c471702 100644 --- a/ldap/class/ldapgroupmanager.class.php +++ b/ldap/src/Managers/LDAPGroupManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Managers; /** * Manager for the LDAPGroups table. diff --git a/ldap/class/ldapgrouproleassociationmanager.class.php b/ldap/src/Managers/LDAPGroupRoleAssociationManager.php similarity index 98% rename from ldap/class/ldapgrouproleassociationmanager.class.php rename to ldap/src/Managers/LDAPGroupRoleAssociationManager.php index f0604be..fc080e2 100644 --- a/ldap/class/ldapgrouproleassociationmanager.class.php +++ b/ldap/src/Managers/LDAPGroupRoleAssociationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Managers; /** * Manager for the ldapGroupRoleAssoc table. diff --git a/ldap/class/ldapgroupusergroupassociationmanager.class.php b/ldap/src/Managers/LDAPGroupUserGroupAssociationManager.php similarity index 98% rename from ldap/class/ldapgroupusergroupassociationmanager.class.php rename to ldap/src/Managers/LDAPGroupUserGroupAssociationManager.php index 503f732..7565cfa 100644 --- a/ldap/class/ldapgroupusergroupassociationmanager.class.php +++ b/ldap/src/Managers/LDAPGroupUserGroupAssociationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Managers; /** * Manager for the ldapGroupUserGroupAssoc table. diff --git a/ldap/class/ldapmanager.class.php b/ldap/src/Managers/LDAPManager.php similarity index 99% rename from ldap/class/ldapmanager.class.php rename to ldap/src/Managers/LDAPManager.php index 6601825..da3aa39 100644 --- a/ldap/class/ldapmanager.class.php +++ b/ldap/src/Managers/LDAPManager.php @@ -13,7 +13,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Managers; + +use FOG\Plugins\LDAP\Hooks\LDAPPluginHook; /** * LDAPManager diff --git a/ldap/class/ldapusergrantmanager.class.php b/ldap/src/Managers/LDAPUserGrantManager.php similarity index 98% rename from ldap/class/ldapusergrantmanager.class.php rename to ldap/src/Managers/LDAPUserGrantManager.php index 0346972..e22ead3 100644 --- a/ldap/class/ldapusergrantmanager.class.php +++ b/ldap/src/Managers/LDAPUserGrantManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Managers; /** * Manager for the ldapUserGrant table. diff --git a/ldap/pages/ldapgroupmanagement.page.php b/ldap/src/Pages/LDAPGroupManagement.php similarity index 99% rename from ldap/pages/ldapgroupmanagement.page.php rename to ldap/src/Pages/LDAPGroupManagement.php index 585b74b..d6e0ef2 100644 --- a/ldap/pages/ldapgroupmanagement.page.php +++ b/ldap/src/Pages/LDAPGroupManagement.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Pages; + +use FOG\Plugins\LDAP\Items\LDAPGroup; /** * The LDAP group management page diff --git a/ldap/pages/ldapmanagement.page.php b/ldap/src/Pages/LDAPManagement.php similarity index 99% rename from ldap/pages/ldapmanagement.page.php rename to ldap/src/Pages/LDAPManagement.php index d82c53f..693a637 100644 --- a/ldap/pages/ldapmanagement.page.php +++ b/ldap/src/Pages/LDAPManagement.php @@ -13,7 +13,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Pages; + +use FOG\Plugins\LDAP\Items\LDAP; /** * The ldap management page diff --git a/ldap/reports/ldap_report.report.php b/ldap/src/Reports/LDAP_Report.php similarity index 98% rename from ldap/reports/ldap_report.report.php rename to ldap/src/Reports/LDAP_Report.php index 66ab33a..070955f 100644 --- a/ldap/reports/ldap_report.report.php +++ b/ldap/src/Reports/LDAP_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ldap; +namespace FOG\Plugins\LDAP\Reports; /** * LDAP report. diff --git a/location/hooks/addlocationapi.hook.php b/location/src/Hooks/AddLocationAPI.php similarity index 99% rename from location/hooks/addlocationapi.hook.php rename to location/src/Hooks/AddLocationAPI.php index e89807f..3c4f56e 100644 --- a/location/hooks/addlocationapi.hook.php +++ b/location/src/Hooks/AddLocationAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Injects location stuff into the api system. diff --git a/location/hooks/addlocationgroup.hook.php b/location/src/Hooks/AddLocationGroup.php similarity index 99% rename from location/hooks/addlocationgroup.hook.php rename to location/src/Hooks/AddLocationGroup.php index e9bfca6..62c9e82 100644 --- a/location/hooks/addlocationgroup.hook.php +++ b/location/src/Hooks/AddLocationGroup.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds the location choice to groups. diff --git a/location/hooks/addlocationhost.hook.php b/location/src/Hooks/AddLocationHost.php similarity index 99% rename from location/hooks/addlocationhost.hook.php rename to location/src/Hooks/AddLocationHost.php index 78b34c0..bda2fa8 100644 --- a/location/hooks/addlocationhost.hook.php +++ b/location/src/Hooks/AddLocationHost.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds the location choice to host. diff --git a/location/hooks/addlocationimport.hook.php b/location/src/Hooks/AddLocationImport.php similarity index 99% rename from location/hooks/addlocationimport.hook.php rename to location/src/Hooks/AddLocationImport.php index 081fdf8..c71eae1 100644 --- a/location/hooks/addlocationimport.hook.php +++ b/location/src/Hooks/AddLocationImport.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds location support to the CSV import/export associations column. diff --git a/location/hooks/addlocationjs.hook.php b/location/src/Hooks/AddLocationJS.php similarity index 97% rename from location/hooks/addlocationjs.hook.php rename to location/src/Hooks/AddLocationJS.php index 5f38cd5..5be3800 100644 --- a/location/hooks/addlocationjs.hook.php +++ b/location/src/Hooks/AddLocationJS.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/location/hooks/addlocationmenuitem.hook.php b/location/src/Hooks/AddLocationMenuItem.php similarity index 99% rename from location/hooks/addlocationmenuitem.hook.php rename to location/src/Hooks/AddLocationMenuItem.php index 71e808e..76b7f49 100644 --- a/location/hooks/addlocationmenuitem.hook.php +++ b/location/src/Hooks/AddLocationMenuItem.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds the location menu item. diff --git a/location/hooks/addlocationtype.hook.php b/location/src/Hooks/AddLocationType.php similarity index 97% rename from location/hooks/addlocationtype.hook.php rename to location/src/Hooks/AddLocationType.php index 248a73b..c0a3a6e 100644 --- a/location/hooks/addlocationtype.hook.php +++ b/location/src/Hooks/AddLocationType.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds the location report type. diff --git a/location/hooks/addserviceconfiguration.hook.php b/location/src/Hooks/AddServiceConfiguration.php similarity index 98% rename from location/hooks/addserviceconfiguration.hook.php rename to location/src/Hooks/AddServiceConfiguration.php index 8be067f..041c9fa 100644 --- a/location/hooks/addserviceconfiguration.hook.php +++ b/location/src/Hooks/AddServiceConfiguration.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Adds service configuration with locations. diff --git a/location/hooks/locationchangeitems.hook.php b/location/src/Hooks/LocationChangeItems.php similarity index 91% rename from location/hooks/locationchangeitems.hook.php rename to location/src/Hooks/LocationChangeItems.php index 2f33e06..950749b 100644 --- a/location/hooks/locationchangeitems.hook.php +++ b/location/src/Hooks/LocationChangeItems.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Changes the elements we need. @@ -25,15 +25,21 @@ * @link https://fogproject.org */ /** - * Named for its plugin, like every other hook here, because the class name is - * derived from the filename: startClassFromFiles() strips .hook.php and skips - * any name already declared. This and the OU plugin's hook were both - * changeitems.hook.php, so whichever the autoloader's file walk reached first - * -- readdir order -- was the only one that ever loaded, and the other - * plugin's registrations silently never happened. It did not even need both - * plugins installed: registerInstalled() bails when $node is not an installed - * plugin, so an uninstalled location plugin winning the walk left the OU - * plugin's AD hook unregistered with nothing to show for it. + * Named for its plugin, like every other hook here. That used to be + * load-bearing: the class name was derived from the filename, and + * startClassFromFiles() skipped any name already declared. This and the OU + * plugin's hook were both changeitems.hook.php, so whichever the autoloader's + * file walk reached first -- readdir order -- was the only one that ever + * loaded, and the other plugin's registrations silently never happened. It + * did not even need both plugins installed: registerInstalled() bails when + * $node is not an installed plugin, so an uninstalled location plugin winning + * the walk left the OU plugin's AD hook unregistered with nothing to show for + * it. + * + * Two same-named hooks could no longer collide -- each plugin has its own + * namespace, so each derives its own path (fogproject ADR 0035) -- but the + * distinct names stay. They are what the log and the hook list show, and + * "ChangeItems" twice would be unreadable whether or not it still broke. */ class LocationChangeItems extends \FOG\Base\Hook { diff --git a/location/hooks/locationdeletemassitems.hook.php b/location/src/Hooks/LocationDeleteMassItems.php similarity index 98% rename from location/hooks/locationdeletemassitems.hook.php rename to location/src/Hooks/LocationDeleteMassItems.php index 0d227cd..9c91c5e 100644 --- a/location/hooks/locationdeletemassitems.hook.php +++ b/location/src/Hooks/LocationDeleteMassItems.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Hooks; /** * Deletes the Location the elements en-mass. diff --git a/location/class/location.class.php b/location/src/Items/Location.php similarity index 99% rename from location/class/location.class.php rename to location/src/Items/Location.php index fe4577e..4376108 100644 --- a/location/class/location.class.php +++ b/location/src/Items/Location.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Items; /** * The location class. diff --git a/location/class/locationassociation.class.php b/location/src/Items/LocationAssociation.php similarity index 98% rename from location/class/locationassociation.class.php rename to location/src/Items/LocationAssociation.php index 02d706c..5129503 100644 --- a/location/class/locationassociation.class.php +++ b/location/src/Items/LocationAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Items; /** * The association between hosts and locations. diff --git a/location/class/locationassociationmanager.class.php b/location/src/Managers/LocationAssociationManager.php similarity index 97% rename from location/class/locationassociationmanager.class.php rename to location/src/Managers/LocationAssociationManager.php index a2d16d4..242c492 100644 --- a/location/class/locationassociationmanager.class.php +++ b/location/src/Managers/LocationAssociationManager.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Managers; /** * Location association manager class. diff --git a/location/class/locationmanager.class.php b/location/src/Managers/LocationManager.php similarity index 99% rename from location/class/locationmanager.class.php rename to location/src/Managers/LocationManager.php index 1e6089e..39aa62d 100644 --- a/location/class/locationmanager.class.php +++ b/location/src/Managers/LocationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Managers; /** * Location manager mass management class diff --git a/location/pages/locationmanagement.page.php b/location/src/Pages/LocationManagement.php similarity index 99% rename from location/pages/locationmanagement.page.php rename to location/src/Pages/LocationManagement.php index df70dce..f65212b 100644 --- a/location/pages/locationmanagement.page.php +++ b/location/src/Pages/LocationManagement.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Pages; /** * Location management page. diff --git a/location/reports/location_report.report.php b/location/src/Reports/Location_Report.php similarity index 98% rename from location/reports/location_report.report.php rename to location/src/Reports/Location_Report.php index ad997fd..ae2dbe7 100644 --- a/location/reports/location_report.report.php +++ b/location/src/Reports/Location_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Location; +namespace FOG\Plugins\Location\Reports; /** * Location report. diff --git a/ntfy/events/imagecomplete_ntfy.event.php b/ntfy/src/Events/ImageComplete_Ntfy.php similarity index 97% rename from ntfy/events/imagecomplete_ntfy.event.php rename to ntfy/src/Events/ImageComplete_Ntfy.php index 45dabdc..9ff0ee2 100644 --- a/ntfy/events/imagecomplete_ntfy.event.php +++ b/ntfy/src/Events/ImageComplete_Ntfy.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Events; + +use FOG\Plugins\Ntfy\Util\NtfyExtends; /** * Pushes notification on image completion. diff --git a/ntfy/events/imagefail_ntfy.event.php b/ntfy/src/Events/ImageFail_Ntfy.php similarity index 96% rename from ntfy/events/imagefail_ntfy.event.php rename to ntfy/src/Events/ImageFail_Ntfy.php index 6091a8c..96fef81 100644 --- a/ntfy/events/imagefail_ntfy.event.php +++ b/ntfy/src/Events/ImageFail_Ntfy.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Events; + +use FOG\Plugins\Ntfy\Util\NtfyExtends; /** * Pushes notification on imaging failure. diff --git a/ntfy/events/loginfailure_ntfy.event.php b/ntfy/src/Events/LoginFailure_Ntfy.php similarity index 95% rename from ntfy/events/loginfailure_ntfy.event.php rename to ntfy/src/Events/LoginFailure_Ntfy.php index 5a79266..2087fb8 100644 --- a/ntfy/events/loginfailure_ntfy.event.php +++ b/ntfy/src/Events/LoginFailure_Ntfy.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Events; + +use FOG\Plugins\Ntfy\Util\NtfyExtends; /** * Pushes notification on login failure. diff --git a/ntfy/events/snapincomplete_ntfy.event.php b/ntfy/src/Events/SnapinComplete_Ntfy.php similarity index 95% rename from ntfy/events/snapincomplete_ntfy.event.php rename to ntfy/src/Events/SnapinComplete_Ntfy.php index 577ae46..6e324d0 100644 --- a/ntfy/events/snapincomplete_ntfy.event.php +++ b/ntfy/src/Events/SnapinComplete_Ntfy.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Events; + +use FOG\Plugins\Ntfy\Util\NtfyExtends; /** * Pushes notification on snapin completion. diff --git a/ntfy/events/snapintaskcomplete_ntfy.event.php b/ntfy/src/Events/SnapinTaskComplete_Ntfy.php similarity index 96% rename from ntfy/events/snapintaskcomplete_ntfy.event.php rename to ntfy/src/Events/SnapinTaskComplete_Ntfy.php index 3053772..c07cc0f 100644 --- a/ntfy/events/snapintaskcomplete_ntfy.event.php +++ b/ntfy/src/Events/SnapinTaskComplete_Ntfy.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Events; + +use FOG\Plugins\Ntfy\Util\NtfyExtends; /** * Pushes notification on snapin task completion. diff --git a/ntfy/hooks/addntfyapi.hook.php b/ntfy/src/Hooks/AddNtfyAPI.php similarity index 97% rename from ntfy/hooks/addntfyapi.hook.php rename to ntfy/src/Hooks/AddNtfyAPI.php index 92e96fc..2090185 100644 --- a/ntfy/hooks/addntfyapi.hook.php +++ b/ntfy/src/Hooks/AddNtfyAPI.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Hooks; /** * Injects ntfy stuff into the api system. diff --git a/ntfy/hooks/addntfyjs.hook.php b/ntfy/src/Hooks/AddNtfyJS.php similarity index 97% rename from ntfy/hooks/addntfyjs.hook.php rename to ntfy/src/Hooks/AddNtfyJS.php index 2ad4dbc..0072a59 100644 --- a/ntfy/hooks/addntfyjs.hook.php +++ b/ntfy/src/Hooks/AddNtfyJS.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/ntfy/hooks/addntfymenuitem.hook.php b/ntfy/src/Hooks/AddNtfyMenuItem.php similarity index 98% rename from ntfy/hooks/addntfymenuitem.hook.php rename to ntfy/src/Hooks/AddNtfyMenuItem.php index 2ebada3..3376634 100644 --- a/ntfy/hooks/addntfymenuitem.hook.php +++ b/ntfy/src/Hooks/AddNtfyMenuItem.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Hooks; /** * Adds the ntfy menu item to the menu. diff --git a/ntfy/class/ntfy.class.php b/ntfy/src/Items/Ntfy.php similarity index 97% rename from ntfy/class/ntfy.class.php rename to ntfy/src/Items/Ntfy.php index 13b17ff..03cd505 100644 --- a/ntfy/class/ntfy.class.php +++ b/ntfy/src/Items/Ntfy.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Items; /** * The ntfy database and object definer diff --git a/ntfy/class/ntfymanager.class.php b/ntfy/src/Managers/NtfyManager.php similarity index 98% rename from ntfy/class/ntfymanager.class.php rename to ntfy/src/Managers/NtfyManager.php index ac13e03..8e7d555 100644 --- a/ntfy/class/ntfymanager.class.php +++ b/ntfy/src/Managers/NtfyManager.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Managers; /** * Manager class for ntfy diff --git a/ntfy/pages/ntfymanagement.page.php b/ntfy/src/Pages/NtfyManagement.php similarity index 99% rename from ntfy/pages/ntfymanagement.page.php rename to ntfy/src/Pages/NtfyManagement.php index 742f0a3..3adeb30 100644 --- a/ntfy/pages/ntfymanagement.page.php +++ b/ntfy/src/Pages/NtfyManagement.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Pages; /** * Page presenter for ntfy plugin diff --git a/ntfy/class/ntfyexception.class.php b/ntfy/src/Util/NtfyException.php similarity index 95% rename from ntfy/class/ntfyexception.class.php rename to ntfy/src/Util/NtfyException.php index 4f79f5a..4f0f1d5 100644 --- a/ntfy/class/ntfyexception.class.php +++ b/ntfy/src/Util/NtfyException.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Util; /** * Exception class for ntfy diff --git a/ntfy/class/ntfyextends.class.php b/ntfy/src/Util/NtfyExtends.php similarity index 99% rename from ntfy/class/ntfyextends.class.php rename to ntfy/src/Util/NtfyExtends.php index 6edf64a..139ed4a 100644 --- a/ntfy/class/ntfyextends.class.php +++ b/ntfy/src/Util/NtfyExtends.php @@ -14,7 +14,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Util; /** * The base class of ntfy elements diff --git a/ntfy/class/ntfyhandler.class.php b/ntfy/src/Util/NtfyHandler.php similarity index 98% rename from ntfy/class/ntfyhandler.class.php rename to ntfy/src/Util/NtfyHandler.php index fda6d57..7b73d6e 100644 --- a/ntfy/class/ntfyhandler.class.php +++ b/ntfy/src/Util/NtfyHandler.php @@ -12,7 +12,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ntfy; +namespace FOG\Plugins\Ntfy\Util; + +use FOG\Plugins\Ntfy\Items\Ntfy; /** * Ntfy handler diff --git a/oidc/hooks/addoidcapi.hook.php b/oidc/src/Hooks/AddOIDCAPI.php similarity index 98% rename from oidc/hooks/addoidcapi.hook.php rename to oidc/src/Hooks/AddOIDCAPI.php index a837e1f..4b2cc43 100644 --- a/oidc/hooks/addoidcapi.hook.php +++ b/oidc/src/Hooks/AddOIDCAPI.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; + +use FOG\Plugins\OIDC\Items\OIDCGroup; /** * Adds this plugin's class to the API and declares its secret. diff --git a/oidc/hooks/addoidcgrouptabs.hook.php b/oidc/src/Hooks/AddOIDCGroupTabs.php similarity index 99% rename from oidc/hooks/addoidcgrouptabs.hook.php rename to oidc/src/Hooks/AddOIDCGroupTabs.php index c9fe6f2..c978af3 100644 --- a/oidc/hooks/addoidcgrouptabs.hook.php +++ b/oidc/src/Hooks/AddOIDCGroupTabs.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; /** * Associates provider groups from the role and user group pages. diff --git a/oidc/hooks/addoidcjs.hook.php b/oidc/src/Hooks/AddOIDCJS.php similarity index 98% rename from oidc/hooks/addoidcjs.hook.php rename to oidc/src/Hooks/AddOIDCJS.php index 3cd56d3..25757d8 100644 --- a/oidc/hooks/addoidcjs.hook.php +++ b/oidc/src/Hooks/AddOIDCJS.php @@ -15,7 +15,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; /** * Injects the OpenID Connect JS files. diff --git a/oidc/hooks/addoidcmenuitem.hook.php b/oidc/src/Hooks/AddOIDCMenuItem.php similarity index 99% rename from oidc/hooks/addoidcmenuitem.hook.php rename to oidc/src/Hooks/AddOIDCMenuItem.php index 4dc883d..4251222 100644 --- a/oidc/hooks/addoidcmenuitem.hook.php +++ b/oidc/src/Hooks/AddOIDCMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; /** * Adds the menu item and permission node for this plugin. diff --git a/oidc/hooks/addoidcroutes.hook.php b/oidc/src/Hooks/AddOIDCRoutes.php similarity index 98% rename from oidc/hooks/addoidcroutes.hook.php rename to oidc/src/Hooks/AddOIDCRoutes.php index b6ebc6c..7af1a5f 100644 --- a/oidc/hooks/addoidcroutes.hook.php +++ b/oidc/src/Hooks/AddOIDCRoutes.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; + +use FOG\Plugins\OIDC\Items\OIDC; /** * Registers this plugin's routes and its login-page button. diff --git a/oidc/hooks/oidcdeletemassitems.hook.php b/oidc/src/Hooks/OIDCDeleteMassItems.php similarity index 98% rename from oidc/hooks/oidcdeletemassitems.hook.php rename to oidc/src/Hooks/OIDCDeleteMassItems.php index ad544c6..3462890 100644 --- a/oidc/hooks/oidcdeletemassitems.hook.php +++ b/oidc/src/Hooks/OIDCDeleteMassItems.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; + +use FOG\Plugins\OIDC\Items\OIDCUserGrant; /** * Clears identity links when what they point at is deleted. diff --git a/oidc/hooks/oidcloginredirect.hook.php b/oidc/src/Hooks/OIDCLoginRedirect.php similarity index 97% rename from oidc/hooks/oidcloginredirect.hook.php rename to oidc/src/Hooks/OIDCLoginRedirect.php index bc17978..2e72f84 100644 --- a/oidc/hooks/oidcloginredirect.hook.php +++ b/oidc/src/Hooks/OIDCLoginRedirect.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; + +use FOG\Plugins\OIDC\Util\OIDCFlow; /** * Sends the login page straight to the identity provider. diff --git a/oidc/hooks/oidclogout.hook.php b/oidc/src/Hooks/OIDCLogout.php similarity index 97% rename from oidc/hooks/oidclogout.hook.php rename to oidc/src/Hooks/OIDCLogout.php index d7c01a0..c2f871a 100644 --- a/oidc/hooks/oidclogout.hook.php +++ b/oidc/src/Hooks/OIDCLogout.php @@ -11,7 +11,10 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Hooks; + +use FOG\Plugins\OIDC\Items\OIDC; +use FOG\Plugins\OIDC\Util\OIDCFlow; /** * Ends the identity provider's session when FOG's ends. diff --git a/oidc/class/oidc.class.php b/oidc/src/Items/OIDC.php similarity index 99% rename from oidc/class/oidc.class.php rename to oidc/src/Items/OIDC.php index ad294cd..22bc8db 100644 --- a/oidc/class/oidc.class.php +++ b/oidc/src/Items/OIDC.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * An OpenID Connect identity provider FOG can sign users in with. diff --git a/oidc/class/oidcgroup.class.php b/oidc/src/Items/OIDCGroup.php similarity index 99% rename from oidc/class/oidcgroup.class.php rename to oidc/src/Items/OIDCGroup.php index 0a97194..261aa2e 100644 --- a/oidc/class/oidcgroup.class.php +++ b/oidc/src/Items/OIDCGroup.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * A group name from an identity provider, and what it grants. diff --git a/oidc/class/oidcgrouproleassociation.class.php b/oidc/src/Items/OIDCGroupRoleAssociation.php similarity index 97% rename from oidc/class/oidcgrouproleassociation.class.php rename to oidc/src/Items/OIDCGroupRoleAssociation.php index 9034d69..38d8ba7 100644 --- a/oidc/class/oidcgrouproleassociation.class.php +++ b/oidc/src/Items/OIDCGroupRoleAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * Which roles an identity provider group grants. diff --git a/oidc/class/oidcgroupusergroupassociation.class.php b/oidc/src/Items/OIDCGroupUserGroupAssociation.php similarity index 97% rename from oidc/class/oidcgroupusergroupassociation.class.php rename to oidc/src/Items/OIDCGroupUserGroupAssociation.php index ad8dfb2..5f624d6 100644 --- a/oidc/class/oidcgroupusergroupassociation.class.php +++ b/oidc/src/Items/OIDCGroupUserGroupAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * Which user groups an identity provider group grants. diff --git a/oidc/class/oidcidentity.class.php b/oidc/src/Items/OIDCIdentity.php similarity index 99% rename from oidc/class/oidcidentity.class.php rename to oidc/src/Items/OIDCIdentity.php index a1da0e5..b3636b1 100644 --- a/oidc/class/oidcidentity.class.php +++ b/oidc/src/Items/OIDCIdentity.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * The link between a provider's subject identifier and a FOG user. diff --git a/oidc/class/oidcusergrant.class.php b/oidc/src/Items/OIDCUserGrant.php similarity index 98% rename from oidc/class/oidcusergrant.class.php rename to oidc/src/Items/OIDCUserGrant.php index db0da8d..156a78b 100644 --- a/oidc/class/oidcusergrant.class.php +++ b/oidc/src/Items/OIDCUserGrant.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Items; /** * What this plugin granted a user, so it can take it back. diff --git a/oidc/class/oidcgroupmanager.class.php b/oidc/src/Managers/OIDCGroupManager.php similarity index 98% rename from oidc/class/oidcgroupmanager.class.php rename to oidc/src/Managers/OIDCGroupManager.php index 5fa90c5..9923d5e 100644 --- a/oidc/class/oidcgroupmanager.class.php +++ b/oidc/src/Managers/OIDCGroupManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * Identity provider groups (collection manager + schema). diff --git a/oidc/class/oidcgrouproleassociationmanager.class.php b/oidc/src/Managers/OIDCGroupRoleAssociationManager.php similarity index 98% rename from oidc/class/oidcgrouproleassociationmanager.class.php rename to oidc/src/Managers/OIDCGroupRoleAssociationManager.php index 035b63f..93197a5 100644 --- a/oidc/class/oidcgrouproleassociationmanager.class.php +++ b/oidc/src/Managers/OIDCGroupRoleAssociationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * Provider group to role associations (collection manager + schema). diff --git a/oidc/class/oidcgroupusergroupassociationmanager.class.php b/oidc/src/Managers/OIDCGroupUserGroupAssociationManager.php similarity index 98% rename from oidc/class/oidcgroupusergroupassociationmanager.class.php rename to oidc/src/Managers/OIDCGroupUserGroupAssociationManager.php index 26ba3e2..66c5263 100644 --- a/oidc/class/oidcgroupusergroupassociationmanager.class.php +++ b/oidc/src/Managers/OIDCGroupUserGroupAssociationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * Provider group to user group associations (collection manager + schema). diff --git a/oidc/class/oidcidentitymanager.class.php b/oidc/src/Managers/OIDCIdentityManager.php similarity index 98% rename from oidc/class/oidcidentitymanager.class.php rename to oidc/src/Managers/OIDCIdentityManager.php index 2a9c910..c8afdb7 100644 --- a/oidc/class/oidcidentitymanager.class.php +++ b/oidc/src/Managers/OIDCIdentityManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * Provider-subject to FOG-user links (collection manager + schema). diff --git a/oidc/class/oidcmanager.class.php b/oidc/src/Managers/OIDCManager.php similarity index 99% rename from oidc/class/oidcmanager.class.php rename to oidc/src/Managers/OIDCManager.php index c70ab71..3a1bb4d 100644 --- a/oidc/class/oidcmanager.class.php +++ b/oidc/src/Managers/OIDCManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * OpenID Connect providers (collection manager + schema). diff --git a/oidc/class/oidcusergrantmanager.class.php b/oidc/src/Managers/OIDCUserGrantManager.php similarity index 98% rename from oidc/class/oidcusergrantmanager.class.php rename to oidc/src/Managers/OIDCUserGrantManager.php index ffb2fb4..0e84fe1 100644 --- a/oidc/class/oidcusergrantmanager.class.php +++ b/oidc/src/Managers/OIDCUserGrantManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Managers; /** * Recorded grants (collection manager + schema). diff --git a/oidc/pages/oidcgroupmanagement.page.php b/oidc/src/Pages/OIDCGroupManagement.php similarity index 99% rename from oidc/pages/oidcgroupmanagement.page.php rename to oidc/src/Pages/OIDCGroupManagement.php index 0a8d084..7558a74 100644 --- a/oidc/pages/oidcgroupmanagement.page.php +++ b/oidc/src/Pages/OIDCGroupManagement.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Pages; + +use FOG\Plugins\OIDC\Items\OIDCGroup; /** * The identity provider group management page. diff --git a/oidc/pages/oidcmanagement.page.php b/oidc/src/Pages/OIDCManagement.php similarity index 99% rename from oidc/pages/oidcmanagement.page.php rename to oidc/src/Pages/OIDCManagement.php index f47f243..1c3457e 100644 --- a/oidc/pages/oidcmanagement.page.php +++ b/oidc/src/Pages/OIDCManagement.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Pages; + +use FOG\Plugins\OIDC\Items\OIDC; /** * OpenID Connect provider management page. diff --git a/oidc/class/oidcflow.class.php b/oidc/src/Util/OIDCFlow.php similarity index 99% rename from oidc/class/oidcflow.class.php rename to oidc/src/Util/OIDCFlow.php index 95e29c7..b9945f6 100644 --- a/oidc/class/oidcflow.class.php +++ b/oidc/src/Util/OIDCFlow.php @@ -11,7 +11,11 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Oidc; +namespace FOG\Plugins\OIDC\Util; + +use FOG\Plugins\OIDC\Items\OIDC; +use FOG\Plugins\OIDC\Items\OIDCIdentity; +use FOG\Plugins\OIDC\Items\OIDCUserGrant; /** * The OpenID Connect authorization code flow. @@ -741,7 +745,7 @@ private static function _resolveUser($provider, array $claims) * to be the source of truth for who this is, and a value copied once is * a value that starts drifting immediately. * - * The LDAP plugin already does this (ldappluginhook.hook.php sets name, + * The LDAP plugin already does this (LDAPPluginHook sets name, * display, api and authsource on every login, new row or not), so this * is the OIDC plugin catching up to the behaviour beside it rather than * a new idea. diff --git a/ou/hooks/addouapi.hook.php b/ou/src/Hooks/AddOUAPI.php similarity index 98% rename from ou/hooks/addouapi.hook.php rename to ou/src/Hooks/AddOUAPI.php index d82670c..f1de473 100644 --- a/ou/hooks/addouapi.hook.php +++ b/ou/src/Hooks/AddOUAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Injects ou stuff into the api system. diff --git a/ou/hooks/addougroup.hook.php b/ou/src/Hooks/AddOUGroup.php similarity index 99% rename from ou/hooks/addougroup.hook.php rename to ou/src/Hooks/AddOUGroup.php index 8f38beb..2cf97df 100644 --- a/ou/hooks/addougroup.hook.php +++ b/ou/src/Hooks/AddOUGroup.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Adds the OU choice to groups. diff --git a/ou/hooks/addouhost.hook.php b/ou/src/Hooks/AddOUHost.php similarity index 99% rename from ou/hooks/addouhost.hook.php rename to ou/src/Hooks/AddOUHost.php index b6c2bc3..5d8c9d8 100644 --- a/ou/hooks/addouhost.hook.php +++ b/ou/src/Hooks/AddOUHost.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Adds the ou choice to host. diff --git a/ou/hooks/addoujs.hook.php b/ou/src/Hooks/AddOUJS.php similarity index 98% rename from ou/hooks/addoujs.hook.php rename to ou/src/Hooks/AddOUJS.php index fb92665..b86e701 100644 --- a/ou/hooks/addoujs.hook.php +++ b/ou/src/Hooks/AddOUJS.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/ou/hooks/addoumenuitem.hook.php b/ou/src/Hooks/AddOUMenuItem.php similarity index 99% rename from ou/hooks/addoumenuitem.hook.php rename to ou/src/Hooks/AddOUMenuItem.php index f564ef2..7129d95 100644 --- a/ou/hooks/addoumenuitem.hook.php +++ b/ou/src/Hooks/AddOUMenuItem.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Adds the ou menu item. diff --git a/ou/hooks/addoutype.hook.php b/ou/src/Hooks/AddOUType.php similarity index 97% rename from ou/hooks/addoutype.hook.php rename to ou/src/Hooks/AddOUType.php index a62d732..6f132a5 100644 --- a/ou/hooks/addoutype.hook.php +++ b/ou/src/Hooks/AddOUType.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Adds the ou report type. diff --git a/ou/hooks/ouchangeitems.hook.php b/ou/src/Hooks/OUChangeItems.php similarity index 92% rename from ou/hooks/ouchangeitems.hook.php rename to ou/src/Hooks/OUChangeItems.php index dff076f..96f7861 100644 --- a/ou/hooks/ouchangeitems.hook.php +++ b/ou/src/Hooks/OUChangeItems.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Changes the elements we need. @@ -27,7 +27,9 @@ /** * Named for its plugin -- see LocationChangeItems, which shared this hook's * old changeitems.hook.php filename and therefore its class name. Only one of - * the two ever loaded per request, decided by readdir order. + * the two ever loaded per request, decided by readdir order. Namespacing + * closed that off structurally (fogproject ADR 0035); the distinct names stay + * because they are what the log shows. */ class OUChangeItems extends \FOG\Base\Hook { diff --git a/ou/hooks/oudeletemassitems.hook.php b/ou/src/Hooks/OUDeleteMassItems.php similarity index 98% rename from ou/hooks/oudeletemassitems.hook.php rename to ou/src/Hooks/OUDeleteMassItems.php index 5db42c9..b2b1626 100644 --- a/ou/hooks/oudeletemassitems.hook.php +++ b/ou/src/Hooks/OUDeleteMassItems.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Hooks; /** * Deletes the OU the elements en-mass. diff --git a/ou/class/ou.class.php b/ou/src/Items/OU.php similarity index 98% rename from ou/class/ou.class.php rename to ou/src/Items/OU.php index 9e9b469..fba6fa3 100644 --- a/ou/class/ou.class.php +++ b/ou/src/Items/OU.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Items; /** * The OU class. diff --git a/ou/class/ouassociation.class.php b/ou/src/Items/OUAssociation.php similarity index 98% rename from ou/class/ouassociation.class.php rename to ou/src/Items/OUAssociation.php index 8c48074..d1e301c 100644 --- a/ou/class/ouassociation.class.php +++ b/ou/src/Items/OUAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Items; /** * The association between hosts and ous. diff --git a/ou/class/ouassociationmanager.class.php b/ou/src/Managers/OUAssociationManager.php similarity index 98% rename from ou/class/ouassociationmanager.class.php rename to ou/src/Managers/OUAssociationManager.php index a08dd59..46a0036 100644 --- a/ou/class/ouassociationmanager.class.php +++ b/ou/src/Managers/OUAssociationManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Managers; /** * OU association manager class. diff --git a/ou/class/oumanager.class.php b/ou/src/Managers/OUManager.php similarity index 99% rename from ou/class/oumanager.class.php rename to ou/src/Managers/OUManager.php index e221091..58231b1 100644 --- a/ou/class/oumanager.class.php +++ b/ou/src/Managers/OUManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Managers; /** * OU manager mass management class diff --git a/ou/pages/oumanagement.page.php b/ou/src/Pages/OUManagement.php similarity index 99% rename from ou/pages/oumanagement.page.php rename to ou/src/Pages/OUManagement.php index 5391be8..7ebad75 100644 --- a/ou/pages/oumanagement.page.php +++ b/ou/src/Pages/OUManagement.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Pages; /** * OU management page. diff --git a/ou/reports/ou_report.report.php b/ou/src/Reports/OU_Report.php similarity index 98% rename from ou/reports/ou_report.report.php rename to ou/src/Reports/OU_Report.php index 522b28a..e96e496 100644 --- a/ou/reports/ou_report.report.php +++ b/ou/src/Reports/OU_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Ou; +namespace FOG\Plugins\OU\Reports; /** * OU report. diff --git a/persistentgroups/class/persistentgroups.class.php b/persistentgroups/src/Items/PersistentGroups.php similarity index 92% rename from persistentgroups/class/persistentgroups.class.php rename to persistentgroups/src/Items/PersistentGroups.php index f696ae5..82e4151 100644 --- a/persistentgroups/class/persistentgroups.class.php +++ b/persistentgroups/src/Items/PersistentGroups.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Persistentgroups; +namespace FOG\Plugins\PersistentGroups\Items; /** * Persistent group class. diff --git a/persistentgroups/class/persistentgroupsmanager.class.php b/persistentgroups/src/Managers/PersistentGroupsManager.php similarity index 99% rename from persistentgroups/class/persistentgroupsmanager.class.php rename to persistentgroups/src/Managers/PersistentGroupsManager.php index 6b73bfe..a79a3ff 100644 --- a/persistentgroups/class/persistentgroupsmanager.class.php +++ b/persistentgroups/src/Managers/PersistentGroupsManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Persistentgroups; +namespace FOG\Plugins\PersistentGroups\Managers; /** * The example mass manager class. diff --git a/pushbullet/events/imagecomplete_pushbullet.event.php b/pushbullet/src/Events/ImageComplete_PushBullet.php similarity index 96% rename from pushbullet/events/imagecomplete_pushbullet.event.php rename to pushbullet/src/Events/ImageComplete_PushBullet.php index a578a64..b3930ac 100644 --- a/pushbullet/events/imagecomplete_pushbullet.event.php +++ b/pushbullet/src/Events/ImageComplete_PushBullet.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Events; + +use FOG\Plugins\Pushbullet\Util\PushbulletExtends; /** * Pushes notification on image completion. diff --git a/pushbullet/events/imagefail_pushbullet.event.php b/pushbullet/src/Events/ImageFail_PushBullet.php similarity index 96% rename from pushbullet/events/imagefail_pushbullet.event.php rename to pushbullet/src/Events/ImageFail_PushBullet.php index 552a5c3..2cf6ca2 100644 --- a/pushbullet/events/imagefail_pushbullet.event.php +++ b/pushbullet/src/Events/ImageFail_PushBullet.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Events; + +use FOG\Plugins\Pushbullet\Util\PushbulletExtends; /** * Pushes notification on imaging failure. diff --git a/pushbullet/events/loginfailure_pushbullet.event.php b/pushbullet/src/Events/LoginFailure_PushBullet.php similarity index 95% rename from pushbullet/events/loginfailure_pushbullet.event.php rename to pushbullet/src/Events/LoginFailure_PushBullet.php index aaf5bf8..b3e0763 100644 --- a/pushbullet/events/loginfailure_pushbullet.event.php +++ b/pushbullet/src/Events/LoginFailure_PushBullet.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Events; + +use FOG\Plugins\Pushbullet\Util\PushbulletExtends; /** * Pushes notification on login failure. diff --git a/pushbullet/events/snapincomplete_pushbullet.event.php b/pushbullet/src/Events/SnapinComplete_PushBullet.php similarity index 94% rename from pushbullet/events/snapincomplete_pushbullet.event.php rename to pushbullet/src/Events/SnapinComplete_PushBullet.php index 6d61def..ee1c73e 100644 --- a/pushbullet/events/snapincomplete_pushbullet.event.php +++ b/pushbullet/src/Events/SnapinComplete_PushBullet.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Events; + +use FOG\Plugins\Pushbullet\Util\PushbulletExtends; /** * Pushes notification on snapin completion. diff --git a/pushbullet/events/snapintaskcomplete_pushbullet.event.php b/pushbullet/src/Events/SnapinTaskComplete_PushBullet.php similarity index 95% rename from pushbullet/events/snapintaskcomplete_pushbullet.event.php rename to pushbullet/src/Events/SnapinTaskComplete_PushBullet.php index f62cf31..6e0fc0c 100644 --- a/pushbullet/events/snapintaskcomplete_pushbullet.event.php +++ b/pushbullet/src/Events/SnapinTaskComplete_PushBullet.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Events; + +use FOG\Plugins\Pushbullet\Util\PushbulletExtends; /** * Pushes notification on image completion. diff --git a/pushbullet/hooks/addpushbulletapi.hook.php b/pushbullet/src/Hooks/AddPushbulletAPI.php similarity index 98% rename from pushbullet/hooks/addpushbulletapi.hook.php rename to pushbullet/src/Hooks/AddPushbulletAPI.php index e3238f0..68e7db5 100644 --- a/pushbullet/hooks/addpushbulletapi.hook.php +++ b/pushbullet/src/Hooks/AddPushbulletAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Hooks; /** * Injects pushbullet stuff into the api system. diff --git a/pushbullet/hooks/addpushbulletjs.hook.php b/pushbullet/src/Hooks/AddPushbulletJS.php similarity index 97% rename from pushbullet/hooks/addpushbulletjs.hook.php rename to pushbullet/src/Hooks/AddPushbulletJS.php index 7e6a757..090fb51 100644 --- a/pushbullet/hooks/addpushbulletjs.hook.php +++ b/pushbullet/src/Hooks/AddPushbulletJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/pushbullet/hooks/addpushbulletmenuitem.hook.php b/pushbullet/src/Hooks/AddPushbulletMenuItem.php similarity index 98% rename from pushbullet/hooks/addpushbulletmenuitem.hook.php rename to pushbullet/src/Hooks/AddPushbulletMenuItem.php index 27c2b29..c2c70d8 100644 --- a/pushbullet/hooks/addpushbulletmenuitem.hook.php +++ b/pushbullet/src/Hooks/AddPushbulletMenuItem.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Hooks; /** * Adds the pushbullet menu item to the menu. diff --git a/pushbullet/class/pushbullet.class.php b/pushbullet/src/Items/Pushbullet.php similarity index 96% rename from pushbullet/class/pushbullet.class.php rename to pushbullet/src/Items/Pushbullet.php index 7a17117..1769a34 100644 --- a/pushbullet/class/pushbullet.class.php +++ b/pushbullet/src/Items/Pushbullet.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Items; /** * The pushbullet database and object definer diff --git a/pushbullet/class/pushbulletmanager.class.php b/pushbullet/src/Managers/PushbulletManager.php similarity index 98% rename from pushbullet/class/pushbulletmanager.class.php rename to pushbullet/src/Managers/PushbulletManager.php index 08e136a..7a008cd 100644 --- a/pushbullet/class/pushbulletmanager.class.php +++ b/pushbullet/src/Managers/PushbulletManager.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Managers; /** * Manager class for pushbullet diff --git a/pushbullet/pages/pushbulletmanagement.page.php b/pushbullet/src/Pages/PushbulletManagement.php similarity index 98% rename from pushbullet/pages/pushbulletmanagement.page.php rename to pushbullet/src/Pages/PushbulletManagement.php index 09be96a..dbd4976 100644 --- a/pushbullet/pages/pushbulletmanagement.page.php +++ b/pushbullet/src/Pages/PushbulletManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Pages; /** * Page presenter for pushbullet plugin diff --git a/pushbullet/class/pushbulletexception.class.php b/pushbullet/src/Util/PushbulletException.php similarity index 94% rename from pushbullet/class/pushbulletexception.class.php rename to pushbullet/src/Util/PushbulletException.php index 731934b..2cfb770 100644 --- a/pushbullet/class/pushbulletexception.class.php +++ b/pushbullet/src/Util/PushbulletException.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Util; /** * Exception class for pushbullet diff --git a/pushbullet/class/pushbulletextends.class.php b/pushbullet/src/Util/PushbulletExtends.php similarity index 98% rename from pushbullet/class/pushbulletextends.class.php rename to pushbullet/src/Util/PushbulletExtends.php index b60f325..8a17cf2 100644 --- a/pushbullet/class/pushbulletextends.class.php +++ b/pushbullet/src/Util/PushbulletExtends.php @@ -14,7 +14,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Util; /** * The base class of pushbullet elements diff --git a/pushbullet/class/pushbullethandler.class.php b/pushbullet/src/Util/PushbulletHandler.php similarity index 99% rename from pushbullet/class/pushbullethandler.class.php rename to pushbullet/src/Util/PushbulletHandler.php index 4ce1555..a108b1a 100644 --- a/pushbullet/class/pushbullethandler.class.php +++ b/pushbullet/src/Util/PushbulletHandler.php @@ -12,7 +12,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Pushbullet; +namespace FOG\Plugins\Pushbullet\Util; + +use FOG\Plugins\Pushbullet\Items\Pushbullet; /** * Pushbullet handler diff --git a/slack/events/imagecomplete_slack.event.php b/slack/src/Events/ImageComplete_Slack.php similarity index 98% rename from slack/events/imagecomplete_slack.event.php rename to slack/src/Events/ImageComplete_Slack.php index a85368b..417f8ac 100644 --- a/slack/events/imagecomplete_slack.event.php +++ b/slack/src/Events/ImageComplete_Slack.php @@ -9,7 +9,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Events; class ImageComplete_Slack extends \FOG\Base\Event { diff --git a/slack/events/imagefail_slack.event.php b/slack/src/Events/ImageFail_Slack.php similarity index 98% rename from slack/events/imagefail_slack.event.php rename to slack/src/Events/ImageFail_Slack.php index 3f13b69..96f3733 100644 --- a/slack/events/imagefail_slack.event.php +++ b/slack/src/Events/ImageFail_Slack.php @@ -9,7 +9,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Events; class ImageFail_Slack extends \FOG\Base\Event { diff --git a/slack/events/loginfailure_slack.event.php b/slack/src/Events/LoginFailure_Slack.php similarity index 97% rename from slack/events/loginfailure_slack.event.php rename to slack/src/Events/LoginFailure_Slack.php index c5fcad8..b65f2bc 100644 --- a/slack/events/loginfailure_slack.event.php +++ b/slack/src/Events/LoginFailure_Slack.php @@ -10,7 +10,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Events; class LoginFailure_Slack extends \FOG\Base\Event { diff --git a/slack/events/snapincomplete_slack.event.php b/slack/src/Events/SnapinComplete_Slack.php similarity index 97% rename from slack/events/snapincomplete_slack.event.php rename to slack/src/Events/SnapinComplete_Slack.php index 751d45d..302d5ad 100644 --- a/slack/events/snapincomplete_slack.event.php +++ b/slack/src/Events/SnapinComplete_Slack.php @@ -9,7 +9,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Events; class SnapinComplete_Slack extends \FOG\Base\Event { diff --git a/slack/events/snapintaskcomplete_slack.event.php b/slack/src/Events/SnapinTaskComplete_Slack.php similarity index 98% rename from slack/events/snapintaskcomplete_slack.event.php rename to slack/src/Events/SnapinTaskComplete_Slack.php index 0a550fd..1abc6b8 100644 --- a/slack/events/snapintaskcomplete_slack.event.php +++ b/slack/src/Events/SnapinTaskComplete_Slack.php @@ -9,7 +9,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Events; class SnapinTaskComplete_Slack extends \FOG\Base\Event { diff --git a/slack/hooks/addslackapi.hook.php b/slack/src/Hooks/AddSlackAPI.php similarity index 99% rename from slack/hooks/addslackapi.hook.php rename to slack/src/Hooks/AddSlackAPI.php index b0399a1..0d8b399 100644 --- a/slack/hooks/addslackapi.hook.php +++ b/slack/src/Hooks/AddSlackAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Hooks; /** * Injects slack stuff into the api system. diff --git a/slack/hooks/addslackjs.hook.php b/slack/src/Hooks/AddSlackJS.php similarity index 97% rename from slack/hooks/addslackjs.hook.php rename to slack/src/Hooks/AddSlackJS.php index aa43912..86e8e61 100644 --- a/slack/hooks/addslackjs.hook.php +++ b/slack/src/Hooks/AddSlackJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/slack/hooks/addslackmenuitem.hook.php b/slack/src/Hooks/AddSlackMenuItem.php similarity index 98% rename from slack/hooks/addslackmenuitem.hook.php rename to slack/src/Hooks/AddSlackMenuItem.php index 7330911..04391ea 100644 --- a/slack/hooks/addslackmenuitem.hook.php +++ b/slack/src/Hooks/AddSlackMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Hooks; /** * Add slack menu item. diff --git a/slack/class/slack.class.php b/slack/src/Items/Slack.php similarity index 97% rename from slack/class/slack.class.php rename to slack/src/Items/Slack.php index e1482b6..405d441 100644 --- a/slack/class/slack.class.php +++ b/slack/src/Items/Slack.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Items; + +use FOG\Plugins\Slack\Util\SlackException; /** * Slack class. diff --git a/slack/class/slackmanager.class.php b/slack/src/Managers/SlackManager.php similarity index 98% rename from slack/class/slackmanager.class.php rename to slack/src/Managers/SlackManager.php index ef35cc5..55eba78 100644 --- a/slack/class/slackmanager.class.php +++ b/slack/src/Managers/SlackManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Managers; /** * Slack manager mass management class diff --git a/slack/pages/slackmanagement.page.php b/slack/src/Pages/SlackManagement.php similarity index 99% rename from slack/pages/slackmanagement.page.php rename to slack/src/Pages/SlackManagement.php index f989b49..a2c273c 100644 --- a/slack/pages/slackmanagement.page.php +++ b/slack/src/Pages/SlackManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Pages; /** * Slack page edit/add. diff --git a/slack/class/slackexception.class.php b/slack/src/Util/SlackException.php similarity index 94% rename from slack/class/slackexception.class.php rename to slack/src/Util/SlackException.php index d141813..99b56be 100644 --- a/slack/class/slackexception.class.php +++ b/slack/src/Util/SlackException.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Util; /** * Slack exception, simple extends exception. diff --git a/slack/class/slackhandler.class.php b/slack/src/Util/SlackHandler.php similarity index 99% rename from slack/class/slackhandler.class.php rename to slack/src/Util/SlackHandler.php index 84793fe..dbaaf13 100644 --- a/slack/class/slackhandler.class.php +++ b/slack/src/Util/SlackHandler.php @@ -11,7 +11,9 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Slack; +namespace FOG\Plugins\Slack\Util; + +use FOG\Plugins\Slack\Items\Slack; /** * Handles the api calling of Slack messages. diff --git a/subnetgroup/hooks/addsubnetgroupapi.hook.php b/subnetgroup/src/Hooks/AddSubnetGroupAPI.php similarity index 98% rename from subnetgroup/hooks/addsubnetgroupapi.hook.php rename to subnetgroup/src/Hooks/AddSubnetGroupAPI.php index 64a308b..ed1face 100644 --- a/subnetgroup/hooks/addsubnetgroupapi.hook.php +++ b/subnetgroup/src/Hooks/AddSubnetGroupAPI.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Injects subnetgroup into api system. diff --git a/subnetgroup/hooks/addsubnetgrouphost.hook.php b/subnetgroup/src/Hooks/AddSubnetGroupHost.php similarity index 98% rename from subnetgroup/hooks/addsubnetgrouphost.hook.php rename to subnetgroup/src/Hooks/AddSubnetGroupHost.php index a586a40..8b8232c 100644 --- a/subnetgroup/hooks/addsubnetgrouphost.hook.php +++ b/subnetgroup/src/Hooks/AddSubnetGroupHost.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Adds the subnet group to host. diff --git a/subnetgroup/hooks/addsubnetgroupjs.hook.php b/subnetgroup/src/Hooks/AddSubnetGroupJS.php similarity index 97% rename from subnetgroup/hooks/addsubnetgroupjs.hook.php rename to subnetgroup/src/Hooks/AddSubnetGroupJS.php index fc13027..798658f 100644 --- a/subnetgroup/hooks/addsubnetgroupjs.hook.php +++ b/subnetgroup/src/Hooks/AddSubnetGroupJS.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php b/subnetgroup/src/Hooks/AddSubnetGroupMenuItem.php similarity index 99% rename from subnetgroup/hooks/addsubnetgroupmenuitem.hook.php rename to subnetgroup/src/Hooks/AddSubnetGroupMenuItem.php index e8e3f4d..e5f1c8f 100644 --- a/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php +++ b/subnetgroup/src/Hooks/AddSubnetGroupMenuItem.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Adds the subnet group menu item. diff --git a/subnetgroup/hooks/addsubnetgrouptype.hook.php b/subnetgroup/src/Hooks/AddSubnetGroupType.php similarity index 97% rename from subnetgroup/hooks/addsubnetgrouptype.hook.php rename to subnetgroup/src/Hooks/AddSubnetGroupType.php index f095a99..fb82596 100644 --- a/subnetgroup/hooks/addsubnetgrouptype.hook.php +++ b/subnetgroup/src/Hooks/AddSubnetGroupType.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Adds the subnet group report type. diff --git a/subnetgroup/hooks/removesubnetgroupgroup.hook.php b/subnetgroup/src/Hooks/RemoveSubnetGroupGroup.php similarity index 97% rename from subnetgroup/hooks/removesubnetgroupgroup.hook.php rename to subnetgroup/src/Hooks/RemoveSubnetGroupGroup.php index d744054..7f5d020 100644 --- a/subnetgroup/hooks/removesubnetgroupgroup.hook.php +++ b/subnetgroup/src/Hooks/RemoveSubnetGroupGroup.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Hooks; /** * Remove the subnet group from the group. diff --git a/subnetgroup/class/subnetgroup.class.php b/subnetgroup/src/Items/SubnetGroup.php similarity index 97% rename from subnetgroup/class/subnetgroup.class.php rename to subnetgroup/src/Items/SubnetGroup.php index b03fbbc..ca94bbe 100644 --- a/subnetgroup/class/subnetgroup.class.php +++ b/subnetgroup/src/Items/SubnetGroup.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Items; /** * Subnet Group plugin diff --git a/subnetgroup/class/subnetgroupmanager.class.php b/subnetgroup/src/Managers/SubnetGroupManager.php similarity index 97% rename from subnetgroup/class/subnetgroupmanager.class.php rename to subnetgroup/src/Managers/SubnetGroupManager.php index 358e605..bfc2128 100644 --- a/subnetgroup/class/subnetgroupmanager.class.php +++ b/subnetgroup/src/Managers/SubnetGroupManager.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Managers; /** * Site plugin @@ -108,7 +108,7 @@ public function schema() // subnetgroup.sgGroupID CASCADE to `groups`. // // CASCADE PINS WHAT ALREADY HAPPENS, so nothing observable - // changes. removesubnetgroupgroup.hook.php already calls + // changes. RemoveSubnetGroupGroup already calls // Route::deletemass('subnetgroup', ['groupID' => ...]) when a // group is destroyed; the constraint states that in the schema // instead of relying on a hook being registered. The hook stays diff --git a/subnetgroup/pages/subnetgroupmanagement.page.php b/subnetgroup/src/Pages/SubnetGroupManagement.php similarity index 99% rename from subnetgroup/pages/subnetgroupmanagement.page.php rename to subnetgroup/src/Pages/SubnetGroupManagement.php index 5355d7e..7c4c970 100644 --- a/subnetgroup/pages/subnetgroupmanagement.page.php +++ b/subnetgroup/src/Pages/SubnetGroupManagement.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Pages; /** * Subnet group management page. diff --git a/subnetgroup/reports/subnetgroup_report.report.php b/subnetgroup/src/Reports/SubnetGroup_Report.php similarity index 97% rename from subnetgroup/reports/subnetgroup_report.report.php rename to subnetgroup/src/Reports/SubnetGroup_Report.php index 94d47ab..675f4b6 100644 --- a/subnetgroup/reports/subnetgroup_report.report.php +++ b/subnetgroup/src/Reports/SubnetGroup_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Subnetgroup; +namespace FOG\Plugins\SubnetGroup\Reports; /** * Subnet Group report. diff --git a/taskstateedit/hooks/addtaskstateeditjs.hook.php b/taskstateedit/src/Hooks/AddTaskStateEditJS.php similarity index 97% rename from taskstateedit/hooks/addtaskstateeditjs.hook.php rename to taskstateedit/src/Hooks/AddTaskStateEditJS.php index 14b5ece..3bc5ce7 100644 --- a/taskstateedit/hooks/addtaskstateeditjs.hook.php +++ b/taskstateedit/src/Hooks/AddTaskStateEditJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/taskstateedit/hooks/addtaskstatetype.hook.php b/taskstateedit/src/Hooks/AddTaskStateType.php similarity index 96% rename from taskstateedit/hooks/addtaskstatetype.hook.php rename to taskstateedit/src/Hooks/AddTaskStateType.php index 0fd6f88..95d207c 100644 --- a/taskstateedit/hooks/addtaskstatetype.hook.php +++ b/taskstateedit/src/Hooks/AddTaskStateType.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Hooks; /** * Adds task state type report. diff --git a/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php b/taskstateedit/src/Hooks/AddTaskstateeditMenuItem.php similarity index 98% rename from taskstateedit/hooks/addtaskstateeditmenuitem.hook.php rename to taskstateedit/src/Hooks/AddTaskstateeditMenuItem.php index bfeed9e..1016127 100644 --- a/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php +++ b/taskstateedit/src/Hooks/AddTaskstateeditMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Hooks; /** * Adds task state edit menu item. diff --git a/taskstateedit/class/taskstateedit.class.php b/taskstateedit/src/Items/Taskstateedit.php similarity index 92% rename from taskstateedit/class/taskstateedit.class.php rename to taskstateedit/src/Items/Taskstateedit.php index 0160704..32b9baf 100644 --- a/taskstateedit/class/taskstateedit.class.php +++ b/taskstateedit/src/Items/Taskstateedit.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Items; /** * Taskstateedit Class Handler. diff --git a/taskstateedit/class/taskstateeditmanager.class.php b/taskstateedit/src/Managers/TaskstateeditManager.php similarity index 95% rename from taskstateedit/class/taskstateeditmanager.class.php rename to taskstateedit/src/Managers/TaskstateeditManager.php index 868d7c5..974d351 100644 --- a/taskstateedit/class/taskstateeditmanager.class.php +++ b/taskstateedit/src/Managers/TaskstateeditManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Managers; /** * TaskstateeditManager diff --git a/taskstateedit/pages/taskstateeditmanagement.page.php b/taskstateedit/src/Pages/TaskstateeditManagement.php similarity index 99% rename from taskstateedit/pages/taskstateeditmanagement.page.php rename to taskstateedit/src/Pages/TaskstateeditManagement.php index 1ee922f..5c49e67 100644 --- a/taskstateedit/pages/taskstateeditmanagement.page.php +++ b/taskstateedit/src/Pages/TaskstateeditManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Pages; /** * Task state edit page. diff --git a/taskstateedit/reports/taskstateedit_report.report.php b/taskstateedit/src/Reports/Taskstateedit_Report.php similarity index 97% rename from taskstateedit/reports/taskstateedit_report.report.php rename to taskstateedit/src/Reports/Taskstateedit_Report.php index 64d03f2..3a6a027 100644 --- a/taskstateedit/reports/taskstateedit_report.report.php +++ b/taskstateedit/src/Reports/Taskstateedit_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Taskstateedit; +namespace FOG\Plugins\TaskStateEdit\Reports; /** * Task State report. diff --git a/tasktypeedit/hooks/addtasktypeeditjs.hook.php b/tasktypeedit/src/Hooks/AddTaskTypeEditJS.php similarity index 97% rename from tasktypeedit/hooks/addtasktypeeditjs.hook.php rename to tasktypeedit/src/Hooks/AddTaskTypeEditJS.php index c16450a..a132886 100644 --- a/tasktypeedit/hooks/addtasktypeeditjs.hook.php +++ b/tasktypeedit/src/Hooks/AddTaskTypeEditJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/tasktypeedit/hooks/addtasktypetype.hook.php b/tasktypeedit/src/Hooks/AddTaskTypeType.php similarity index 96% rename from tasktypeedit/hooks/addtasktypetype.hook.php rename to tasktypeedit/src/Hooks/AddTaskTypeType.php index 57f4f68..0b971c4 100644 --- a/tasktypeedit/hooks/addtasktypetype.hook.php +++ b/tasktypeedit/src/Hooks/AddTaskTypeType.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Hooks; /** * Add task type type reporter. diff --git a/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php b/tasktypeedit/src/Hooks/AddTasktypeeditMenuItem.php similarity index 98% rename from tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php rename to tasktypeedit/src/Hooks/AddTasktypeeditMenuItem.php index d64d81d..8cecf68 100644 --- a/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php +++ b/tasktypeedit/src/Hooks/AddTasktypeeditMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Hooks; /** * Adds task type edit menu item. diff --git a/tasktypeedit/class/tasktypeedit.class.php b/tasktypeedit/src/Items/Tasktypeedit.php similarity index 92% rename from tasktypeedit/class/tasktypeedit.class.php rename to tasktypeedit/src/Items/Tasktypeedit.php index 24fb4af..8e8adfe 100644 --- a/tasktypeedit/class/tasktypeedit.class.php +++ b/tasktypeedit/src/Items/Tasktypeedit.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Items; /** * Tasktypeedit Class Handler. diff --git a/tasktypeedit/class/tasktypeeditmanager.class.php b/tasktypeedit/src/Managers/TasktypeeditManager.php similarity index 95% rename from tasktypeedit/class/tasktypeeditmanager.class.php rename to tasktypeedit/src/Managers/TasktypeeditManager.php index 981adc2..58a5052 100644 --- a/tasktypeedit/class/tasktypeeditmanager.class.php +++ b/tasktypeedit/src/Managers/TasktypeeditManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Managers; /** * TasktypeeditManager diff --git a/tasktypeedit/pages/tasktypeeditmanagement.page.php b/tasktypeedit/src/Pages/TasktypeeditManagement.php similarity index 99% rename from tasktypeedit/pages/tasktypeeditmanagement.page.php rename to tasktypeedit/src/Pages/TasktypeeditManagement.php index 4830fc0..4159f88 100644 --- a/tasktypeedit/pages/tasktypeeditmanagement.page.php +++ b/tasktypeedit/src/Pages/TasktypeeditManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Pages; /** * Task type edit page. diff --git a/tasktypeedit/reports/tasktypeedit_report.report.php b/tasktypeedit/src/Reports/Tasktypeedit_Report.php similarity index 97% rename from tasktypeedit/reports/tasktypeedit_report.report.php rename to tasktypeedit/src/Reports/Tasktypeedit_Report.php index 3087850..675ec26 100644 --- a/tasktypeedit/reports/tasktypeedit_report.report.php +++ b/tasktypeedit/src/Reports/Tasktypeedit_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Tasktypeedit; +namespace FOG\Plugins\TaskTypeEdit\Reports; /** * Task Type report. diff --git a/tests/booleans-are-tinyint.test.php b/tests/booleans-are-tinyint.test.php index bdb3f86..fbed2e1 100644 --- a/tests/booleans-are-tinyint.test.php +++ b/tests/booleans-are-tinyint.test.php @@ -108,16 +108,19 @@ function btMethod($file, $method) return substr($clean, $at); } -$managers = glob($root . '/*/class/*manager.class.php'); +// Managers live at /src/Managers/.php under the PSR-4 layout +// (tests/plugin-layout.test.php) -- the bucket directory is what the layout +// guarantees, not any filename suffix. +$managers = glob($root . '/*/src/Managers/*.php'); btCheck('plugin managers were found', count($managers) > 0, $failures, $checks); // The plugins that shipped two-state columns. Named, because "calls // enumToTinyint" is only a requirement for a plugin that has something to // convert -- every other manager must be free of both. $converters = [ - 'ldap/class/ldapmanager.class.php', - 'oidc/class/oidcmanager.class.php', - 'location/class/locationmanager.class.php', + 'ldap/src/Managers/LDAPManager.php', + 'oidc/src/Managers/OIDCManager.php', + 'location/src/Managers/LocationManager.php', ]; foreach ($managers as $file) { diff --git a/tests/foreign-keys-applied-per-plugin.test.php b/tests/foreign-keys-applied-per-plugin.test.php index b046628..3779684 100644 --- a/tests/foreign-keys-applied-per-plugin.test.php +++ b/tests/foreign-keys-applied-per-plugin.test.php @@ -52,13 +52,13 @@ * ADD A ROW HERE IN THE SAME COMMIT THAT LANDS A PLUGIN'S STEP. */ $expected = [ - 'location' => 'location/class/locationmanager.class.php', - 'ou' => 'ou/class/oumanager.class.php', - 'windowskey' => 'windowskey/class/windowskeymanager.class.php', - 'ldap' => 'ldap/class/ldapmanager.class.php', - 'oidc' => 'oidc/class/oidcmanager.class.php', - 'capone' => 'capone/class/caponemanager.class.php', - 'subnetgroup' => 'subnetgroup/class/subnetgroupmanager.class.php', + 'location' => 'location/src/Managers/LocationManager.php', + 'ou' => 'ou/src/Managers/OUManager.php', + 'windowskey' => 'windowskey/src/Managers/WindowsKeyManager.php', + 'ldap' => 'ldap/src/Managers/LDAPManager.php', + 'oidc' => 'oidc/src/Managers/OIDCManager.php', + 'capone' => 'capone/src/Managers/CaponeManager.php', + 'subnetgroup' => 'subnetgroup/src/Managers/SubnetGroupManager.php', ]; /** @@ -157,7 +157,7 @@ function fkStrip($file) * step 4 alone passes every upgrade test and fails only on a brand new * server. */ -$src = fkStrip($root . '/location/class/locationmanager.class.php'); +$src = fkStrip($root . '/location/src/Managers/LocationManager.php'); $tight = preg_replace('/\s+/', '', $src); $checks++; if (strpos($tight, "MODIFYCOLUMN`lStorageNodeID`") === false diff --git a/tests/group-tab-permissions.test.php b/tests/group-tab-permissions.test.php index e5ba93b..1e0fdae 100644 --- a/tests/group-tab-permissions.test.php +++ b/tests/group-tab-permissions.test.php @@ -44,11 +44,11 @@ */ $hooks = [ 'ldap' => [ - $root . '/ldap/hooks/addldapgrouptabs.hook.php', + $root . '/ldap/src/Hooks/AddLDAPGroupTabs.php', 'ldapgroup' ], 'oidc' => [ - $root . '/oidc/hooks/addoidcgrouptabs.hook.php', + $root . '/oidc/src/Hooks/AddOIDCGroupTabs.php', 'oidcgroup' ] ]; diff --git a/tests/imaging-notification-detail.test.php b/tests/imaging-notification-detail.test.php index 94d02d4..5c7995f 100644 --- a/tests/imaging-notification-detail.test.php +++ b/tests/imaging-notification-detail.test.php @@ -26,20 +26,29 @@ $root = dirname(__DIR__); +// The class-name suffix does not always match the plugin directory's own +// casing (pushbullet's classes are suffixed _PushBullet, not _Pushbullet), +// so it is named explicitly rather than derived. +$suffixes = [ + 'slack' => 'Slack', + 'ntfy' => 'Ntfy', + 'pushbullet' => 'PushBullet', +]; + $complete = []; $fail = []; -foreach (['slack', 'ntfy', 'pushbullet'] as $plugin) { +foreach ($suffixes as $plugin => $suffix) { $complete[$plugin] = sprintf( - '%s/%s/events/imagecomplete_%s.event.php', + '%s/%s/src/Events/ImageComplete_%s.php', $root, $plugin, - $plugin + $suffix ); $fail[$plugin] = sprintf( - '%s/%s/events/imagefail_%s.event.php', + '%s/%s/src/Events/ImageFail_%s.php', $root, $plugin, - $plugin + $suffix ); } diff --git a/tests/oidc-auto-redirect.test.php b/tests/oidc-auto-redirect.test.php index b54c5d6..4b6b3ba 100644 --- a/tests/oidc-auto-redirect.test.php +++ b/tests/oidc-auto-redirect.test.php @@ -46,12 +46,12 @@ * Exit 0 = pass, 1 = fail. */ $root = dirname(__DIR__); -$flowFile = $root . '/oidc/class/oidcflow.class.php'; -$hookFile = $root . '/oidc/hooks/oidcloginredirect.hook.php'; -$outFile = $root . '/oidc/hooks/oidclogout.hook.php'; -$modelFile = $root . '/oidc/class/oidc.class.php'; -$mgrFile = $root . '/oidc/class/oidcmanager.class.php'; -$pageFile = $root . '/oidc/pages/oidcmanagement.page.php'; +$flowFile = $root . '/oidc/src/Util/OIDCFlow.php'; +$hookFile = $root . '/oidc/src/Hooks/OIDCLoginRedirect.php'; +$outFile = $root . '/oidc/src/Hooks/OIDCLogout.php'; +$modelFile = $root . '/oidc/src/Items/OIDC.php'; +$mgrFile = $root . '/oidc/src/Managers/OIDCManager.php'; +$pageFile = $root . '/oidc/src/Pages/OIDCManagement.php'; foreach ([$flowFile, $hookFile, $outFile, $modelFile, $mgrFile, $pageFile] as $f) { if (!is_readable($f)) { echo "cannot read $f -- run this from the repository\n"; diff --git a/tests/oidc-flow-safety.test.php b/tests/oidc-flow-safety.test.php index eecb370..b8a5b37 100644 --- a/tests/oidc-flow-safety.test.php +++ b/tests/oidc-flow-safety.test.php @@ -116,7 +116,7 @@ function methodBody($src, $method) return null; } -$flowFile = $root . '/oidc/class/oidcflow.class.php'; +$flowFile = $root . '/oidc/src/Util/OIDCFlow.php'; $flowSrc = (string)file_get_contents($flowFile); /* @@ -367,7 +367,7 @@ function methodBody($src, $method) * which here means signing in as them. */ $identSrc = (string)file_get_contents( - $root . '/oidc/class/oidcidentity.class.php' + $root . '/oidc/src/Items/OIDCIdentity.php' ); $userIdFor = methodBody($identSrc, 'userIdFor'); if (null === $userIdFor) { @@ -400,7 +400,7 @@ function methodBody($src, $method) * 7. The routes: under /ext/, declared public, and pointing at the flow. */ $routeSrc = (string)file_get_contents( - $root . '/oidc/hooks/addoidcroutes.hook.php' + $root . '/oidc/src/Hooks/AddOIDCRoutes.php' ); foreach (['/ext/oidc/start', '/ext/oidc/callback'] as $path) { if (false === strpos($routeSrc, "'path' => '$path'")) { @@ -427,7 +427,7 @@ function methodBody($src, $method) * provider turns out to point somewhere that does not exist. */ require $root . '/tests/stubs/fog-stubs.php'; -require $root . '/oidc/class/oidc.class.php'; +require $root . '/oidc/src/Items/OIDC.php'; \FOG\Base\FOGController::$settings = ['FOG_WEB_ROOT' => 'fog', 'FOG_WEB_HOST' => 'fog.example']; $cases = [ @@ -441,8 +441,8 @@ function methodBody($src, $method) ]; foreach ($cases as $setting => $want) { \FOG\Base\FOGController::$settings['FOG_WEB_ROOT'] = $setting; - $gotBase = \FOG\Plugins\Oidc\OIDC::webrootBase(); - $gotUri = \FOG\Plugins\Oidc\OIDC::redirectUri(); + $gotBase = \FOG\Plugins\OIDC\Items\OIDC::webrootBase(); + $gotUri = \FOG\Plugins\OIDC\Items\OIDC::redirectUri(); if ($gotBase !== $want[0] || $gotUri !== $want[1]) { fail( sprintf( @@ -591,12 +591,12 @@ function methodBody($src, $method) * * Run for real against the Schema stub, which records what it was asked for. */ -require $root . '/oidc/class/oidcgroupmanager.class.php'; -require $root . '/oidc/class/oidcusergrantmanager.class.php'; +require $root . '/oidc/src/Managers/OIDCGroupManager.php'; +require $root . '/oidc/src/Managers/OIDCUserGrantManager.php'; $indexCases = [ // class => [table, expected unique index, why] - 'FOG\Plugins\Oidc\OIDCGroupManager' => [ + 'FOG\Plugins\OIDC\Managers\OIDCGroupManager' => [ 'OIDCGroups', [['ogProviderID', 'ogName']], 'one mapping per (provider, group value). The key covers every' @@ -605,7 +605,7 @@ function methodBody($src, $method) . ' index is safe here and is deliberately absent from' . ' OIDCProviders' ], - 'FOG\Plugins\Oidc\OIDCUserGrantManager' => [ + 'FOG\Plugins\OIDC\Managers\OIDCUserGrantManager' => [ 'oidcUserGrant', [['ougUserID', 'ougTargetType', 'ougTargetID']], 'the sync rewrites a user\'s grants with plain INSERT IGNORE after' diff --git a/tests/oidc-profile-refresh.test.php b/tests/oidc-profile-refresh.test.php index b985c85..b14958a 100644 --- a/tests/oidc-profile-refresh.test.php +++ b/tests/oidc-profile-refresh.test.php @@ -27,7 +27,7 @@ * * Exit 0 = pass, 1 = fail. */ -$flow = dirname(__DIR__) . '/oidc/class/oidcflow.class.php'; +$flow = dirname(__DIR__) . '/oidc/src/Util/OIDCFlow.php'; if (!is_readable($flow)) { echo "cannot read $flow -- run this from the repository\n"; exit(1); diff --git a/tests/oidc-provider-safety.test.php b/tests/oidc-provider-safety.test.php index abf322f..c06708c 100644 --- a/tests/oidc-provider-safety.test.php +++ b/tests/oidc-provider-safety.test.php @@ -53,8 +53,8 @@ function _($s) require $root . '/tests/stubs/fog-stubs.php'; -require $root . '/oidc/class/oidc.class.php'; -require $root . '/oidc/class/oidcmanager.class.php'; +require $root . '/oidc/src/Items/OIDC.php'; +require $root . '/oidc/src/Managers/OIDCManager.php'; /** * Records a failure. @@ -107,7 +107,7 @@ function accepts(callable $fn, $what) // 1. The issuer. accepts( function () { - \FOG\Plugins\Oidc\OIDC::assertValidIssuer('https://login.example.com/realms/fog'); + \FOG\Plugins\OIDC\Items\OIDC::assertValidIssuer('https://login.example.com/realms/fog'); }, 'a plain https issuer' ); @@ -124,14 +124,14 @@ function () { foreach ($badIssuers as $issuer => $what) { refuses( function () use ($issuer) { - \FOG\Plugins\Oidc\OIDC::assertValidIssuer($issuer); + \FOG\Plugins\OIDC\Items\OIDC::assertValidIssuer($issuer); }, $what ); } refuses( function () { - \FOG\Plugins\Oidc\OIDC::assertValidIssuer('https://' . str_repeat('a', 250) . '.com'); + \FOG\Plugins\OIDC\Items\OIDC::assertValidIssuer('https://' . str_repeat('a', 250) . '.com'); }, 'an issuer too long for its column' ); @@ -146,7 +146,7 @@ function () { 'openid openid profile' => 'openid profile', ]; foreach ($scopeCases as $in => $want) { - $got = \FOG\Plugins\Oidc\OIDC::normalizeScopes($in); + $got = \FOG\Plugins\OIDC\Items\OIDC::normalizeScopes($in); if ($got !== $want) { fail( sprintf( @@ -163,14 +163,14 @@ function () { // matches nothing, so every login would be denied with no explanation. accepts( function () { - \FOG\Plugins\Oidc\OIDC::assertValidClaim('preferred_username', 'user claim'); + \FOG\Plugins\OIDC\Items\OIDC::assertValidClaim('preferred_username', 'user claim'); }, 'preferred_username' ); foreach (['', ' ', '-leading', str_repeat('a', 65)] as $claim) { refuses( function () use ($claim) { - \FOG\Plugins\Oidc\OIDC::assertValidClaim($claim, 'user claim'); + \FOG\Plugins\OIDC\Items\OIDC::assertValidClaim($claim, 'user claim'); }, 'claim name ' . var_export($claim, true) ); @@ -180,7 +180,7 @@ function () use ($claim) { // rules as the form. Checked by calling it, not by reading it. refuses( function () { - $o = new \FOG\Plugins\Oidc\OIDC(); + $o = new \FOG\Plugins\OIDC\Items\OIDC(); $o->set('issuer', 'http://idp.example.com') ->set('clientId', 'fog') ->set('userClaim', 'preferred_username') @@ -190,7 +190,7 @@ function () { ); refuses( function () { - $o = new \FOG\Plugins\Oidc\OIDC(); + $o = new \FOG\Plugins\OIDC\Items\OIDC(); $o->set('issuer', 'https://idp.example.com') ->set('clientId', '') ->set('userClaim', 'preferred_username') @@ -198,7 +198,7 @@ function () { }, 'save() with no client ID' ); -$saved = new \FOG\Plugins\Oidc\OIDC(); +$saved = new \FOG\Plugins\OIDC\Items\OIDC(); $saved->set('issuer', 'https://idp.example.com/realms/fog/') ->set('clientId', ' fog ') ->set('scopes', 'profile') @@ -220,7 +220,7 @@ function () { // 5. The column defaults, read out of what the manager asks Schema for. // Positional, because that is how Schema::createTable() is called. -(new \FOG\Plugins\Oidc\OIDCManager())->createSql(); +(new \FOG\Plugins\OIDC\Managers\OIDCManager())->createSql(); $call = \FOG\Items\Schema::$lastCall; if (count($call) < 7) { fail('OIDCManager::createSql() did not reach Schema::createTable()'); @@ -271,7 +271,7 @@ function () { // 6. The client secret: declared in the tier that is stripped from a single // GET too, kept out of the export, and never echoed back into the form. -$apiHook = (string)file_get_contents($root . '/oidc/hooks/addoidcapi.hook.php'); +$apiHook = (string)file_get_contents($root . '/oidc/src/Hooks/AddOIDCAPI.php'); if (false === strpos($apiHook, "\$arguments['always'][\$this->node][] = 'clientSecret'")) { fail( 'the client secret is not declared in the API_SENSITIVE_FIELDS ' @@ -282,7 +282,7 @@ function () { fail('the client secret is not stripped from the CSV export'); } $page = (string)file_get_contents( - $root . '/oidc/pages/oidcmanagement.page.php' + $root . '/oidc/src/Pages/OIDCManagement.php' ); if (false !== strpos($page, "\$get('clientSecret')")) { fail( @@ -308,10 +308,10 @@ function () { * than left to be rediscovered. Needs fogproject#1153. */ $declared = []; -if (property_exists('FOG\Plugins\Oidc\OIDC', 'databaseFieldsNotInt')) { - $notInt = new \ReflectionProperty('FOG\Plugins\Oidc\OIDC', 'databaseFieldsNotInt'); +if (property_exists('FOG\Plugins\OIDC\Items\OIDC', 'databaseFieldsNotInt')) { + $notInt = new \ReflectionProperty('FOG\Plugins\OIDC\Items\OIDC', 'databaseFieldsNotInt'); $notInt->setAccessible(true); - $declared = array_map('strtolower', (array)$notInt->getValue(new \FOG\Plugins\Oidc\OIDC())); + $declared = array_map('strtolower', (array)$notInt->getValue(new \FOG\Plugins\OIDC\Items\OIDC())); } if (!in_array('clientid', $declared, true)) { fail( diff --git a/tests/oidc-single-logout.test.php b/tests/oidc-single-logout.test.php index 2b33c59..d23ff1a 100644 --- a/tests/oidc-single-logout.test.php +++ b/tests/oidc-single-logout.test.php @@ -40,10 +40,10 @@ * Exit 0 = pass, 1 = fail. */ $root = dirname(__DIR__); -$flowFile = $root . '/oidc/class/oidcflow.class.php'; -$hookFile = $root . '/oidc/hooks/oidclogout.hook.php'; -$modelFile = $root . '/oidc/class/oidc.class.php'; -$mgrFile = $root . '/oidc/class/oidcmanager.class.php'; +$flowFile = $root . '/oidc/src/Util/OIDCFlow.php'; +$hookFile = $root . '/oidc/src/Hooks/OIDCLogout.php'; +$modelFile = $root . '/oidc/src/Items/OIDC.php'; +$mgrFile = $root . '/oidc/src/Managers/OIDCManager.php'; foreach ([$flowFile, $hookFile, $modelFile, $mgrFile] as $f) { if (!is_readable($f)) { echo "cannot read $f -- run this from the repository\n"; diff --git a/tests/plugin-id-columns-are-classified.test.php b/tests/plugin-id-columns-are-classified.test.php index 522198f..e551c45 100644 --- a/tests/plugin-id-columns-are-classified.test.php +++ b/tests/plugin-id-columns-are-classified.test.php @@ -123,13 +123,19 @@ function idStrip($file) new RecursiveDirectoryIterator($root) ); foreach ($iterator as $file) { - if (!preg_match('/manager\.class\.php$/', $file->getFilename())) { + if (!$file->isFile() || strtolower($file->getExtension()) !== 'php') { continue; } $path = $file->getPathname(); if (false !== strpos($path, '/tests/')) { continue; } + // Managers live at /src/Managers/.php under the PSR-4 + // layout (tests/plugin-layout.test.php) -- the bucket directory is what + // that layout guarantees, not any filename suffix. + if (basename(dirname($path)) !== 'Managers') { + continue; + } $src = idStrip($path); if (false === strpos($src, 'createTableSql(')) { continue; diff --git a/tests/plugin-layout.test.php b/tests/plugin-layout.test.php new file mode 100644 index 0000000..143d9f3 --- /dev/null +++ b/tests/plugin-layout.test.php @@ -0,0 +1,229 @@ +/src//.php declares + * namespace FOG\Plugins\\; class + * + * strtolower() === + * + * That is the whole contract, and it is the same one `packages/web/src/` + * follows in fogproject: `src/Pages/HostManagement.php` declares + * `FOG\Pages\HostManagement`. Core discovers its own classes by walking a + * bucket directory (`FOGBase::coreitems()`), and since this layout landed it + * discovers a plugin's the same way -- so a file in the wrong place is not a + * style complaint, it is a hook that never registers or a page that 404s. + * + * The second half is what lets the autoloader DERIVE a path from a class name + * instead of scanning every file to read its namespace. `FOG\Plugins\LDAP\ + * Managers\LDAPManager` is `/ldap/src/Managers/LDAPManager.php` and + * nothing has to be read to know it. That derivation is only sound while + * strtolower(Segment) matches the directory, which is why it is asserted here + * rather than assumed: the directory name is also plugins.pName, the ?node= + * value and the `ldap.view` permission string, so it cannot move, and the + * segment is free to read properly (`LDAP`, not `Ldap`). + * + * WHAT COUNTS AS A PLUGIN DIRECTORY: deliberately not a hardcoded list, for + * the reason core-references-are-qualified.test.php gives for not hardcoding + * core's class list -- this repository is fetched on its own and a list here + * would drift. Every top-level directory except the tooling ones is a plugin. + * + * Case-SENSITIVE on the class name, unlike the namespace gate this replaces. + * PHP does not care, but the derivation above does: on a case-sensitive + * filesystem `LDAPManager.php` and `Ldapmanager.php` are different files, and + * only one of them is the one core will open. + * + * Also asserted: no `class_alias()` (ADR 0013 §2 retired it from core and a + * plugin does not get to reintroduce it), and no leftover pre-1.6 directory + * -- `class/`, `pages/`, `hooks/`, `events/`, `reports/`, `tasks/`, + * `reg-task/` are all gone, so a half-migrated plugin fails loudly here + * rather than half-loading on a server. + * + * Usage: php tests/plugin-layout.test.php + * Exit status 0 = pass, 1 = fail. + */ + +$root = dirname(__DIR__); + +// A floor, and the reason this file is a rewrite rather than an edit. The +// gate it replaces matched on the six discovery suffixes with no minimum, so +// the moment those filenames went away it matched nothing, printed +// "ok: 0 plugin class file(s)" and exited 0 -- green, and testing nothing. +const MIN_FILES = 150; +const MIN_PLUGINS = 14; + +const LEGACY_DIRS = [ + 'class', 'pages', 'hooks', 'events', 'reports', 'tasks', 'reg-task', +]; + +$tooling = ['tests', 'bin', '.git', '.github']; + +$failures = []; +$checked = 0; +$plugins = 0; + +foreach (scandir($root) as $entry) { + if ($entry[0] === '.' || in_array($entry, $tooling, true)) { + continue; + } + $pdir = $root . '/' . $entry; + if (!is_dir($pdir)) { + continue; + } + $plugins++; + + foreach (LEGACY_DIRS as $legacy) { + if (is_dir($pdir . '/' . $legacy)) { + $failures[] = sprintf( + '%s/%s/ still exists -- pre-1.6 layout, its classes are ' + . 'invisible to core', + $entry, + $legacy + ); + } + } + + $srcDir = $pdir . '/src'; + if (!is_dir($srcDir)) { + // persistentgroups is models only and capone has no tasks, but every + // plugin has SOMETHING, so an absent src/ is a broken plugin. + $failures[] = sprintf('%s has no src/ directory', $entry); + continue; + } + + $it = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($srcDir, FilesystemIterator::SKIP_DOTS) + ); + foreach ($it as $f) { + if (!$f->isFile() || strtolower($f->getExtension()) !== 'php') { + continue; + } + $path = $f->getPathname(); + $rel = substr($path, strlen($root) + 1); + $checked++; + + $bucket = basename(dirname($path)); + $class = $f->getBasename('.php'); + $src = (string) file_get_contents($path); + + // Depth: exactly /src//.php. A file directly + // in src/, or nested a level deeper, has no derivable namespace. + if (dirname(dirname($path)) !== $srcDir) { + $failures[] = sprintf( + '%s is not /src//.php', + $rel + ); + continue; + } + + preg_match_all('#^namespace\s+([^;]+);#m', $src, $nsAll); + if (count($nsAll[1]) !== 1) { + $failures[] = sprintf( + '%s declares %d namespaces, expected exactly 1', + $rel, + count($nsAll[1]) + ); + continue; + } + $ns = trim($nsAll[1][0]); + + $parts = explode('\\', $ns); + if (count($parts) !== 4 + || $parts[0] !== 'FOG' + || $parts[1] !== 'Plugins' + ) { + $failures[] = sprintf( + '%s declares %s, expected FOG\\Plugins\\\\', + $rel, + $ns + ); + continue; + } + list(, , $segment, $nsBucket) = $parts; + + if (strtolower($segment) !== $entry) { + $failures[] = sprintf( + '%s: namespace segment %s does not lowercase to the plugin ' + . 'directory %s -- the autoloader derives the path from it', + $rel, + $segment, + $entry + ); + } + if ($nsBucket !== $bucket) { + $failures[] = sprintf( + '%s: namespace says bucket %s, path says %s', + $rel, + $nsBucket, + $bucket + ); + } + + preg_match_all( + '#^\s*(?:final\s+|abstract\s+)*(?:class|interface|trait)\s+' + . '([A-Za-z0-9_]+)#m', + $src, + $decl + ); + if (count($decl[1]) !== 1) { + $failures[] = sprintf( + '%s declares %d classes, expected exactly 1', + $rel, + count($decl[1]) + ); + continue; + } + if ($decl[1][0] !== $class) { + $failures[] = sprintf( + '%s declares %s -- the file name and the class name must ' + . 'match exactly, including case', + $rel, + $decl[1][0] + ); + } + + if (strpos($src, 'class_alias') !== false) { + $failures[] = sprintf( + '%s calls class_alias() -- retired with ADR 0013 §2', + $rel + ); + } + } +} + +if ($checked < MIN_FILES || $plugins < MIN_PLUGINS) { + fwrite( + STDERR, + sprintf( + "FAIL: walked %d file(s) in %d plugin(s); expected at least " + . "%d and %d -- the walk is broken, not the tree\n", + $checked, + $plugins, + MIN_FILES, + MIN_PLUGINS + ) + ); + exit(1); +} + +if ($failures) { + fwrite(STDERR, sprintf("FAIL: %d problem(s)\n", count($failures))); + foreach ($failures as $f) { + fwrite(STDERR, " - $f\n"); + } + exit(1); +} + +fwrite( + STDOUT, + sprintf( + "ok %d class file(s) across %d plugins, all PSR-4\n", + $checked, + $plugins + ) +); +exit(0); diff --git a/tests/plugins-are-namespaced.test.php b/tests/plugins-are-namespaced.test.php deleted file mode 100644 index 6ced737..0000000 --- a/tests/plugins-are-namespaced.test.php +++ /dev/null @@ -1,216 +0,0 @@ -//..php` declares - * `namespace FOG\Plugins\;` -- ucfirst() of - * the plugin's directory name, nothing else. The subdirectory (class/, - * pages/, hooks/, events/, reports/, tasks/, or an odd one like capone's - * reg-task/) is not part of it; every class in a plugin shares one flat - * namespace. - * - * This mirrors core's own rule (fogproject's PSR-4 buckets) closely enough - * that a plugin author can lean on the same instinct, but plugins are NOT - * PSR-4 mapped -- there is no composer.json or autoloader config here to - * enforce it structurally, so a gate is the only thing that catches a new - * plugin file landing bare or a copy-pasted file carrying its donor's - * namespace. - * - * WHAT COUNTS AS A CLASS FILE: the same six extensions the fetch/deploy - * tooling already treats as plugin source -- *.class.php, *.hook.php, - * *.page.php, *.event.php, *.report.php, *.task.php -- found anywhere under - * a plugin directory, subdirectory name irrelevant. config/plugin.config.php - * (a $fog_plugin array, no class) is deliberately excluded by extension - * alone, not by name, so a plugin that ever adds a second config-shaped file - * is not silently exempted. - * - * WHAT COUNTS AS A "PLUGIN DIRECTORY": deliberately NOT a hardcoded list, - * for the same reason core-references-are-qualified.test.php gives for not - * hardcoding core's class list -- this repository is fetched on its own - * (bin/fetch-plugins.sh) and a list here would drift as plugins are added or - * removed. Every top-level directory except the tooling ones (tests/, bin/, - * .github/, .git/) is treated as a plugin directory, matching how the repo - * is actually laid out (see README.md / bin/fetch-plugins.sh). - * - * The namespace comparison is case-INSENSITIVE, deliberately -- PHP - * namespaces are themselves case-insensitive, and a third-party plugin - * author may reasonably spell a namespace segment differently from a strict - * ucfirst() of their directory name (e.g. `MyPlugin` for directory - * `myplugin`). Getting the case slightly "wrong" is not the bug this gate - * exists to catch; declaring no namespace, the WRONG plugin's namespace, or - * more than one namespace is. - * - * Also asserted, same rule as core: no plugin file may declare - * class_alias() -- the compatibility mechanism ADR 0013 §2 is retiring from - * core is not something a plugin gets to reintroduce on its own. - * - * Usage: php tests/plugins-are-namespaced.test.php - * Exit status 0 = pass, 1 = fail. - * - * PHP version 7.4+ - * - * @category Tests - * @package FOGProject - * @author Tom Elliott - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link https://fogproject.org - */ - -$root = dirname(__DIR__); -$fails = []; -$checked = 0; - -$skipTopLevel = ['tests', 'bin', '.github', '.git']; - -$pluginDirs = []; -foreach (scandir($root) as $entry) { - if ('.' === $entry || '..' === $entry) { - continue; - } - if (in_array($entry, $skipTopLevel, true)) { - continue; - } - if (!is_dir($root . '/' . $entry)) { - continue; - } - $pluginDirs[] = $entry; -} -sort($pluginDirs); - -/** - * Every `namespace ...;` declaration in a file, and every class_alias() - * call, found by walking the token stream rather than by regex -- a - * docblock or a string literal can contain the word "namespace" or - * "class_alias" without either being code. - * - * @param string $path file to scan - * - * @return array{namespaces: string[], hasClassAlias: bool} - */ -function scanFile($path) -{ - $namespaces = []; - $hasClassAlias = false; - $tokens = token_get_all(file_get_contents($path)); - $count = count($tokens); - for ($i = 0; $i < $count; $i++) { - if (!is_array($tokens[$i])) { - continue; - } - if (T_NAMESPACE === $tokens[$i][0]) { - // PHP 8 folds FOG\Plugins\Ldap into a single T_NAME_QUALIFIED - // token; 7.4 emits T_STRING/T_NS_SEPARATOR per segment. Handle - // both, same reasoning as core-references-are-qualified's - // T_NAME_FULLY_QUALIFIED handling for FQCNs. - $name = ''; - for ($j = $i + 1; $j < $count; $j++) { - if (is_array($tokens[$j]) - && in_array( - $tokens[$j][0], - array_filter([ - T_STRING, - T_NS_SEPARATOR, - defined('T_NAME_QUALIFIED') ? T_NAME_QUALIFIED : null, - ], static function ($t) { - return null !== $t; - }), - true - ) - ) { - $name .= $tokens[$j][1]; - continue; - } - if (is_array($tokens[$j]) && T_WHITESPACE === $tokens[$j][0]) { - continue; - } - break; - } - $namespaces[] = $name; - continue; - } - if (T_STRING === $tokens[$i][0] - && 0 === strcasecmp($tokens[$i][1], 'class_alias') - ) { - for ($j = $i + 1; $j < $count; $j++) { - if (is_array($tokens[$j]) && T_WHITESPACE === $tokens[$j][0]) { - continue; - } - if ('(' === $tokens[$j]) { - $hasClassAlias = true; - } - break; - } - } - } - return ['namespaces' => $namespaces, 'hasClassAlias' => $hasClassAlias]; -} - -foreach ($pluginDirs as $dir) { - $expected = 'fog\\plugins\\' . strtolower(ucfirst($dir)); - $walk = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($root . '/' . $dir) - ); - foreach ($walk as $file) { - $path = $file->getPathname(); - if (!$file->isFile()) { - continue; - } - if (!preg_match( - '/\.(class|hook|page|event|report|task)\.php$/', - $path - )) { - continue; - } - $rel = str_replace($root . '/', '', $path); - $checked++; - $scan = scanFile($path); - - if (0 === count($scan['namespaces'])) { - $fails[] = "$rel: declares no namespace (expected $expected)"; - continue; - } - if (count($scan['namespaces']) > 1) { - $fails[] = sprintf( - '%s: declares %d namespaces (%s), expected exactly one (%s)', - $rel, - count($scan['namespaces']), - implode(', ', $scan['namespaces']), - $expected - ); - continue; - } - $actual = strtolower($scan['namespaces'][0]); - if ($actual !== $expected) { - $fails[] = sprintf( - "%s: declares namespace '%s', expected '%s' (case-insensitive)", - $rel, - $scan['namespaces'][0], - $expected - ); - } - if ($scan['hasClassAlias']) { - $fails[] = "$rel: declares class_alias() -- not permitted in a " - . 'namespaced plugin (fogproject ADR 0013 §2)'; - } - } -} - -if (count($fails)) { - fwrite(STDERR, 'FAIL:' . PHP_EOL); - foreach (array_slice($fails, 0, 25) as $fail) { - fwrite(STDERR, " - $fail\n"); - } - if (count($fails) > 25) { - fwrite(STDERR, ' ... and ' . (count($fails) - 25) . " more\n"); - } - exit(1); -} - -printf( - "ok: %d plugin class file(s) across %d plugin director(ies), each " - . "namespaced FOG\\Plugins\\ with no class_alias()\n", - $checked, - count($pluginDirs) -); -exit(0); diff --git a/tests/references-resolve.test.php b/tests/references-resolve.test.php new file mode 100644 index 0000000..994262b --- /dev/null +++ b/tests/references-resolve.test.php @@ -0,0 +1,278 @@ +isFile() && strtolower($f->getExtension()) === 'php') { + $coreShort[strtolower($f->getBasename('.php'))] = true; + } + } +} + +/** Every class this tree declares, as lowercased FQCN. */ +$declared = []; +$files = []; +$it = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS) +); +foreach ($it as $f) { + $path = $f->getPathname(); + if (!$f->isFile() || strtolower($f->getExtension()) !== 'php') { + continue; + } + foreach (['/tests/', '/bin/', '/.git/', '/vendor/'] as $skip) { + if (strpos($path, $skip) !== false) { + continue 2; + } + } + $src = (string) file_get_contents($path); + if (!preg_match('#^namespace\s+([^;]+);#m', $src, $m)) { + continue; // config/plugin.config.php and index.php declare nothing + } + $ns = trim($m[1]); + if (!preg_match( + '#^\s*(?:final\s+|abstract\s+)*(?:class|interface|trait)\s+' + . '([A-Za-z0-9_]+)#m', + $src, + $c + )) { + continue; + } + $declared[strtolower($ns . '\\' . $c[1])] = true; + $files[] = [$path, $ns, $src]; +} + +$failures = []; + +foreach ($files as list($path, $ns, $src)) { + $rel = substr($path, strlen($root) + 1); + $tokens = token_get_all($src); + $n = count($tokens); + + // `use A\B\C;` and `use A\B\C as D;` -- the short name this file can say. + $imports = []; + for ($i = 0; $i < $n; $i++) { + if (!is_array($tokens[$i]) || $tokens[$i][0] !== T_USE) { + continue; + } + // A closure's `use ($x)` is not an import. + $j = $i + 1; + while ($j < $n && is_array($tokens[$j]) + && $tokens[$j][0] === T_WHITESPACE + ) { + $j++; + } + if ($j < $n && $tokens[$j] === '(') { + continue; + } + $buf = ''; + for (; $j < $n; $j++) { + if ($tokens[$j] === ';' || $tokens[$j] === '{') { + break; + } + $buf .= is_array($tokens[$j]) ? $tokens[$j][1] : $tokens[$j]; + } + $buf = trim($buf); + if ($buf === '' || strpos($buf, '\\') === false) { + continue; // a trait `use`, not an import + } + if (preg_match('#^(.+?)\s+as\s+([A-Za-z0-9_]+)$#i', $buf, $a)) { + $imports[strtolower($a[2])] = trim($a[1]); + continue; + } + $parts = explode('\\', $buf); + $imports[strtolower(end($parts))] = $buf; + } + + for ($i = 0; $i < $n; $i++) { + $t = $tokens[$i]; + if (!is_array($t) || $t[0] !== T_STRING) { + continue; + } + $name = $t[1]; + $lower = strtolower($name); + + // Preceding significant token decides whether this is a class + // reference at all. + for ($p = $i - 1; $p >= 0; $p--) { + if (is_array($tokens[$p]) + && in_array( + $tokens[$p][0], + [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT], + true + ) + ) { + continue; + } + break; + } + $prev = $p >= 0 ? $tokens[$p] : null; + if (is_array($prev) + && in_array( + $prev[0], + [ + T_OBJECT_OPERATOR, T_DOUBLE_COLON, T_FUNCTION, T_CONST, + T_NS_SEPARATOR, T_USE, T_NAMESPACE, T_CLASS, T_INTERFACE, + T_TRAIT, T_GOTO, + ], + true + ) + ) { + continue; + } + if ($prev === '$') { + continue; + } + + // Following token tells a class reference from a plain function call. + for ($q = $i + 1; $q < $n; $q++) { + if (is_array($tokens[$q]) && $tokens[$q][0] === T_WHITESPACE) { + continue; + } + break; + } + $next = $q < $n ? $tokens[$q] : null; + $isClassRef = false; + if (is_array($next) && $next[0] === T_DOUBLE_COLON) { + $isClassRef = true; // Foo::BAR + } + if (is_array($prev) + && in_array($prev[0], [T_NEW, T_EXTENDS, T_IMPLEMENTS, T_INSTANCEOF], true) + ) { + $isClassRef = true; + } + if (!$isClassRef) { + continue; + } + + // Now resolve it the way PHP would. + if (isset($imports[$lower])) { + continue; + } + if (isset($declared[strtolower($ns . '\\' . $name)])) { + continue; + } + if (isset($builtin[$lower])) { + continue; + } + // `self`, `static`, `parent` reach here as T_STRING on some versions. + if (in_array($lower, ['self', 'static', 'parent'], true)) { + continue; + } + // A core class named bare is the OTHER gate's business + // (core-references-are-qualified), and it reports it far better than + // a duplicate complaint here would. + if (isset($coreShort[$lower])) { + continue; + } + $failures[] = sprintf( + '%s:%d %s does not resolve from namespace %s ' + . '(add: use ;)', + $rel, + $t[2], + $name, + $ns + ); + } +} + +if (count($files) < MIN_FILES) { + fwrite( + STDERR, + sprintf( + "FAIL: only %d class file(s) found, expected at least %d -- the " + . "walk is broken, not the tree\n", + count($files), + MIN_FILES + ) + ); + exit(1); +} + +if ($failures) { + fwrite( + STDERR, + sprintf("FAIL: %d unresolvable reference(s)\n", count($failures)) + ); + foreach ($failures as $f) { + fwrite(STDERR, " - $f\n"); + } + exit(1); +} + +fwrite( + STDOUT, + sprintf( + "ok %d class file(s), every bare reference resolves\n", + count($files) + ) +); +exit(0); diff --git a/tests/report-titles-are-registered.test.php b/tests/report-titles-are-registered.test.php index 5d783b5..9df4130 100644 --- a/tests/report-titles-are-registered.test.php +++ b/tests/report-titles-are-registered.test.php @@ -5,9 +5,9 @@ * TWO SILENT FAILURES, one gate. * * The label. fogproject's report menu builds an entry per file under - * `/reports/`, and if nothing names that report the label is - * `ucwords()` of the FILE name -- so `ou_report.report.php` appears as - * "Ou Report" while the page it opens is headed "Export OUs". Two names for + * `/src/Reports/`, and if nothing names that report the label is + * `ucwords()` of the FILE name -- so `OU_Report.php` appears as + * "OU Report" while the page it opens is headed "Export OUs". Two names for * one screen. `REPORT_TITLE_DATA` is the seam that fixes it, and the key it * takes has to agree with THREE other things: the file name, the class name * (core derives the report's own heading from it) and the base64 `f` @@ -63,12 +63,14 @@ function reportKey($name) return strtolower(str_replace('_', ' ', $name)); } -$reports = glob($root . '/*/reports/*.report.php'); +// Reports live at /src/Reports/.php under the PSR-4 layout +// (tests/plugin-layout.test.php); the file's basename IS the class name. +$reports = glob($root . '/*/src/Reports/*.php'); check('there are plugin reports to check', count($reports) > 4); foreach ($reports as $path) { - $plugin = basename(dirname(dirname($path))); - $base = basename($path, '.report.php'); + $plugin = basename(dirname(dirname(dirname($path)))); + $base = basename($path, '.php'); $key = reportKey($base); $src = (string) file_get_contents($path); $name = $plugin . '/' . basename($path); @@ -125,7 +127,7 @@ function reportKey($name) // that does not match the file is the silent fallback again. $registered = false; $named = false; - foreach ((array) glob($root . '/' . $plugin . '/hooks/*.hook.php') as $hook) { + foreach ((array) glob($root . '/' . $plugin . '/src/Hooks/*.php') as $hook) { $h = (string) file_get_contents($hook); if (false !== strpos($h, "'REPORT_TITLE_DATA'")) { $registered = true; diff --git a/tests/tables-carry-column-defaults.test.php b/tests/tables-carry-column-defaults.test.php index e49590c..b17f7f7 100644 --- a/tests/tables-carry-column-defaults.test.php +++ b/tests/tables-carry-column-defaults.test.php @@ -123,7 +123,7 @@ function tcCheck($ok, $message) $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root)); foreach ($it as $file) { $path = $file->getPathname(); - if (!preg_match('/manager\.class\.php$/', $file->getFilename())) { + if (!$file->isFile() || strtolower($file->getExtension()) !== 'php') { continue; } if (false !== strpos($path, '/tests/') @@ -131,6 +131,12 @@ function tcCheck($ok, $message) ) { continue; } + // Managers live at /src/Managers/.php under the PSR-4 + // layout (tests/plugin-layout.test.php) -- the bucket directory is what + // that layout guarantees, not any filename suffix. + if (basename(dirname($path)) !== 'Managers') { + continue; + } $managers[] = $path; } sort($managers); @@ -181,9 +187,9 @@ function tcCheck($ok, $message) // manager (an association table, a sub-table) is reached as a STEP inside // that one's schema(), by design. Requiring schema() of every manager // flags eleven files that are correct. - $plugin = basename(dirname(dirname($path))); + $plugin = basename(dirname(dirname(dirname($path)))); $isOwnManager = strtolower(basename($path)) - === strtolower($plugin) . 'manager.class.php'; + === strtolower($plugin) . 'manager.php'; if ($isOwnManager) { tcCheck( false !== strpos($src, 'function schema('), diff --git a/windowskey/hooks/addwindowskeyimage.hook.php b/windowskey/src/Hooks/AddWindowsKeyImage.php similarity index 99% rename from windowskey/hooks/addwindowskeyimage.hook.php rename to windowskey/src/Hooks/AddWindowsKeyImage.php index 01a2d61..e61b2ec 100644 --- a/windowskey/hooks/addwindowskeyimage.hook.php +++ b/windowskey/src/Hooks/AddWindowsKeyImage.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Adds the windows keys choice to image. diff --git a/windowskey/hooks/addwindowskeyjs.hook.php b/windowskey/src/Hooks/AddWindowsKeyJS.php similarity index 97% rename from windowskey/hooks/addwindowskeyjs.hook.php rename to windowskey/src/Hooks/AddWindowsKeyJS.php index 93bb7cf..97447a3 100644 --- a/windowskey/hooks/addwindowskeyjs.hook.php +++ b/windowskey/src/Hooks/AddWindowsKeyJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/windowskey/hooks/addwindowskeymenuitem.hook.php b/windowskey/src/Hooks/AddWindowsKeyMenuItem.php similarity index 99% rename from windowskey/hooks/addwindowskeymenuitem.hook.php rename to windowskey/src/Hooks/AddWindowsKeyMenuItem.php index 8c45f2b..7bc6a06 100644 --- a/windowskey/hooks/addwindowskeymenuitem.hook.php +++ b/windowskey/src/Hooks/AddWindowsKeyMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Adds the windows keys menu item. diff --git a/windowskey/hooks/addwindowskeyapi.hook.php b/windowskey/src/Hooks/AddWindowskeyAPI.php similarity index 98% rename from windowskey/hooks/addwindowskeyapi.hook.php rename to windowskey/src/Hooks/AddWindowskeyAPI.php index b186079..8163038 100644 --- a/windowskey/hooks/addwindowskeyapi.hook.php +++ b/windowskey/src/Hooks/AddWindowskeyAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Injects windows key stuff into the api system. diff --git a/windowskey/hooks/changehostkey.hook.php b/windowskey/src/Hooks/ChangeHostKey.php similarity index 98% rename from windowskey/hooks/changehostkey.hook.php rename to windowskey/src/Hooks/ChangeHostKey.php index ec8b51d..1ac7a86 100644 --- a/windowskey/hooks/changehostkey.hook.php +++ b/windowskey/src/Hooks/ChangeHostKey.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Adds the windows key in the image to the host on diff --git a/windowskey/hooks/windowskeydeletemassitems.hook.php b/windowskey/src/Hooks/WindowsKeyDeleteMassItems.php similarity index 98% rename from windowskey/hooks/windowskeydeletemassitems.hook.php rename to windowskey/src/Hooks/WindowsKeyDeleteMassItems.php index 8803e69..3facf54 100644 --- a/windowskey/hooks/windowskeydeletemassitems.hook.php +++ b/windowskey/src/Hooks/WindowsKeyDeleteMassItems.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Hooks; /** * Deletes the WindowsKey the elements en-mass. diff --git a/windowskey/class/windowskey.class.php b/windowskey/src/Items/WindowsKey.php similarity index 98% rename from windowskey/class/windowskey.class.php rename to windowskey/src/Items/WindowsKey.php index c22e659..40162e9 100644 --- a/windowskey/class/windowskey.class.php +++ b/windowskey/src/Items/WindowsKey.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Items; /** * The Windows Keys class. diff --git a/windowskey/class/windowskeyassociation.class.php b/windowskey/src/Items/WindowsKeyAssociation.php similarity index 97% rename from windowskey/class/windowskeyassociation.class.php rename to windowskey/src/Items/WindowsKeyAssociation.php index 9e14378..3993a5f 100644 --- a/windowskey/class/windowskeyassociation.class.php +++ b/windowskey/src/Items/WindowsKeyAssociation.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Items; /** * The association between images and windows keys. diff --git a/windowskey/class/windowskeyassociationmanager.class.php b/windowskey/src/Managers/WindowsKeyAssociationManager.php similarity index 97% rename from windowskey/class/windowskeyassociationmanager.class.php rename to windowskey/src/Managers/WindowsKeyAssociationManager.php index 81b630c..c5e6271 100644 --- a/windowskey/class/windowskeyassociationmanager.class.php +++ b/windowskey/src/Managers/WindowsKeyAssociationManager.php @@ -12,7 +12,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Managers; /** * Windows keys association manager class. diff --git a/windowskey/class/windowskeymanager.class.php b/windowskey/src/Managers/WindowsKeyManager.php similarity index 99% rename from windowskey/class/windowskeymanager.class.php rename to windowskey/src/Managers/WindowsKeyManager.php index ed50917..5c7c8c1 100644 --- a/windowskey/class/windowskeymanager.class.php +++ b/windowskey/src/Managers/WindowsKeyManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Managers; /** * Windows Key manager mass management class diff --git a/windowskey/pages/windowskeymanagement.page.php b/windowskey/src/Pages/WindowsKeyManagement.php similarity index 99% rename from windowskey/pages/windowskeymanagement.page.php rename to windowskey/src/Pages/WindowsKeyManagement.php index 2a19609..b5f573a 100644 --- a/windowskey/pages/windowskeymanagement.page.php +++ b/windowskey/src/Pages/WindowsKeyManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Pages; /** * Windows Keys management page. diff --git a/windowskey/reports/windowskey_report.report.php b/windowskey/src/Reports/WindowsKey_Report.php similarity index 97% rename from windowskey/reports/windowskey_report.report.php rename to windowskey/src/Reports/WindowsKey_Report.php index a935f68..e70c055 100644 --- a/windowskey/reports/windowskey_report.report.php +++ b/windowskey/src/Reports/WindowsKey_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Windowskey; +namespace FOG\Plugins\WindowsKey\Reports; /** * Windows Key report. diff --git a/wolbroadcast/hooks/addbroadcastaddresses.hook.php b/wolbroadcast/src/Hooks/AddBroadcastAddresses.php similarity index 97% rename from wolbroadcast/hooks/addbroadcastaddresses.hook.php rename to wolbroadcast/src/Hooks/AddBroadcastAddresses.php index e8ae5ba..3159249 100644 --- a/wolbroadcast/hooks/addbroadcastaddresses.hook.php +++ b/wolbroadcast/src/Hooks/AddBroadcastAddresses.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Hooks; /** * Adds Broadcast addresses to wol info. diff --git a/wolbroadcast/hooks/addwolbroadcastapi.hook.php b/wolbroadcast/src/Hooks/AddWOLBroadcastAPI.php similarity index 97% rename from wolbroadcast/hooks/addwolbroadcastapi.hook.php rename to wolbroadcast/src/Hooks/AddWOLBroadcastAPI.php index edde2c8..2be39f4 100644 --- a/wolbroadcast/hooks/addwolbroadcastapi.hook.php +++ b/wolbroadcast/src/Hooks/AddWOLBroadcastAPI.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Hooks; /** * Injects wol broadcast stuff into the api system. diff --git a/wolbroadcast/hooks/addwolbroadcastjs.hook.php b/wolbroadcast/src/Hooks/AddWOLBroadcastJS.php similarity index 97% rename from wolbroadcast/hooks/addwolbroadcastjs.hook.php rename to wolbroadcast/src/Hooks/AddWOLBroadcastJS.php index d37ab56..3279195 100644 --- a/wolbroadcast/hooks/addwolbroadcastjs.hook.php +++ b/wolbroadcast/src/Hooks/AddWOLBroadcastJS.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Hooks; /** * Sets the javascript files up for this plugin. diff --git a/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php b/wolbroadcast/src/Hooks/AddWOLBroadcastMenuItem.php similarity index 98% rename from wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php rename to wolbroadcast/src/Hooks/AddWOLBroadcastMenuItem.php index 6930edc..4cfabd9 100644 --- a/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php +++ b/wolbroadcast/src/Hooks/AddWOLBroadcastMenuItem.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Hooks; /** * Adds the wol menu item. diff --git a/wolbroadcast/hooks/addwolbroadcasttype.hook.php b/wolbroadcast/src/Hooks/AddWOLBroadcastType.php similarity index 96% rename from wolbroadcast/hooks/addwolbroadcasttype.hook.php rename to wolbroadcast/src/Hooks/AddWOLBroadcastType.php index b9774ff..3895456 100644 --- a/wolbroadcast/hooks/addwolbroadcasttype.hook.php +++ b/wolbroadcast/src/Hooks/AddWOLBroadcastType.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Hooks; /** * Adds Broadcast type for export. diff --git a/wolbroadcast/class/wolbroadcast.class.php b/wolbroadcast/src/Items/Wolbroadcast.php similarity index 96% rename from wolbroadcast/class/wolbroadcast.class.php rename to wolbroadcast/src/Items/Wolbroadcast.php index b461f5c..d6c7cce 100644 --- a/wolbroadcast/class/wolbroadcast.class.php +++ b/wolbroadcast/src/Items/Wolbroadcast.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Items; /** * Wolbroadcast Class handler. diff --git a/wolbroadcast/class/wolbroadcastmanager.class.php b/wolbroadcast/src/Managers/WolbroadcastManager.php similarity index 98% rename from wolbroadcast/class/wolbroadcastmanager.class.php rename to wolbroadcast/src/Managers/WolbroadcastManager.php index c45b5bd..a91ef7d 100644 --- a/wolbroadcast/class/wolbroadcastmanager.class.php +++ b/wolbroadcast/src/Managers/WolbroadcastManager.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Managers; /** * Manager class for wolbroadcast diff --git a/wolbroadcast/pages/wolbroadcastmanagement.page.php b/wolbroadcast/src/Pages/WOLBroadcastManagement.php similarity index 99% rename from wolbroadcast/pages/wolbroadcastmanagement.page.php rename to wolbroadcast/src/Pages/WOLBroadcastManagement.php index 874db36..8257b75 100644 --- a/wolbroadcast/pages/wolbroadcastmanagement.page.php +++ b/wolbroadcast/src/Pages/WOLBroadcastManagement.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Pages; /** * The wol broadcast page. diff --git a/wolbroadcast/reports/wolbroadcast_report.report.php b/wolbroadcast/src/Reports/Wolbroadcast_Report.php similarity index 97% rename from wolbroadcast/reports/wolbroadcast_report.report.php rename to wolbroadcast/src/Reports/Wolbroadcast_Report.php index f284135..e61259d 100644 --- a/wolbroadcast/reports/wolbroadcast_report.report.php +++ b/wolbroadcast/src/Reports/Wolbroadcast_Report.php @@ -11,7 +11,7 @@ * @link https://fogproject.org */ -namespace FOG\Plugins\Wolbroadcast; +namespace FOG\Plugins\WOLBroadcast\Reports; /** * WOL Broadcast report.