]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'userdesign' into 0.8.x
authorZach Copley <zach@controlyourself.ca>
Thu, 18 Jun 2009 02:04:41 +0000 (19:04 -0700)
committerZach Copley <zach@controlyourself.ca>
Thu, 18 Jun 2009 02:04:41 +0000 (19:04 -0700)
* userdesign:
  Minor removal

actions/showstream.php
classes/Notice.php
classes/Profile.php
lib/grouptagcloudsection.php
scripts/setup.cfg.sample
scripts/setup_status_network.sh

index 72316b2592ffeb26d6a04c80b4d309fd7c763a5b..cd5d4bb7013bfb84f87d8eca580ddc0ba8c74bb6 100644 (file)
@@ -370,7 +370,7 @@ class ShowstreamAction extends ProfileAction
     {
         $notice = empty($this->tag)
             ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
-            : $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag);
+            : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
 
         $pnl = new ProfileNoticeList($notice, $this);
         $cnt = $pnl->show();
index 18f3f654ec3987ad1910205e9c0d4fe78bdad622..e621805dfc661038f22cc353901d192509e7ecd8 100644 (file)
@@ -379,6 +379,12 @@ class Notice extends Memcached_DataObject
             if ($tag->find()) {
                 while ($tag->fetch()) {
                     $tag->blowCache($blowLast);
+                    $ck = 'profile:notice_ids_tagged:' . $this->profile_id . ':' . $tag->tag;
+
+                    $cache->delete($ck);
+                    if ($blowLast) {
+                        $cache->delete($ck . ';last');
+                    }
                 }
             }
             $tag->free();
index 4a459b9740e4055b5a62c9349ba689b9dc9598fd..2f432ae8eda8f575d3a55e67a14bae8eb5267ac2 100644 (file)
@@ -153,18 +153,16 @@ class Profile extends Memcached_DataObject
         return null;
     }
 
-    function getTaggedNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null, $tag=null)
+    function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
     {
-        // XXX: I'm not sure this is going to be any faster. It probably isn't.
         $ids = Notice::stream(array($this, '_streamTaggedDirect'),
-                              array(),
-                              'profile:notice_ids:' . $this->id,
-                              $offset, $limit, $since_id, $before_id, $since, $tag);
-        common_debug(print_r($ids, true));
+                              array($tag),
+                              'profile:notice_ids_tagged:' . $this->id . ':' . $tag,
+                              $offset, $limit, $since_id, $max_id, $since);
         return Notice::getStreamByIds($ids);
     }
 
-    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+    function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
     {
         // XXX: I'm not sure this is going to be any faster. It probably isn't.
         $ids = Notice::stream(array($this, '_streamDirect'),
@@ -175,18 +173,23 @@ class Profile extends Memcached_DataObject
         return Notice::getStreamByIds($ids);
     }
 
-    function _streamTaggedDirect($offset, $limit, $since_id, $before_id, $since=null, $tag=null)
+    function _streamTaggedDirect($tag, $offset, $limit, $since_id, $max_id, $since)
     {
-        common_debug('_streamTaggedDirect()');
+        // XXX It would be nice to do this without a join
+
         $notice = new Notice();
-        $notice->profile_id = $this->id;
-        $query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($tag) . "' and profile_id=" . $notice->escape($notice->profile_id);
+
+        $query =
+          "select id from notice join notice_tag on id=notice_id where tag='".
+          $notice->escape($tag) .
+          "' and profile_id=" . $notice->escape($this->id);
+
         if ($since_id != 0) {
             $query .= " and id > $since_id";
         }
 
-        if ($before_id != 0) {
-            $query .= " and id < $before_id";
+        if ($max_id != 0) {
+            $query .= " and id < $max_id";
         }
 
         if (!is_null($since)) {
@@ -198,21 +201,19 @@ class Profile extends Memcached_DataObject
         if (!is_null($offset)) {
             $query .= " limit $offset, $limit";
         }
+
         $notice->query($query);
+
         $ids = array();
 
         while ($notice->fetch()) {
-            common_debug(print_r($notice, true));
             $ids[] = $notice->id;
         }
 
         return $ids;
     }
 
-
-
-
-    function _streamDirect($offset, $limit, $since_id, $before_id, $since = null)
+    function _streamDirect($offset, $limit, $since_id, $max_id, $since = null)
     {
         $notice = new Notice();
 
index 5d68af28bf7bdc62e8a9ba3b3892a3b03c6d8084..9b7a10f6b9ea029e45bda11f64fa7604411f04b3 100644 (file)
@@ -32,7 +32,7 @@ if (!defined('LACONICA')) {
 }
 
 /**
- * Personal tag cloud section
+ * Group tag cloud section
  *
  * @category Widget
  * @package  Laconica
@@ -64,12 +64,27 @@ class GroupTagCloudSection extends TagCloudSection
             $weightexpr='sum(exp(-(now() - notice_tag.created) / %s))';
         }
 
+        $names = $this->group->getAliases();
+
+        $names = array_merge(array($this->group->nickname), $names);
+
+        // XXX This is dumb.
+
+        $quoted = array();
+
+        foreach ($names as $name) {
+            $quoted[] = "\"$name\"";
+        }
+
+        $namestring = implode(',', $quoted);
+
         $qry = 'SELECT notice_tag.tag, '.
           $weightexpr . ' as weight ' .
           'FROM notice_tag JOIN notice ' .
           'ON notice_tag.notice_id = notice.id ' .
           'JOIN group_inbox on group_inbox.notice_id = notice.id ' .
           'WHERE group_inbox.group_id = %d ' .
+          'AND notice_tag.tag not in (%s) '.
           'GROUP BY notice_tag.tag ' .
           'ORDER BY weight DESC ';
 
@@ -85,9 +100,9 @@ class GroupTagCloudSection extends TagCloudSection
         $tag = Memcached_DataObject::cachedQuery('Notice_tag',
                                                  sprintf($qry,
                                                          common_config('tag', 'dropoff'),
-                                                         $this->group->id),
+                                                         $this->group->id,
+                                                         $namestring),
                                                  3600);
         return $tag;
     }
-
 }
index 4194bc146d0fcd62f4e5282a260a8cbc22368829..450b9c30a3f6401c5a6acc630ff9a2fa40ff9397 100644 (file)
@@ -2,6 +2,7 @@
 
 # Base database name; full name will include nickname
 
+export DBHOST=masterdb.example.net
 export DBBASE=_example_net
 export USERBASE=_example_net
 export ADMIN=root
index d80612b94035c101c0571a9bc2a505deca7f0432..e1d14593fbe616c9b6fb9b3475febdfc50fc673e 100755 (executable)
@@ -11,13 +11,13 @@ export username=$nickname$USERBASE
 
 # Create the db
 
-mysqladmin -u $ADMIN --password=$ADMINPASS create $database
+mysqladmin -h $DBHOST -u $ADMIN --password=$ADMINPASS create $database
 
 for f in laconica.sql sms_carrier.sql foreign_services.sql notice_source.sql; do
-    mysql -u $ADMIN --password=$ADMINPASS $database < ../db/$f;
+    mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $database < ../db/$f;
 done
 
-mysql -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
+mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
 
 GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
 GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';