Closed (outdated)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 Sep 2010 at 20:19 UTC
Updated:
24 Apr 2024 at 18:54 UTC
Jump to comment: Most recent, Most recent file
Our token includes are a big mess. I'd like to merge them into a token.tokens.inc file, and then have 'stub' functions for the core modules in the main token.module.
For example:
token.module:
function token_include() {
// Do nothing since this function is no longer necessary but still may be called by other modules.
}
function node_token_list($type = 'all') {
module_load_include('inc', 'token', 'token.tokens');
return _node_token_list($type);
}
function _node_token_values($type, $object = NULL, $options = array()) {
module_load_include('inc', 'token', 'token.tokens');
return _node_token_values($type, $object, $options);
}
token.tokens.inc:
function _node_token_list($type = 'all') {
// Return the list of node-related tokens from token_node.inc
}
function _node_token_values($type, $object = NULL, $options = array()) {
// Return the list of node-related values from token_node.inc
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 922764-token-move-implementations.patch | 57.59 KB | dave reid |
| #2 | 922764-token-move-implementations.patch | 56.75 KB | dave reid |
| #1 | 922764-token-move-implementations.patch | 58.88 KB | dave reid |
Comments
Comment #1
dave reidPatch for testing that moves all the real token implementations into token.tokens.inc, but leaves the old files blank so we don't get any chance of the old functions staying around.
Comment #2
dave reidRevised patch with some performance test results:
Comment #3
dave reidComment #4
dave reidSo the patch in #3, reduced the amount of files required for tokens from 4 to 1 (helps with systems like APC enabled), and also reduced the total lines of code by 9 (even while leaving the old token_node.inc, etc files empty since we don't want any problems with people that don't delete module files before upgrading). I'd call that a pretty big win.
Comment #5
damienmckennaSo there's negligible performance difference, but it'll simplify future maintenance?
Out of interest, what is your plan on removing the (now empty) old inc files?
Comment #6
dave reidI figure we keep-em around for a couple releases. They're dead files so they shouldn't even be included by any code.
Comment #8
bluegeek9 commented