xf_phantom
Well-known member
Additional to http://xenforo.com/community/threads/xenforo_edithistoryhandler_post.54454/ and all other c&p threads
the prepareXFetchOptios method is a very good example of c&p code.
e.g.
as you see, only the content type and content_id is different
the same happens with FETCH_DELETION_LOG (thread, post & profile post model) and the like ids (post,profilepost)
it would be really nice, if the query parts could be generated automatically to avoid the copy and paste operations here (in this case it's really just copy and paste and replace the content_type and content_id params)
the prepareXFetchOptios method is a very good example of c&p code.
e.g.
PHP:
//my models:
if (XenForo_Application::getOptions()->cacheBbCodeTree && $fetchOptions['join'] & self::FETCH_BBCODE_CACHE)
{
$selectFields .= ',
bb_code_parse_cache.parse_tree AS message_parsed, bb_code_parse_cache.cache_version AS message_cache_version';
$joinTables .= '
LEFT JOIN xf_bb_code_parse_cache AS bb_code_parse_cache ON
(bb_code_parse_cache.content_type = \'XXX\' AND bb_code_parse_cache.content_id = XXX.XXX_id)';
}
//xf post:
if (XenForo_Application::getOptions()->cacheBbCodeTree && $fetchOptions['join'] & self::FETCH_BBCODE_CACHE)
{
$selectFields .= ',
bb_code_parse_cache.parse_tree AS message_parsed, bb_code_parse_cache.cache_version AS message_cache_version';
$joinTables .= '
LEFT JOIN xf_bb_code_parse_cache AS bb_code_parse_cache ON
(bb_code_parse_cache.content_type = \'post\' AND bb_code_parse_cache.content_id = post.post_id)';
}
if (XenForo_Application::getOptions()->cacheBbCodeTree && $fetchOptions['join'] & self::FETCH_USER_PROFILE && $fetchOptions['join'] & self::FETCH_BBCODE_CACHE)
{
$selectFields .= ',
signature_parse_cache.parse_tree AS signature_parsed, bb_code_parse_cache.cache_version AS signature_cache_version';
$joinTables .= '
LEFT JOIN xf_bb_code_parse_cache AS signature_parse_cache ON
(signature_parse_cache.content_type = \'signature\' AND signature_parse_cache.content_id = post.user_id)';
}
as you see, only the content type and content_id is different
the same happens with FETCH_DELETION_LOG (thread, post & profile post model) and the like ids (post,profilepost)
it would be really nice, if the query parts could be generated automatically to avoid the copy and paste operations here (in this case it's really just copy and paste and replace the content_type and content_id params)
Upvote
0