]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
authorBrion Vibber <brion@pobox.com>
Fri, 12 Feb 2010 19:18:35 +0000 (11:18 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 12 Feb 2010 19:18:35 +0000 (11:18 -0800)
1  2 
lib/api.php
lib/default.php
lib/queuemanager.php
lib/util.php

diff --combined lib/api.php
index b987badc06a78bfd74053a5f96b032715c42b768,8f1fe1ef712c15b9e0c708ab6b84bc9edb778aed..5758cc87455ae71d597f766b74875a00554df616
@@@ -289,12 -289,11 +289,12 @@@ class ApiAction extends Actio
              $twitter_status['attachments'] = array();
  
              foreach ($attachments as $attachment) {
 -                if ($attachment->isEnclosure()) {
 +                $enclosure_o=$attachment->getEnclosure();
 +                if ($enclosure_o) {
                      $enclosure = array();
 -                    $enclosure['url'] = $attachment->url;
 -                    $enclosure['mimetype'] = $attachment->mimetype;
 -                    $enclosure['size'] = $attachment->size;
 +                    $enclosure['url'] = $enclosure_o->url;
 +                    $enclosure['mimetype'] = $enclosure_o->mimetype;
 +                    $enclosure['size'] = $enclosure_o->size;
                      $twitter_status['attachments'][] = $enclosure;
                  }
              }
          }
      }
  
+     function getSelfUri($action, $aargs)
+     {
+         parse_str($_SERVER['QUERY_STRING'], $params);
+         $pstring = '';
+         if (!empty($params)) {
+             unset($params['p']);
+             $pstring = http_build_query($params);
+         }
+         $uri = common_local_url($action, $aargs);
+         if (!empty($pstring)) {
+             $uri .= '?' . $pstring;
+         }
+         return $uri;
+     }
  }
diff --combined lib/default.php
index 16d1330f06b0a6f4b3686d35249c106896809843,bf4b83718d04dd4e934d626bbd31a30618e04c56..cc6863488feb3454a2a35ba21e8e8e3a451b7a46
@@@ -88,6 -88,7 +88,7 @@@ $default 
                'stomp_manual_failover' => true, // if multiple servers are listed, treat them as separate (enqueue on one randomly, listen on all)
                'monitor' => null, // URL to monitor ping endpoint (work in progress)
                'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully
+               'spawndelay' => 1, // Wait at least N seconds between (re)spawns of child processes to avoid slamming the queue server with subscription startup
                'debug_memory' => false, // true to spit memory usage to log
                'inboxes' => true, // true to do inbox distribution & output queueing from in background via 'distrib' queue
                ),
                                   'Mapstraction' => null,
                                   'Linkback' => null,
                                   'WikiHashtags' => null,
 +                                 'PubSubHubBub' => null,
 +                                 'RSSCloud' => null,
                                   'OpenID' => null),
                ),
          'admin' =>
diff --combined lib/queuemanager.php
index 274e1c2f695604853e87a4cd94d89569991db956,149617eb508f1139c2502a110f57756b1a251744..64bb52e106ee7289bf03934ebb32b145f33315d5
@@@ -155,26 -155,26 +155,26 @@@ abstract class QueueManager extends IoM
      }
  
      /**
-      * Encode an object for queued storage.
-      * Next gen may use serialization.
+      * Encode an object or variable for queued storage.
+      * Notice objects are currently stored as an id reference;
+      * other items are serialized.
       *
-      * @param mixed $object
+      * @param mixed $item
       * @return string
       */
-     protected function encode($object)
+     protected function encode($item)
      {
-         if ($object instanceof Notice) {
-             return $object->id;
-         } else if (is_string($object)) {
-             return $object;
+         if ($item instanceof Notice) {
+             // Backwards compat
+             return $item->id;
          } else {
-             throw new ServerException("Can't queue this type", 500);
+             return serialize($item);
          }
      }
  
      /**
       * Decode an object from queued storage.
-      * Accepts back-compat notice reference entries and strings for now.
+      * Accepts notice reference entries and serialized items.
       *
       * @param string
       * @return mixed
      protected function decode($frame)
      {
          if (is_numeric($frame)) {
+             // Back-compat for notices...
              return Notice::staticGet(intval($frame));
-         } else {
+         } elseif (substr($frame, 0, 1) == '<') {
+             // Back-compat for XML source
              return $frame;
+         } else {
+             // Deserialize!
+             #$old = error_reporting();
+             #error_reporting($old & ~E_NOTICE);
+             $out = unserialize($frame);
+             #error_reporting($old);
+             if ($out === false && $frame !== 'b:0;') {
+                 common_log(LOG_ERR, "Couldn't unserialize queued frame: $frame");
+                 return false;
+             }
+             return $out;
          }
      }
  
      {
          if (isset($this->handlers[$queue])) {
              $class = $this->handlers[$queue];
 -            if (class_exists($class)) {
 +            if(is_object($class)) {
 +                return $class;
 +            } else if (class_exists($class)) {
                  return new $class();
              } else {
                  common_log(LOG_ERR, "Nonexistent handler class '$class' for queue '$queue'");
       * Only registered transports will be reliably picked up!
       *
       * @param string $transport
 -     * @param string $class
 +     * @param string $class class name or object instance
       * @param string $group
       */
      public function connect($transport, $class, $group='queuedaemon')
diff --combined lib/util.php
index 879834a3d5ef52647a0ec14a150b68deba4b7f12,a07fe49e33d4502506fd3fc04450abe334d48321..e255c5fe0899f5616fb2d3ecbbd6e026f0875dcf
@@@ -595,13 -595,20 +595,13 @@@ function common_linkify($url) 
      }
  
      if (!empty($f)) {
 -        if ($f->isEnclosure()) {
 +        if ($f->getEnclosure()) {
              $is_attachment = true;
              $attachment_id = $f->id;
 -        } else {
 -            $foe = File_oembed::staticGet('file_id', $f->id);
 -            if (!empty($foe)) {
 -                // if it has OEmbed info, it's an attachment, too
 -                $is_attachment = true;
 -                $attachment_id = $f->id;
 -
 -                $thumb = File_thumbnail::staticGet('file_id', $f->id);
 -                if (!empty($thumb)) {
 -                    $has_thumb = true;
 -                }
 +
 +            $thumb = File_thumbnail::staticGet('file_id', $f->id);
 +            if (!empty($thumb)) {
 +                $has_thumb = true;
              }
          }
      }
@@@ -690,7 -697,7 +690,7 @@@ function common_group_link($sender_id, 
  {
      $sender = Profile::staticGet($sender_id);
      $group = User_group::getForNickname($nickname);
-     if ($group && $sender->isMember($group)) {
+     if ($sender && $group && $sender->isMember($group)) {
          $attrs = array('href' => $group->permalink(),
                         'class' => 'url');
          if (!empty($group->fullname)) {