Update core to use the new database interface
The core has to use the database interface correctly.
Leave a comment
on 2010-12-08 03:29 *
By nick_ramsay
I'm in the process of removing calls to $h->db->select from plugins. It's a bit ugly, making the plugins bloated and duplicating code, but when finished will leave the core Database file cleaner. So far I've done Bookmarking, Magazine and Post RSS.
on 2010-12-08 05:48 *
By
WOW Nick thanks for doing this for those plugins!
Just for reference the revisions in HotaruExtensions where this took place are for the moment: 283, 284, 285, 286, 287, 288, 289, 290
In the last two days I searched the plugins for
the db->select() was getting used in
Furthermore there is the
That is the research I did before starting to remove the select but I am glad you went ahead and started it :)
Just for reference the revisions in HotaruExtensions where this took place are for the moment: 283, 284, 285, 286, 287, 288, 289, 290
In the last two days I searched the plugins for
->select(
and then I identified the places where it could be changed without affecting other plugins (just a couple of plugins (I'll commit later) and then I identified where the functionality affected other plugins and from which hooks and tried came up with this:the db->select() was getting used in
BookmarkingFunctions::prepareList()
that called the hook bookmarking_functions_preparelist
which in turn is used in the following plugins:- p. categories adds a
WHERE
filter, post_category = $cat_id [OR post_category = $child_cat_id]
(foreach children category)- p. media_select adds a
WHERE
filter, post_media = $media AND post_archived = 'N'
- p. mobile (need to research more - complicated)
- p. order_by_pub_date [if the page is sort removes
WHERE
filter (post_date >= $start AND post_date <= $end)
, adds WHERE
filter (post_pub_date >= $start AND post_pub_date <= $end)
, adds ORDER BY
clause post_votes_up DESC, post_pub_date DESC
], [if the page is 'popular' then the plugins adds ORDER BY
clause post_bud_date DESC
].- p. order_by_votes [if page is 'popular' adds,
ORDER BY
clause post_votes_up DESC, post_date DESC
- p. post_views [if 'views' adds a
WHERE
filter post_archived = 'N'
and a ORDER BY
clause post_views DESC
- p. search (need to research more - complicated)
- p. tags adds a
WHERE
filter post_tags LIKE %$tag% AND post_archived = 'N'
- p. users adds a
WHERE
filter post_author = $use_id AND post_archived = '$x'
- p. vote_bar (need to research more - complicated)
Furthermore there is the
post_rss_feed
hook called from the RSSFunctions.php
:- p. categories adds a
WHERE
filter post_category = $cat_id [OR post_category = $child_cat_id]
(foreach children category)- p. media_select ads a
WHERE
filter post_media = $media
- p. mobile (need to research more - complicated)
- p. order_by_pub_date [if rssstatus is 'top' adds
ORDER BY
clause post_pub_date DESC
- p. search (need to research more - complicated)
- p. tags adds a
WHERE
filter post_tags LIKE %$tag%
- p. users adds a
WHERE
filter post_author = $user_id
That is the research I did before starting to remove the select but I am glad you went ahead and started it :)
on 2010-12-08 10:42 *
By nick_ramsay
$h->db->select removed from Post Manager. HEX #291
on 2010-12-08 11:50 *
By nick_ramsay
$h->db->select removed from Related Posts. HEX #292
on 2010-12-08 12:26 *
By nick_ramsay
$h->db->select removed from Journal Widget. HEX #293
on 2010-12-08 12:34 *
By nick_ramsay
$h->db->select removed from Post Views Widget. HEX #294
(In revision:2285) [1.5] Removed all "select"-related methods from Database class. re #173
Reassigning to George.