-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StCR Import Bug: Incorrect number of Post and Subscriptions imported #166
Comments
Could be. Did you run this test with the |
You have 36 subscriptions with StCR, but only 3 were imported by Comment Mail? That seems very wrong. Were all 36 of those confirmed and had a I just tried to reproduce that but no luck yet. |
Correct,
I did not check this one, will update with the result. |
@jaswsinc writes...
That was my first thought too, which brings up a good thing to point out to users migrating from StCR → Comment Mail: unconfirmed subscriptions are not imported. Is there any specific reason that is the case or are unconfirmed subscriptions simply being ignored? |
They are ignored, because:
// Possible statuses: `Y|R|YC|RC|C|-C`.
// A `Y` indicates they want notifications for all comments.
// An `R` indicates they want notifications for replies only.
// A `C` indicates "suspended" or "unconfirmed".
if($_status !== 'Y' && $_status !== 'R') // Active?
continue; // Not an active subscriber. |
The code is my laptop but I will try to replicate the behavior on my desktop. |
Referencing StCR import class members: https://github.com/websharks/comment-mail-pro/blob/000000-dev/comment-mail-pro/includes/classes/import-stcr.php |
Thanks that will help to debug. |
OK, just to keep updating this issue, I just ran this query: SELECT * FROM wp_postmeta WHERE meta_key LIKE '\_stcr@\_%'
AND meta_value LIKE '%|R' OR meta_value LIKE '%|Y';
-- Got 35 records.
Just for posting with markdown I replaced the last pipe with the tilde character. So all this subscription should had been imported and the were not. |
Agree! Interesting. Thanks for posting that table. Really helps to clarify a lot. |
@Reedyseth Can you please run one more query for me? SELECT * FROM wp_postmeta WHERE meta_key LIKE '%imported\_stcr\_subs%' How many results do you get? |
SELECT * FROM wp_postmeta WHERE meta_key LIKE '%imported\_stcr\_subs%'
ORDER BY post_id;
But running this query: SELECT * FROM wp_postmeta WHERE meta_key LIKE '%imported\_stcr\_subs%'
ORDER BY post_id; I get: post_id1 EDITED: Both queries match in the number of post ids. |
Cool. Thanks! Do any of your posts have a status that is not |
They are. Now I am debugging Comment Mail. |
OK, I run another test by cleaning up the database and now it imported the correct number of post_ids. On the results of the importation says 7 post IDs and 70 subscriptions, when I went to the CM subscription page there was 59 subscriptions as for the subscriptions in StCR are 36. I will keep debugging and clearing this up. |
Cool. What did you have to clean up for it to work? |
I truncated the data on the I poluted the database by running different test. The only thing that now concern me is the 59 Subscriptios on CM vs the 36 on StCR. |
Copy that. Thank you for that testing! :-)
It's normal to have some difference in the counts. This can occur whenever you have See my note here. So if some of your existing subscribers had an That may explain 36 in StCR vs. 59 in Comment Mail. The same email address might be counted more than once, only because there are multiple per-comment subscriptions. Terminology in Comment Mail:
|
Alright, yes I noticed this behavior on the debugging session, but this clarify things up. I will run another detail debug about this and then come back to close the issue, thank you for the feedback. |
@Reedyseth Please make sure that you're testing the latest dev version of Comment Mail, i.e., after the work that Jason did to fix #162; see #162 (comment). I was experiencing the same odd behavior with Comment Mail appearing to import a lot more subscriptions than it should (i.e., my Comment Mail Subscription Event Log showed many "inserts" followed by "overwrites"). Now that I'm testing the latest dev branch (after Jason's work on #162), the StCR → Comment Mail import process is working as expected and the correct number of subscriptions appear. |
So I started with a new fresh installation of comment mail by doing this #163 (comment) and then started the migration process and I got this again: So the first time I thought I was doing something wrong, now I now there is something weird on the importation routine so I will spend more time on this matter. By entering to the StCR subscription page I see 39 subscription with status R or Y. One more thing, So I did execute the Importing routine but I still see the message "IMPORTANT TIP: Comment Mail can import your existing StCR subscribers automatically too! [click here to begin]" this should dissapear after running my routine. |
@Reedyseth writes...
Thank you. We have a GitHub issue open for this already here: #169
Would you be able to provide us with a MySQL dump of the StCR data so that we can import and test this on our own sites? |
Copy That I totally missed it, 😄
Here is the SQL inserts http://paste.behstant.com/?paste=204 use the password Let me know if you need more information. |
I just tested the latest dev branch (as of 2015-12-12 22:08:18 EST) on my personal site, where I have 1126 StCR subscriptions. When I ran the Comment Mail import process, only 930 subscriptions were imported. I confirmed that all 1126 StCR subscriptions have either an Still investigating... |
So after lots of digging and manually adding logging routines to the
However, there was still the issue of why StCR was reporting 1126 subscriptions (and the database confirmed this number) while Comment Mail was only importing 930 subscriptions. That led me to investigate the SQL queries that Comment Mail runs in Post IDs that StCR has subscriptions for:SELECT DISTINCT `post_id` FROM `wp_postmeta` WHERE `meta_key` LIKE '%\_stcr@\_%' Returned: What Comment Mail runs to search for Post IDs that have StCR subscriptions:SELECT `ID` FROM `wp_posts` WHERE `post_status` = 'publish' AND `post_type` NOT IN('revision', 'nav_menu_item', 'redirect', 'snippet') AND `ID` IN (SELECT DISTINCT `post_id` FROM `wp_postmeta` WHERE `meta_key` LIKE '%\_stcr@\_%') Returned: So this left me with a discrepancy of Perhaps some of the posts were deleted or no longer existed? (I rarely delete--almost never--delete published posts on my site, so I thought this was odd.) In any case, I decided to compare all of the Post IDs in Sure enough, that's exactly what was happening: SELECT DISTINCT `post_id` FROM `wp_postmeta` WHERE `meta_key` LIKE '%\_stcr@\_%' AND `post_id` NOT IN (SELECT DISTINCT `ID` FROM `wp_posts`) Returned: So, the reason that the number of posts Comment Mail imported (930) was different from the number of subscriptions reported by StCR (1129) was because during the import process Comment Mail validates that the Posts associated with the StCR subscriptions still exists. If the Post no longer exists, Comment Mail doesn't import that StCR subscription (which makes sense; there's no point in importing a subscription for a post that no longer exists). |
Can you point me where is your dev branch so that I can test this as well? |
@Reedyseth I referenced the PRs earlier: #166 (reference) |
Thank you 👍 |
Ugh, well, I'm ALMOST there, quite literally 99.74% of the way there!! With I will resume this tomorrow morning, in about 8 hours. @Reedyseth The PR (#180) is now in a good state to start testing, including the logging routines (which create a file in the plugin folder called |
Found it! These lines are giving precedence to The crazy thing is that I was looking for |
aha! That sounds like a good explanation to me. |
I got it! FINALLY! All skipped StCR subscriptions fully accounted for:
This was the trickiest area. I added several comments to this section to explain things better. Also, this line was what I was missing to get my skipped count correct (i.e., to account for the skipped blacklisted subscriptions properly). This is finally done. The only related thing is a new option to allow site owners to prevent the email blacklist from affecting subscription imports, but that's for another GitHub issue. :-) @jaswsinc @Reedyseth If you could both review this PR and let me know if you have any questions or spot anything out of place, that would be helpful. I'm going to merge that later today and finally do an RC tonight. |
@raamdev Woohoo! That looks great. I'll review the PR shortly. |
@raamdev I don't want to add more variants to the issue, I just pulled the branch feature/166 and tested it and my result was that I got no subscription imported at all. Take my comment only as a warning but it is what I just experience. |
@Reedyseth Can you try the following please?
Different results? |
Next Lite Release Changelog:
|
Next Pro Release Changelog:
|
Comment Mail v151224 has been released and includes changes from this GitHub Issue: See the v151224 announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#166). |
I detected this issue a while a go in a previous versions of CM, don't remember what version :), but as for the current version the issue still there.
This is what I did:
If you could try to replicate the issue that will confirm the bug.
The text was updated successfully, but these errors were encountered: