Commit d7999461 authored by catch's avatar catch
Browse files

Issue #3015693 by alexpott: Properly deprecate AGGREGATOR_CLEAR_NEVER

parent 374bb899
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\aggregator\Entity; namespace Drupal\aggregator\Entity;
use Drupal\aggregator\FeedStorageInterface;
use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\BaseFieldDefinition;
...@@ -170,7 +171,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ...@@ -170,7 +171,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$intervals = [900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200]; $intervals = [900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200];
$period = array_map([\Drupal::service('date.formatter'), 'formatInterval'], array_combine($intervals, $intervals)); $period = array_map([\Drupal::service('date.formatter'), 'formatInterval'], array_combine($intervals, $intervals));
$period[AGGREGATOR_CLEAR_NEVER] = t('Never'); $period[FeedStorageInterface::CLEAR_NEVER] = t('Never');
$fields['refresh'] = BaseFieldDefinition::create('list_integer') $fields['refresh'] = BaseFieldDefinition::create('list_integer')
->setLabel(t('Update interval')) ->setLabel(t('Update interval'))
......
...@@ -18,7 +18,7 @@ class FeedStorage extends SqlContentEntityStorage implements FeedStorageInterfac ...@@ -18,7 +18,7 @@ class FeedStorage extends SqlContentEntityStorage implements FeedStorageInterfac
public function getFeedIdsToRefresh() { public function getFeedIdsToRefresh() {
return $this->database->query('SELECT fid FROM {' . $this->getBaseTable() . '} WHERE queued = 0 AND checked + refresh < :time AND refresh <> :never', [ return $this->database->query('SELECT fid FROM {' . $this->getBaseTable() . '} WHERE queued = 0 AND checked + refresh < :time AND refresh <> :never', [
':time' => REQUEST_TIME, ':time' => REQUEST_TIME,
':never' => AGGREGATOR_CLEAR_NEVER, ':never' => static::CLEAR_NEVER,
])->fetchCol(); ])->fetchCol();
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Drupal\aggregator\Entity\Item; use Drupal\aggregator\Entity\Item;
use Drupal\aggregator\FeedInterface; use Drupal\aggregator\FeedInterface;
use Drupal\aggregator\FeedStorageInterface;
use Drupal\aggregator\ItemStorageInterface; use Drupal\aggregator\ItemStorageInterface;
use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase; use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
use Drupal\aggregator\Plugin\ProcessorInterface; use Drupal\aggregator\Plugin\ProcessorInterface;
...@@ -123,7 +124,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ...@@ -123,7 +124,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
}, array_combine($counts, $counts)); }, array_combine($counts, $counts));
$intervals = [3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800]; $intervals = [3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800];
$period = array_map([$this->dateFormatter, 'formatInterval'], array_combine($intervals, $intervals)); $period = array_map([$this->dateFormatter, 'formatInterval'], array_combine($intervals, $intervals));
$period[AGGREGATOR_CLEAR_NEVER] = t('Never'); $period[FeedStorageInterface::CLEAR_NEVER] = t('Never');
$form['processors'][$info['id']] = []; $form['processors'][$info['id']] = [];
// Only wrap into details if there is a basic configuration. // Only wrap into details if there is a basic configuration.
...@@ -254,7 +255,7 @@ public function delete(FeedInterface $feed) { ...@@ -254,7 +255,7 @@ public function delete(FeedInterface $feed) {
public function postProcess(FeedInterface $feed) { public function postProcess(FeedInterface $feed) {
$aggregator_clear = $this->configuration['items']['expire']; $aggregator_clear = $this->configuration['items']['expire'];
if ($aggregator_clear != AGGREGATOR_CLEAR_NEVER) { if ($aggregator_clear != FeedStorageInterface::CLEAR_NEVER) {
// Delete all items that are older than flush item timer. // Delete all items that are older than flush item timer.
$age = REQUEST_TIME - $aggregator_clear; $age = REQUEST_TIME - $aggregator_clear;
$result = $this->itemStorage->getQuery() $result = $this->itemStorage->getQuery()
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\aggregator\Functional; namespace Drupal\Tests\aggregator\Functional;
use Drupal\aggregator\FeedStorageInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\aggregator\Entity\Feed; use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item; use Drupal\aggregator\Entity\Item;
...@@ -21,7 +22,7 @@ protected function setUp() { ...@@ -21,7 +22,7 @@ protected function setUp() {
// Do not delete old aggregator items during these tests, since our sample // Do not delete old aggregator items during these tests, since our sample
// feeds have hardcoded dates in them (which may be expired when this test // feeds have hardcoded dates in them (which may be expired when this test
// is run). // is run).
$this->config('aggregator.settings')->set('items.expire', AGGREGATOR_CLEAR_NEVER)->save(); $this->config('aggregator.settings')->set('items.expire', FeedStorageInterface::CLEAR_NEVER)->save();
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment