summaryrefslogtreecommitdiff
path: root/classes/User.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-25 23:00:46 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-25 23:00:46 -0700
commit994768b82101fdd2a08a92e30967ded6714b87dc (patch)
treebce337781fc5d4f399afa483b51596fb8166eedc /classes/User.php
parentb53b6b8769d5531c16ba58d4560119bcee8b39ff (diff)
break up big inbox queries into lots of small ones
Diffstat (limited to 'classes/User.php')
-rw-r--r--classes/User.php46
1 files changed, 6 insertions, 40 deletions
diff --git a/classes/User.php b/classes/User.php
index a01a3106f..62a3f8a66 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -600,50 +600,16 @@ class User extends Memcached_DataObject
function getSubscriptions($offset=0, $limit=null)
{
- $qry =
- 'SELECT profile.* ' .
- 'FROM profile JOIN subscription ' .
- 'ON profile.id = subscription.subscribed ' .
- 'WHERE subscription.subscriber = %d ' .
- 'AND subscription.subscribed != subscription.subscriber ' .
- 'ORDER BY subscription.created DESC ';
-
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
-
- $profile = new Profile();
-
- $profile->query(sprintf($qry, $this->id));
-
- return $profile;
+ $profile = $this->getProfile();
+ assert(!empty($profile));
+ return $profile->getSubscriptions($offset, $limit);
}
function getSubscribers($offset=0, $limit=null)
{
- $qry =
- 'SELECT profile.* ' .
- 'FROM profile JOIN subscription ' .
- 'ON profile.id = subscription.subscriber ' .
- 'WHERE subscription.subscribed = %d ' .
- 'AND subscription.subscribed != subscription.subscriber ' .
- 'ORDER BY subscription.created DESC ';
-
- if ($offset) {
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
- }
-
- $profile = new Profile();
-
- $cnt = $profile->query(sprintf($qry, $this->id));
-
- return $profile;
+ $profile = $this->getProfile();
+ assert(!empty($profile));
+ return $profile->getSubscribers($offset, $limit);
}
function getTaggedSubscribers($tag, $offset=0, $limit=null)