X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FFeedSub.php;h=b0875c298865b86f70fa1d8c57c272368d73d25a;hb=a0b9aeb43ef1b08e8dd7fe25101c515a0df53e7f;hp=57c056f5fbd7f3b29849221d56b40ffc65ab4e23;hpb=ba9abb3c577b955012a66bcd3320639865778440;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 57c056f5fb..b0875c2988 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -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'), ), @@ -295,7 +295,7 @@ class FeedSub extends Managed_DataObject { $fs = new FeedSub(); // the "" empty string check is because we historically haven't saved unsubscribed feeds as NULL - $fs->whereAdd('sub_end IS NOT NULL AND sub_end!="" AND sub_end < NOW() - INTERVAL 1 day'); + $fs->whereAdd('sub_end IS NOT NULL AND sub_end!="" AND sub_end < NOW() + INTERVAL 1 day'); if (!$fs->find()) { // find can be both false and 0, depending on why nothing was found throw new NoResultException($fs); } @@ -355,7 +355,7 @@ class FeedSub extends Managed_DataObject $response = $client->post($hub, $headers, $post); $status = $response->getStatus(); // PuSH specificed response status code - if ($status == 202) { + if ($status == 202 || $status == 204) { common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback'); return; } else if ($status >= 200 && $status < 300) { @@ -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); }