diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-02-22 16:53:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-02-22 16:53:41 +0000 |
commit | b3e36d655c831c63c26a710eb3c8bd82ca3b6fc5 (patch) | |
tree | af24f8462bd347de36cd7375fc78dffb48e7d0b9 /modules/node/node.module | |
parent | e1652e99b61577ac42d6d6618420c872c0e42435 (diff) | |
download | brdo-b3e36d655c831c63c26a710eb3c8bd82ca3b6fc5.tar.gz brdo-b3e36d655c831c63c26a710eb3c8bd82ca3b6fc5.tar.bz2 |
- Patch #299267 by Crell: add extender support to the SELECT query builder.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r-- | modules/node/node.module | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 2f1d38bec..e601f2260 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -2024,7 +2024,18 @@ function node_build_multiple($nodes, $teaser = TRUE, $weight = 0) { * Menu callback; Generate a listing of promoted nodes. */ function node_page_default() { - $nids = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10))->fetchCol(); + $select = db_select('node', 'n') + ->fields('n', array('nid')) + ->condition('promote', 1) + ->condition('status', 1) + ->orderBy('sticky', 'DESC') + ->orderBy('created', 'DESC') + ->extend('PagerDefault') + ->limit(variable_get('default_nodes_main', 10)) + ->addTag('node_access'); + + $nids = $select->execute()->fetchCol(); + if (!empty($nids)) { $nodes = node_load_multiple($nids); $build = node_build_multiple($nodes); |