Updated: Comment #12
Problem/Motivation
The remove items logic is in the aggregator feed entity but, the refresh one is in a procedural function. This just hurts DX by making things more confusing to discover.
Proposed resolution
Introduce a service and move all related logic there.
Keep the $feed->removeItems() method there as a shortcut and also add a $feed->refreshItems() for consistency.
I dont see a reason why not and i think it boosts DX
Remaining tasks
Patch is there, review rtbc
User interface changes
None
API changes
aggregator_refresh_items() becomes deprecated
Original report by @ParisLiakos
The remove items logic is already in the Feed entity, but not the refresh items, which still is a procedural function.
Lets move it too in the Feed entity to make things cosistent.
In the process get rid of the @todo in AggregatorController::feedRefresh()
Comment | File | Size | Author |
---|---|---|---|
#26 | drupal-aggregator_refresh-2159369-26.patch | 17.91 KB | ParisLiakos |
#24 | interdiff.txt | 738 bytes | ParisLiakos |
#24 | drupal-aggregator_refresh-2159369-24.patch | 17.91 KB | ParisLiakos |
#14 | drupal-aggregator_refresh-2159369-14.patch | 14.26 KB | ParisLiakos |
#12 | drupal-aggregator_refresh-2159369-12.patch | 14.26 KB | ParisLiakos |
Comments
Comment #1
ParisLiakos CreditAttribution: ParisLiakos commentedComment #2
ParisLiakos CreditAttribution: ParisLiakos commentedreroll
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedoops
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commented4: drupal-aggregator_refresh-2159369-4.patch queued for re-testing.
Comment #8
ParisLiakos CreditAttribution: ParisLiakos commented4: drupal-aggregator_refresh-2159369-4.patch queued for re-testing.
Comment #9
Berdirthat could be a loop, but I have no idea how a book fail is related to aggregator :)
Comment #10
ParisLiakos CreditAttribution: ParisLiakos commentedit now passed:) but yes, i dont see the relation here, i really doubt those failures are this patch's effects
Comment #11
dawehnerIs it just be that it feels wrong to put soo much logic into an entity instead of a nice decoupled service?
Comment #12
ParisLiakos CreditAttribution: ParisLiakos commentedIt certainly does. I just tried to do smaller steps, but yes, probably too small.
so, i created
aggregator.items.importer
service and moved the remove and refresh items there, which now makes the feed entity look a lot better.sorry, i messed up interrdiff, but i doubt it would be much of a help.
Comment #13
dawehnerNice!
Comment #14
ParisLiakos CreditAttribution: ParisLiakos commentedthank you!
just removing an unrelated newline addition and a forgotten use statement
Comment #16
xjmReminder: you can now create a draft change record for API changes.
https://groups.drupal.org/node/402688
A change record will be required for an API change to be committed starting Feb. 14, but you're encouraged to create a draft for this issue now as well. :)
Also, rather than deprecating the function, should we consider whether simply removing it is appropriate, given the efforts elsewhere to get rid of @deprecated cruft?
Comment #17
ParisLiakos CreditAttribution: ParisLiakos commentedaggregator_queue_info() still uses it as worker callback, so i dont think it should be removed
before those are converted to plugins
Comment #18
ParisLiakos CreditAttribution: ParisLiakos commentedadded https://drupal.org/node/2191221 as draft
also included the aggregator_remove() which didnt have a change notice
Comment #19
alexpottdrupal-aggregator_refresh-2159369-14.patch no longer applies.
Comment #20
ParisLiakos CreditAttribution: ParisLiakos commentedReroll
Comment #21
ParisLiakos CreditAttribution: ParisLiakos commentedactually, i was wrong in #17
We can use an anonymous function for that and remove the global aggregator_refresh() one (Which is really cool:))
I also removed the save() call from the
ItemsImporter
service to theFeed::refreshItems()
, to make it even more consistent with howremoveItems()
worksChange notice updated, tests are green locally
Comment #22
ParisLiakos CreditAttribution: ParisLiakos commentedreroll
Comment #24
ParisLiakos CreditAttribution: ParisLiakos commentedugh
Comment #25
dawehnerThis just looks perfect!
Comment #26
ParisLiakos CreditAttribution: ParisLiakos commentedreroll after #1878302: Use 'delete' over 'remove' in the aggregator module went in
Comment #27
webchickThis looks like really nice clean-up.
Committed and pushed to 8.x. Thanks!
Comment #29
webchick?