Skip to content

Commit

Permalink
Improves performance in BackwardCompatibility trait.
Browse files Browse the repository at this point in the history
This gets rid of all use of Reflection classes inside the BackwardCompatibility trait, which greatly improves performance. However, this also means that static methods must now be named explicitly in the class's $backcompat property in order to be exported as global functions. (Previously, public static methods were exported automatically unless specifically excluded.)

Signed-off-by: Jon Stovell <[email protected]>
  • Loading branch information
Sesquipedalian committed Nov 11, 2023
1 parent e480459 commit e1559de
Show file tree
Hide file tree
Showing 165 changed files with 633 additions and 432 deletions.
1 change: 0 additions & 1 deletion Sources/Actions/Activate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Activate implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'Activate',
),
);
Expand Down
9 changes: 8 additions & 1 deletion Sources/Actions/Admin/ACP.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ class ACP implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'AdminMain',
'prepareDBSettingContext' => 'prepareDBSettingContext',
'saveSettings' => 'saveSettings',
'saveDBSettings' => 'saveDBSettings',
'getServerVersions' => 'getServerVersions',
'getFileVersions' => 'getFileVersions',
'updateAdminPreferences' => 'updateAdminPreferences',
'emailAdmins' => 'emailAdmins',
'adminLogin' => 'adminLogin',
),
);

Expand Down
4 changes: 1 addition & 3 deletions Sources/Actions/Admin/AntiSpam.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ class AntiSpam implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => false,
'getConfigVars' => false,
'modifyAntispamSettings' => 'ModifyAntispamSettings',
),
);

Expand Down
19 changes: 16 additions & 3 deletions Sources/Actions/Admin/Attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,23 @@ class Attachments implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageAttachments',
'attachConfigVars' => false,
'avatarConfigVars' => false,
'list_getFiles' => 'list_getFiles',
'list_getNumFiles' => 'list_getNumFiles',
'list_getAttachDirs' => 'list_getAttachDirs',
'list_getBaseDirs' => 'list_getBaseDirs',
'attachDirStatus' => 'attachDirStatus',
'manageAttachmentSettings' => 'ManageAttachmentSettings',
'manageAvatarSettings' => 'ManageAvatarSettings',
'browseFiles' => 'BrowseFiles',
'maintainFiles' => 'MaintainFiles',
'removeAttachment' => 'RemoveAttachment',
'removeAttachmentByAge' => 'RemoveAttachmentByAge',
'removeAttachmentBySize' => 'RemoveAttachmentBySize',
'removeAllAttachments' => 'RemoveAllAttachments',
'repairAttachments' => 'RepairAttachments',
'manageAttachmentPaths' => 'ManageAttachmentPaths',
'transferAttachments' => 'TransferAttachments',
),
);

Expand Down
15 changes: 14 additions & 1 deletion Sources/Actions/Admin/Bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,21 @@ class Bans implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'Ban',
'updateBanMembers' => 'updateBanMembers',
'list_getBans' => 'list_getBans',
'list_getNumBans' => 'list_getNumBans',
'list_getBanItems' => 'list_getBanItems',
'list_getNumBanItems' => 'list_getNumBanItems',
'list_getBanTriggers' => 'list_getBanTriggers',
'list_getNumBanTriggers' => 'list_getNumBanTriggers',
'list_getBanLogEntries' => 'list_getBanLogEntries',
'list_getNumBanLogEntries' => 'list_getNumBanLogEntries',
'banList' => 'BanList',
'banEdit' => 'BanEdit',
'banBrowseTriggers' => 'BanBrowseTriggers',
'banEditTrigger' => 'BanEditTrigger',
'banLog' => 'BanLog',
),
);

Expand Down
3 changes: 1 addition & 2 deletions Sources/Actions/Admin/Boards.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ class Boards implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageBoards',
'getConfigVars' => false,
'editBoardSettings' => 'EditBoardSettings',
),
);

Expand Down
4 changes: 2 additions & 2 deletions Sources/Actions/Admin/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Calendar implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageCalendar',
'getConfigVars' => false,
'modifyHolidays' => 'ModifyHolidays',
'editHoliday' => 'EditHoliday',
),
);

Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/EndSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class EndSession implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'AdminEndSession',
),
);
Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/ErrorLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class ErrorLog implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ViewErrorLog',
),
);
Expand Down
18 changes: 11 additions & 7 deletions Sources/Actions/Admin/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ class Features implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ModifyFeatureSettings',
'basicConfigVars' => false,
'bbcConfigVars' => false,
'layoutConfigVars' => false,
'sigConfigVars' => false,
'likesConfigVars' => false,
'mentionsConfigVars' => false,
'list_getProfileFields' => 'list_getProfileFields',
'list_getProfileFieldSize' => 'list_getProfileFieldSize',
'modifyBasicSettings' => 'ModifyBasicSettings',
'modifyBBCSettings' => 'ModifyBBCSettings',
'modifyLayoutSettings' => 'ModifyLayoutSettings',
'modifySignatureSettings' => 'ModifySignatureSettings',
'showCustomProfiles' => 'ShowCustomProfiles',
'editCustomProfiles' => 'EditCustomProfiles',
'modifyLikesSettings' => 'ModifyLikesSettings',
'modifyMentionsSettings' => 'ModifyMentionsSettings',
'modifyAlertsSettings' => 'ModifyAlertsSettings',
),
);

Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Find implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'AdminSearch',
),
);
Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Home implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'AdminHome',
),
);
Expand Down
10 changes: 8 additions & 2 deletions Sources/Actions/Admin/Languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ class Languages implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageLanguages',
'getConfigVars' => false,
'list_getLanguagesList' => 'list_getLanguagesList',
'list_getNumLanguages' => 'list_getNumLanguages',
'list_getLanguages' => 'list_getLanguages',
'modifyLanguages' => 'ModifyLanguages',
'addLanguage' => 'AddLanguage',
'modifyLanguageSettings' => 'ModifyLanguageSettings',
'downloadLanguage' => 'DownloadLanguage',
'modifyLanguage' => 'ModifyLanguage',
),
);

Expand Down
4 changes: 1 addition & 3 deletions Sources/Actions/Admin/Logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ class Logs implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => false,
'getConfigVars' => false,
'adminLogs' => 'AdminLogs',
),
);

Expand Down
9 changes: 7 additions & 2 deletions Sources/Actions/Admin/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ class Mail implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageMail',
'getConfigVars' => false,
'list_getMailQueue' => 'list_getMailQueue',
'list_getMailQueueSize' => 'list_getMailQueueSize',
'timeSince' => 'timeSince',
'browseMailQueue' => 'BrowseMailQueue',
'clearMailQueue' => 'ClearMailQueue',
'modifyMailSettings' => 'ModifyMailSettings',
'testMailSend' => 'TestMailSend',
),
);

Expand Down
23 changes: 22 additions & 1 deletion Sources/Actions/Admin/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,29 @@ class Maintenance implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageMaintenance',
'getIntegrationHooksData' => 'getIntegrationHooksData',
'reattributePosts' => 'reattributePosts',
'maintainRoutine' => 'MaintainRoutine',
'maintainDatabase' => 'MaintainDatabase',
'maintainMembers' => 'MaintainMembers',
'maintainTopics' => 'MaintainTopics',
'list_integration_hooks' => 'list_integration_hooks',
'versionDetail' => 'VersionDetail',
'maintainFindFixErrors' => 'MaintainFindFixErrors',
'adminBoardRecount' => 'AdminBoardRecount',
'rebuildSettingsFile' => 'RebuildSettingsFile',
'maintainEmptyUnimportantLogs' => 'MaintainEmptyUnimportantLogs',
'maintainCleanCache' => 'MaintainCleanCache',
'optimizeTables' => 'OptimizeTables',
'convertEntities' => 'ConvertEntities',
'convertMsgBody' => 'ConvertMsgBody',
'maintainReattributePosts' => 'MaintainReattributePosts',
'maintainPurgeInactiveMembers' => 'MaintainPurgeInactiveMembers',
'maintainRecountPosts' => 'MaintainRecountPosts',
'maintainMassMoveTopics' => 'MaintainMassMoveTopics',
'maintainRemoveOldPosts' => 'MaintainRemoveOldPosts',
'maintainRemoveOldDrafts' => 'MaintainRemoveOldDrafts',
),
);

Expand Down
7 changes: 5 additions & 2 deletions Sources/Actions/Admin/Membergroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ class Membergroups implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ModifyMembergroups',
'getConfigVars' => false,
'AddMembergroup' => 'AddMembergroup',
'DeleteMembergroup' => 'DeleteMembergroup',
'EditMembergroup' => 'EditMembergroup',
'MembergroupIndex' => 'MembergroupIndex',
'ModifyMembergroupsettings' => 'ModifyMembergroupsettings',
),
);

Expand Down
7 changes: 6 additions & 1 deletion Sources/Actions/Admin/Members.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ class Members implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ViewMembers',
'list_getMembers' => 'list_getMembers',
'list_getNumMembers' => 'list_getNumMembers',
'viewMemberlist' => 'ViewMemberlist',
'adminApprove' => 'AdminApprove',
'membersAwaitingActivation' => 'MembersAwaitingActivation',
'searchMembers' => 'SearchMembers',
),
);

Expand Down
4 changes: 1 addition & 3 deletions Sources/Actions/Admin/Mods.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class Mods implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => false,
'getConfigVars' => false,
'modifyModSettings' => 'ModifyModSettings',
),
);

Expand Down
12 changes: 10 additions & 2 deletions Sources/Actions/Admin/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,17 @@ class News extends ACP implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageNews',
'getConfigVars' => false,
'list_getNews' => 'list_getNews',
'list_getNewsTextarea' => 'list_getNewsTextarea',
'list_getNewsPreview' => 'list_getNewsPreview',
'list_getNewsCheckbox' => 'list_getNewsCheckbox',
'prepareMailingForPreview' => 'prepareMailingForPreview',
'editNews' => 'EditNews',
'selectMailingMembers' => 'SelectMailingMembers',
'composeMailing' => 'ComposeMailing',
'sendMailing' => 'SendMailing',
'modifyNewsSettings' => 'ModifyNewsSettings',
),
);

Expand Down
19 changes: 17 additions & 2 deletions Sources/Actions/Admin/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,24 @@ class Permissions implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ModifyPermissions',
'getConfigVars' => false,
'getPermissions' => 'getPermissions',
'setPermissionLevel' => 'setPermissionLevel',
'init_inline_permissions' => 'init_inline_permissions',
'theme_inline_permissions' => 'theme_inline_permissions',
'save_inline_permissions' => 'save_inline_permissions',
'loadPermissionProfiles' => 'loadPermissionProfiles',
'updateChildPermissions' => 'updateChildPermissions',
'loadIllegalPermissions' => 'loadIllegalPermissions',
'buildHidden' => 'buildHidden',
'permissionIndex' => 'PermissionIndex',
'permissionByBoard' => 'PermissionByBoard',
'modifyMembergroup' => 'ModifyMembergroup',
'modifyMembergroup2' => 'ModifyMembergroup2',
'setQuickGroups' => 'SetQuickGroups',
'modifyPostModeration' => 'ModifyPostModeration',
'editPermissionProfiles' => 'EditPermissionProfiles',
'generalPermissionSettings' => 'GeneralPermissionSettings',
),
);

Expand Down
7 changes: 3 additions & 4 deletions Sources/Actions/Admin/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ class Posts implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManagePostSettings',
'postConfigVars' => false,
'topicConfigVars' => false,
'draftConfigVars' => false,
'modifyPostSettings' => 'ModifyPostSettings',
'modifyTopicSettings' => 'ModifyTopicSettings',
'modifyDraftSettings' => 'ModifyDraftSettings',
),
);

Expand Down
7 changes: 5 additions & 2 deletions Sources/Actions/Admin/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ class Registration implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'RegCenter',
'getConfigVars' => false,
'adminRegister' => 'AdminRegister',
'editAgreement' => 'EditAgreement',
'editPrivacyPolicy' => 'EditPrivacyPolicy',
'setReserved' => 'SetReserved',
'modifyRegistrationSettings' => 'ModifyRegistrationSettings',
),
);

Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/RepairBoards.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class RepairBoards implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'RepairBoards',
),
);
Expand Down
6 changes: 5 additions & 1 deletion Sources/Actions/Admin/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ class Reports implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ReportsMain',
'boardReport' => 'BoardReport',
'boardPermissionsReport' => 'BoardPermissionsReport',
'memberGroupsReport' => 'MemberGroupsReport',
'groupPermissionsReport' => 'GroupPermissionsReport',
'staffReport' => 'StaffReport',
),
);

Expand Down
5 changes: 3 additions & 2 deletions Sources/Actions/Admin/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ class Search implements ActionInterface
*/
private static $backcompat = array(
'func_names' => array(
'load' => false,
'call' => 'ManageSearch',
'getConfigVars' => false,
'editWeights' => 'EditWeights',
'editSearchMethod' => 'EditSearchMethod',
'createMessageIndex' => 'CreateMessageIndex',
),
);

Expand Down
Loading

0 comments on commit e1559de

Please sign in to comment.