[GH-ISSUE #236] Override functions in modules #197

Closed
opened 2026-02-25 21:34:24 +03:00 by kerem · 1 comment
Owner

Originally created by @jasonmunro on GitHub (Dec 4, 2017).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/236

Originally assigned to: @jasonmunro on GitHub.

Currently the module system lets you override modules from other sets, but if those modules call functions, you end up having to duplicate a lot of code (potentially) just to change a function call.

I propose ALL functions defined in modules be wrapped in a "if not function exists" conditional. Currently, if the site module set is present, its "lib.php" file will be included before any module set specific code. This would allow sites to override a function defined in any module set using the site modules.

For example, if I wanted to change the date format for all messages lists regardless of source, using the module system as it works now would take a TON of work and a lot of duplicate code. If we make the above change, a site could simply override the human_readable_interval function to implement the change.

Originally created by @jasonmunro on GitHub (Dec 4, 2017). Original GitHub issue: https://github.com/cypht-org/cypht/issues/236 Originally assigned to: @jasonmunro on GitHub. Currently the module system lets you override modules from other sets, but if those modules call functions, you end up having to duplicate a lot of code (potentially) just to change a function call. I propose ALL functions defined in modules be wrapped in a "if not function exists" conditional. Currently, if the site module set is present, its "lib.php" file will be included before any module set specific code. This would allow sites to override a function defined in any module set using the site modules. For example, if I wanted to change the date format for all messages lists regardless of source, using the module system as it works now would take a TON of work and a lot of duplicate code. If we make the above change, a site could simply override the human_readable_interval function to implement the change.
kerem 2026-02-25 21:34:24 +03:00
Author
Owner

@jasonmunro commented on GitHub (Dec 21, 2017):

This is now complete. Along with these changes I fixed the inclusions of the site/lib.php file to occur only if the site module set is enabled.

<!-- gh-comment-id:353460440 --> @jasonmunro commented on GitHub (Dec 21, 2017): This is now complete. Along with these changes I fixed the inclusions of the site/lib.php file to occur only if the site module set is enabled.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#197
No description provided.