Index: modules/tracker/tracker.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v retrieving revision 1.19 diff -u -p -r1.19 tracker.pages.inc --- modules/tracker/tracker.pages.inc 22 May 2009 11:33:18 -0000 1.19 +++ modules/tracker/tracker.pages.inc 28 May 2009 20:44:08 -0000 @@ -14,23 +14,22 @@ function tracker_page($account = NULL, $ // Add CSS drupal_add_css(drupal_get_path('module', 'tracker') . '/tracker.css', array('preprocess' => FALSE)); - $header = array( - t('Type'), - t('Post'), - t('Author'), - t('Replies'), - t('Last updated') - ); + $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last updated')); // TODO: These queries are very expensive, see http://drupal.org/node/105639 - $query = db_select('node', 'n', array('target' => 'slave')) - ->fields('n', array('nid', 'title', 'type', 'changed', 'uid')); + $query = db_select('node', 'n', array('target' => 'slave'))->extend('PagerDefault'); $query->join('users', 'u', 'n.uid = u.uid'); - $query->addField('u', 'name'); $query->join('node_comment_statistics', 'l', 'n.nid = l.nid'); $query->addExpression('GREATEST(n.changed, l.last_comment_timestamp)', 'last_updated'); - $query->addField('l', 'comment_count'); - $query->orderBy('last_updated', 'DESC'); + $query + ->distinct() + ->fields('n', array('nid', 'title', 'type', 'changed', 'uid')) + ->fields('u', array('name')) + ->fields('l', array('comment_count')) + ->condition('n.status', 1) + ->orderBy('last_updated', 'DESC') + ->addTag('node_access') + ->limit(25); if ($account) { if ($set_title) { @@ -46,12 +45,6 @@ function tracker_page($account = NULL, $ ); } - $query->condition('n.status', 1); - $query->distinct(); - $query->extend('PagerDefault')->extend('TableSort') - ->limit(25, 0) - ->orderByHeader($header); - $result = $query->execute(); $rows = array(); Index: modules/tracker/tracker.test =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.test,v retrieving revision 1.9 diff -u -p -r1.9 tracker.test --- modules/tracker/tracker.test 29 Apr 2009 12:08:28 -0000 1.9 +++ modules/tracker/tracker.test 28 May 2009 20:44:08 -0000 @@ -43,6 +43,14 @@ class TrackerTest extends DrupalWebTestC $this->assertText($page1['title'], t('Nodes show up in the tracker listing.')); $this->assertNoText($page2['title'], t('Unpublished nodes do not show up in the tracker listing.')); $this->assertLink(t('My recent posts'), 0, t('User tab shows up on the global tracker page.')); + + // Test that paging works correctly. + for ($i = 0; $i < 25; $i++) { + $this->drupalCreateNode(); + } + + $this->drupalGet('tracker'); + $this->assertTrue($this->clickLink('2'), t('The pager is correctly displayed.')); } /**