8 Commits d61375cb7f ... ec504ec4df

Author SHA1 Message Date
  Mikael Nordfeldth ec504ec4df Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 6 years ago
  Mikael Nordfeldth 96ce758c05 Trying to debug some stuff regarding oEmbed 6 years ago
  Mikael Nordfeldth a45d9471ed If $_REQUEST is empty, array_merge == null. 6 years ago
  Mikael Nordfeldth 10f17efc4f disabling auto-backlog-importer on subscribe 6 years ago
  mmn d9fbc17f77 Merge branch 'nightly' into 'nightly' 6 years ago
  Mikael Nordfeldth 0b75eaed92 missing argument for sprintf 6 years ago
  Mikael Nordfeldth de8aed6a28 Added bullet point to README 6 years ago
  abjectio 90e93b9656 Added base64 encoding to get RMQ to work 6 years ago

+ 1 - 0
README.md

@@ -107,6 +107,7 @@ So far it includes the following changes:
 
 - Backing up a user's account is more and more complete.
 - Emojis 😸 (utf8mb4 support)
+- Fully qualified group mentions (!group@example.com)
 
 The last release, 1.1.3, gave us these improvements:
 

+ 3 - 1
extlib/Stomp.php

@@ -324,7 +324,9 @@ class Stomp
     {
         $headers = array('ack' => 'client');
 		$headers['activemq.prefetchSize'] = $this->prefetchSize;
-		if ($this->clientId != null) {
+        $headers['prefetch-count'] = '1';
+
+        if ($this->clientId != null) {
 			$headers["activemq.subcriptionName"] = $this->clientId;
 		}
         if (isset($properties)) {

+ 1 - 1
index.php

@@ -271,7 +271,7 @@ function main()
         common_redirect(common_local_url($args['action'], $args));
     }
 
-    $args = array_merge($args, $_REQUEST);
+    $args = array_merge($args, $_REQUEST ?: []);
 
     Event::handle('ArgsInitialize', array(&$args));
 

+ 1 - 1
lib/imagefile.php

@@ -163,7 +163,7 @@ class ImageFile
                 // doesn't exist anyway, so it's safe to delete $imgPath
                 @unlink($imgPath);
             }
-            common_debug(sprintf('Exception caught when creating ImageFile for File id==%s and imgPath==', _ve($file->id), _ve($imgPath)));
+            common_debug(sprintf('Exception %s caught when creating ImageFile for File id==%s and imgPath==%s: %s', get_class($e), _ve($file->id), _ve($imgPath), _ve($e->getMessage())));
             throw $e;
         }
         return $image;

+ 3 - 3
lib/stompqueuemanager.php

@@ -151,7 +151,7 @@ class StompQueueManager extends QueueManager
         $envelope = array('site' => $siteNickname ? $siteNickname : common_config('site', 'nickname'),
                           'handler' => $queue,
                           'payload' => $this->encode($object));
-        $msg = serialize($envelope);
+        $msg = base64_encode(serialize($envelope));
 
         $props = array('created' => common_sql_now());
         if ($this->isPersistent($queue)) {
@@ -479,7 +479,7 @@ class StompQueueManager extends QueueManager
     protected function handleItem($frame)
     {
         $host = $this->cons[$this->defaultIdx]->getServer();
-        $message = unserialize($frame->body);
+        $message = unserialize(base64_decode($frame->body));
 
         if ($message === false) {
             $this->_log(LOG_ERR, "Can't unserialize frame: {$frame->body}");
@@ -490,7 +490,7 @@ class StompQueueManager extends QueueManager
         $site = $message['site'];
         $queue = $message['handler'];
 
-        if ($this->isDeadletter($frame, $message)) {
+        if ($this->isDeadLetter($frame, $message)) {
             $this->stats('deadletter', $queue);
 	        return false;
         }

+ 3 - 3
plugins/OStatus/actions/pushcallback.php

@@ -121,9 +121,9 @@ class PushCallbackAction extends Action
 
             if (!$renewal) {
                 // Kickstart the feed by importing its most recent backlog
-                // FIXME: Send this to background queue handling
-                common_log(LOG_INFO, __METHOD__ . ': Confirmed a new subscription, importing backlog...');
-                $feedsub->importFeed();
+                // FIXME: Disabled until we can either limit the amount and/or send to background queue handling
+                //common_log(LOG_INFO, __METHOD__ . ': Confirmed a new subscription, importing backlog...');
+                //$feedsub->importFeed();
             }
         } else {
             common_log(LOG_INFO, __METHOD__ . ": unsub confirmed; deleting sub record for $topic");

+ 6 - 2
plugins/Oembed/OembedPlugin.php

@@ -332,6 +332,7 @@ class OembedPlugin extends Plugin
 
         // All our remote Oembed images lack a local filename property in the File object
         if (!is_null($file->filename)) {
+            common_debug(sprintf('Filename of file id==%d is not null (%s), so nothing oEmbed should handle.', $file->getID(), _ve($file->filename)));
             return true;
         }
 
@@ -342,6 +343,7 @@ class OembedPlugin extends Plugin
             $thumbnail   = File_thumbnail::byFile($file);
         } catch (NoResultException $e) {
             // Not Oembed data, or at least nothing we either can or want to use.
+            common_debug('No oEmbed data found for file id=='.$file->getID());
             return true;
         }
 
@@ -349,6 +351,9 @@ class OembedPlugin extends Plugin
             $this->storeRemoteFileThumbnail($thumbnail);
         } catch (AlreadyFulfilledException $e) {
             // aw yiss!
+        } catch (Exception $e) {
+            common_debug(sprintf('oEmbed encountered an exception (%s) for file id==%d: %s', get_class($e), $file->getID(), _ve($e->getMessage())));
+            throw $e;
         }
 
         $imgPath = $thumbnail->getPath();
@@ -425,8 +430,7 @@ class OembedPlugin extends Plugin
 
         $ext = File::guessMimeExtension($info['mime']);
 
-        // We'll trust sha256 (File::FILEHASH_ALG) not to have collision issues any time soon :)
-        $filename = 'oembed-'.hash(File::FILEHASH_ALG, $imgData) . ".{$ext}";
+        $filename = sprintf('oembed-%d.%s', $thumbnail->getFileId(), $ext);
         $fullpath = File_thumbnail::path($filename);
         // Write the file to disk. Throw Exception on failure
         if (!file_exists($fullpath) && file_put_contents($fullpath, $imgData) === false) {