Skip to content
Snippets Groups Projects
Commit 9e610ea7 authored by Youri van Koppen's avatar Youri van Koppen
Browse files

Merge branch '3341361-disable-pubsubhubbub' into '8.x-3.x'

Ignore phpstan errors in PubSubHubbub because the feature is broken + disable...

See merge request !183
parents f3ca51df 12d770af
No related branches found
No related tags found
No related merge requests found
Pipeline #223219 failed
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon
parameters:
level: 1
excludePaths:
# @todo PubSubHubbub feature is broken.
# @see https://www.drupal.org/project/feeds/issues/3341361
- src/EventSubscriber/PubSubHubbub.php
......@@ -19,6 +19,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Event listener for PubSubHubbub subscriptions.
*
* @todo This feature is broken because GuzzleHttp\Url is gone.
* @see https://www.drupal.org/project/feeds/issues/3341361
*/
class PubSubHubbub implements EventSubscriberInterface {
......@@ -87,6 +90,7 @@ class PubSubHubbub implements EventSubscriberInterface {
}
// Used to make other URLs absolute.
// @todo This is broken, it no longer exists.
$source_url = Url::fromString($feed->getSource());
$hub = (string) $source_url->combine($hub);
......@@ -253,14 +257,13 @@ class PubSubHubbub implements EventSubscriberInterface {
* @param int $retries
* (optional) The number of retries. Defaults to 3.
*
* @return \GuzzleHttp\Message\Response
* The Guzzle response.
* @return \GuzzleHttp\Message\Response|false
* The Guzzle response or false if retrying failed.
*/
protected static function retry(SubscriptionInterface $subscription, array $body, $retries = 3) {
$tries = 0;
do {
$tries++;
try {
......@@ -270,6 +273,8 @@ class PubSubHubbub implements EventSubscriberInterface {
\Drupal::logger('feeds')->warning('Subscription error: %error', ['%error' => $e->getMessage()]);
}
} while ($tries <= $retries);
return FALSE;
}
/**
......
......@@ -3,6 +3,8 @@
namespace Drupal\feeds\Feeds\Fetcher\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\feeds\Plugin\Type\ExternalPluginFormBase;
/**
......@@ -20,11 +22,23 @@ class HttpFetcherForm extends ExternalPluginFormBase {
'#description' => $this->t('If the supplied URL does not point to a feed but an HTML document, attempt to extract a feed URL from the document.'),
'#default_value' => $this->plugin->getConfiguration('auto_detect_feeds'),
];
// @todo PubSubHubbub is broken.
// @see https://www.drupal.org/project/feeds/issues/3341361
$url = Url::fromUri('https://www.drupal.org/project/feeds/issues/3341361', [
'attributes' => [
'target' => '_blank',
],
]);
$link = Link::fromTextAndUrl('https://www.drupal.org/project/feeds/issues/3341361', $url);
$form['use_pubsubhubbub'] = [
'#type' => 'checkbox',
'#title' => $this->t('Use PubSubHubbub'),
'#description' => $this->t('Attempt to use a <a href="http://en.wikipedia.org/wiki/PubSubHubbub">PubSubHubbub</a> subscription if available.'),
'#description' => $this->t('Attempt to use a <a href="http://en.wikipedia.org/wiki/PubSubHubbub">PubSubHubbub</a> subscription if available.') . '<br /><div class="color-warning">' . $this->t('Warning: this feature is broken. Help fix it at @url.', [
'@url' => $link->toString(),
]) . '</div>',
'#default_value' => $this->plugin->getConfiguration('use_pubsubhubbub'),
'#disabled' => TRUE,
];
$form['always_download'] = [
'#type' => 'checkbox',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment