]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/classes/FeedSub.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / OStatus / classes / FeedSub.php
index 25a826a5524bf0438b9f2a237ed63cb64f537782..149d57f63cc76b996e9bd4701c3c8f51bb366e9c 100644 (file)
@@ -62,7 +62,7 @@ class FeedSub extends Managed_DataObject
     public $__table = 'feedsub';
 
     public $id;
-    public $uri;
+    public $uri;    // varchar(191)   not 255 because utf8mb4 takes more space
 
     // PuSH subscription data
     public $huburi;
@@ -80,13 +80,13 @@ class FeedSub extends Managed_DataObject
         return array(
             'fields' => array(
                 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'FeedSub local unique id'),
-                'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'FeedSub uri'),
+                'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'FeedSub uri'),
                 'huburi' => array('type' => 'text', 'description' => 'FeedSub hub-uri'),
                 'secret' => array('type' => 'text', 'description' => 'FeedSub stored secret'),
                 'sub_state' => array('type' => 'enum("subscribe","active","unsubscribe","inactive","nohub")', 'not null' => true, 'description' => 'subscription state'),
                 'sub_start' => array('type' => 'datetime', 'description' => 'subscription start'),
                 'sub_end' => array('type' => 'datetime', 'description' => 'subscription end'),
-                'last_update' => array('type' => 'datetime', 'not null' => true, 'description' => 'when this record was last updated'),
+                'last_update' => array('type' => 'datetime', 'description' => 'when this record was last updated'),
                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
                 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
             ),
@@ -168,7 +168,7 @@ class FeedSub extends Managed_DataObject
         $discover->discoverFromFeedURL($feeduri);
 
         $huburi = $discover->getHubLink();
-        if (!$huburi && !common_config('feedsub', 'fallback_hub')) {
+        if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) {
             throw new FeedSubNoHubException();
         }
 
@@ -211,8 +211,8 @@ class FeedSub extends Managed_DataObject
                 // No native hub on this feed?
                 // Use our fallback hub, which handles polling on our behalf.
             } else if (common_config('feedsub', 'nohub')) {
-                // Fake it! We're just testing remote feeds w/o hubs.
-                // We'll never actually get updates in this mode.
+                // For this to actually work, we'll need some polling mechanism.
+                // The FeedPoller plugin should take care of it.
                 return;
             } else {
                 // TRANS: Server exception.
@@ -247,8 +247,8 @@ class FeedSub extends Managed_DataObject
                 // No native hub on this feed?
                 // Use our fallback hub, which handles polling on our behalf.
             } else if (common_config('feedsub', 'nohub')) {
-                // Fake it! We're just testing remote feeds w/o hubs.
-                // We'll never actually get updates in this mode.
+                // We need a feedpolling plugin (like FeedPoller) active so it will
+                // set the 'nohub' state to 'inactive' for us.
                 return;
             } else {
                 // TRANS: Server exception.
@@ -487,7 +487,7 @@ class FeedSub extends Managed_DataObject
                     return true;
                 }
                 if (common_config('feedsub', 'debug')) {
-                    $tempfile = tempnam(sys_get_temp_dir(), 'feedsub-receive');
+                    $tempfile = tempnam(common_get_temp_dir(), 'feedsub-receive');
                     if ($tempfile) {
                         file_put_contents($tempfile, $post);
                     }