]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
authorSamantha Doherty <sammy@status.net>
Fri, 26 Aug 2011 16:52:18 +0000 (12:52 -0400)
committerSamantha Doherty <sammy@status.net>
Fri, 26 Aug 2011 16:52:18 +0000 (12:52 -0400)
classes/Managed_DataObject.php
classes/Profile.php
classes/Profile_list.php
lib/default.php
lib/peopletagnoticestream.php

index 7263b3e3206f787c6116599f43f1a2e1e489c7aa..552d980fba172b362f4d06b67420cb411960d2bc 100644 (file)
@@ -152,4 +152,18 @@ abstract class Managed_DataObject extends Memcached_DataObject
 
         return $style;
     }
+
+    function links()
+    {
+        $links = array();
+
+        $table = call_user_func(array(get_class($this), 'schemaDef'));
+
+        foreach ($table['foreign keys'] as $keyname => $keydef) {
+            if (count($keydef) == 2 && is_string($keydef[0]) && is_array($keydef[1]) && count($keydef[1]) == 1) {
+                $links[$keydef[1][0]] = $keydef[0].':'.$keydef[1][1];
+            }
+        }
+        return $links;
+    }
 }
\ No newline at end of file
index bcbb406ae01599df559cacb6be0a3ed328e59490..228a0ae2028fc0a61b1d0a55f98420a496ad1b20 100644 (file)
@@ -435,6 +435,7 @@ class Profile extends Managed_DataObject
         $tags->tagged = $this->id;
 
         $lists->joinAdd($tags);
+
         #@fixme: postgres (round(date_part('epoch', my_date)))
         $lists->selectAdd('unix_timestamp(profile_tag.modified) as "cursor"');
 
@@ -507,7 +508,8 @@ class Profile extends Managed_DataObject
         $lists = new Profile_list();
         $subs = new Profile_tag_subscription();
 
-        $lists->joinAdd($subs);
+        $lists->joinAdd('id', 'profile_tag_subscription:profile_tag_id');
+
         #@fixme: postgres (round(date_part('epoch', my_date)))
         $lists->selectAdd('unix_timestamp(profile_tag_subscription.created) as "cursor"');
 
index 50aa71f55dc0157875748fb04ee66bd2a7e761a4..c433a53fee5d865edff350cb9e63739cbf8df8d7 100644 (file)
@@ -220,10 +220,9 @@ class Profile_list extends Managed_DataObject
     function getSubscribers($offset=0, $limit=null, $since=0, $upto=0)
     {
         $subs = new Profile();
-        $sub = new Profile_tag_subscription();
-        $sub->profile_tag_id = $this->id;
 
-        $subs->joinAdd($sub);
+        $subs->joinAdd(array('id', 'profile_tag_subscription:profile_tag_id'));
+
         $subs->selectAdd('unix_timestamp(profile_tag_subscription.' .
                          'created) as "cursor"');
 
index 9c4c8cab05711169051bf021506b35668fc62362..71b2257cd5b6e1107bf8e57b678c1b9f42435f18 100644 (file)
@@ -310,7 +310,8 @@ $default =
                                  'TagSub' => null,
                                  'OpenID' => null,
                                  'Directory' => null,
-                                 'ExtendedProfile' => null),
+                                 'ExtendedProfile' => null,
+                                 'Activity' => null),
               'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
               'server' => null,
               'sslserver' => null,
index 9477ca8ea6dfc5f0cf52d06131c2461f01866d3b..e82d754e8d63e4da324630eac6facad37df8ad64 100644 (file)
@@ -96,10 +96,10 @@ class RawPeopletagNoticeStream extends NoticeStream
         $notice->selectAdd();
         $notice->selectAdd('notice.id');
 
-        $ptag = new Profile_tag();
-        $ptag->tag    = $this->profile_list->tag;
-        $ptag->tagger = $this->profile_list->tagger;
-        $notice->joinAdd($ptag);
+        $notice->joinAdd(array('profile_id', 'profile_tag:tagged'));
+
+        $notice->whereAdd(sprintf('profile_tag.tag = "%s"', $this->profile_list->tag));
+        $notice->whereAdd(sprintf('profile_tag.tagger = %d', $this->profile_list->tagger));
 
         if ($since_id != 0) {
             $notice->whereAdd('notice.id > ' . $since_id);