This is a follow-up for #1470530: Unpublish/Delete nodes not included in feed. Patch here requires the other patch to work.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | feeds-block-users-not-included-in-feed-2092895-18.patch | 4.67 KB | twistor |
| #16 | feeds-multilingual-1183440-228.patch | 30.56 KB | twistor |
| #16 | interdiff.txt | 1.9 KB | twistor |
| #10 | feeds-block-users-not-included-in-feed-2092895-9.patch | 4.63 KB | megachriz |
| #9 | interdiff-2092895-5-9.txt | 964 bytes | megachriz |
Comments
Comment #1
honza pobořil commentedComment #2
mikran commentedComment #3
megachrizMissing doc block.
Also, the @file doc block should always come before constant definitions.
Text should be "Block non-existent users" (put a dash between "non" and "existent").
Missing parameter description.
Missing period. Also, "unpublishing" doesn't fit in the context of users.
Comment #4
mikran commentedThanks for review, I've fixed everything you listed and then I added a new counter for blocked users so it's similar to what is being done with unpublish action to nodes. I had more tests than the one included but those tests essentially uncovered a new bug so I'm opening a separate issue for that.
EDIT: #2339383: Items missing from feeds do not affect item hash even when action is taken based on that., please review that first.
Comment #5
mikran commentedAnd here is a patch that assumes that fix from issue #2339383: Items missing from feeds do not affect item hash even when action is taken based on that. is already applied.
Comment #6
shane birley commentedDoes this companion to https://www.drupal.org/node/1470530 include the options to "delete" missing users from the import file? I also assume that the User 1 is ignored?
Comment #7
mikran commentedThe options to delete users is already there. This patch only adds the new option to block user entities.
There is no special protection for "User 1" but the delete/block only happens for those records that were previously available on the feed. So you really have to trust your feed source if you are importing "User 1" so having that account deleted or blocked is not a real concern.
Comment #8
shane birley commentedAm I missing something? The deletion option appears to be missing entirely -- at least, in the latest alpha. Where is the option located? It used to appear in the user processor settings but it no longer is there.
Update: I updated to the latest dev and the option to delete non-existent users has returned.
Update: And good point on the UID 1.
Comment #9
megachrizThe patch in #5 looks fine to me. I only made a tiny correction to the test: near the end of the test the option "update_non_existent" was set to "block" twice. I removed the second line which did that.
I tested it manually like this:
This patch should be evaluated by the testbot once #2339383: Items missing from feeds do not affect item hash even when action is taken based on that. is in. If then all tests pass, the issue is RTBC to me.
Comment #10
megachriz#2339383: Items missing from feeds do not affect item hash even when action is taken based on that. is in! Here is a re-upload from the patch in #9 with only the filename changed, so the testbot will pick up the patch.
Comment #11
shane birley commentedI think there is one issue with this importing methodology -- we are running on the assumption that the feed being imported is always consistent. In an ideal world, sure, this would be awesome. But what if the CSV is changing users all the time. I did a bit of tinkering and with multiple imports and I have been able to decimate a few sites during the import. I did twelve imports very close together removing users randomly and on each new import with the latest dev -- it killed UID 1 each time.
And, of course, with UID 1 blasted from the database and the import grinds to a halt. I associated all content on a site to UID and (as per the user settings configuration regarding what to do with content post user deletion) killed the test sites entirely.
How does one prevent UID 1 from ever being removed? To me, it just seems that if the end user is not really 100% sure on how the CSV system works, they can do some real damage. Shouldn't we think about some safe guards or am I missing something so incredibly simple that I should just give up and become an ice cream salesperson?
Comment #12
megachriz@Shane Birley
You have a point that the end user may not realize that user 1 can get deleted by Feeds if he/she sets the "update_non_existent" option to "Delete non-existent users". mikran (in #7) also has a point that you must know what you are doing if you set that option. However, this issue is about adding the option to block previously imported users, not about deleting users (the delete option is not added by this issue, but is already part of dev). Can you create a new issue for this concern?
Comment #13
shane birley commentedI totally can.
Aaaaaaand, done: https://www.drupal.org/node/2485059
Comment #14
shane birley commentedComment #15
mikran commentedYep, this looks RTBC to me too.
Comment #16
twistor commentedSome minor cleanups. This looks ready.
We should create a follow up about moving all of the message creation to individual processors. It doesn't make sense to have FeedsProcessor worry about blocked users.
Comment #17
twistor commentedWill fix "Option to *block* users not found in the feed." on commit.
Comment #18
twistor commentedAaaand the wrong patch.
Comment #20
twistor commentedComment #21
shane birley commentedFor reference: Adding a patch to protect UID 1 and certain roles.
https://www.drupal.org/node/2485059#comment-10042924