Subscribe via RSS
28May/150

An insight into the workings of a Comment Bot

I get emails every now and then from this blog telling me that there's a new comment for approval. Most often than not, it's spam. It's also usually really shit spam. The context is wrong, the URLs are Russian and the text is crap. I have always wondered how it's generated and who would be the one posting the comments.

Regardless of the plugins I have enabled to stop spam (and it seems 10000s of comments are in fact stopped), some of the crap still gets through.

Today I received an email indicating a new comment. This one was different though... the contents seem to have been verbatim pasted, as opposed to 'customised' by the 'poster'.

{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours.
{It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.
I {couldn't|could not} {resist|refrain from} commenting.

{Very well|Perfectly|Well|Exceptionally well} written!
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|it's} time to be happy.
{I have|I've} read this post and if I could I {want to|wish to|desire to} suggest you {few|some} interesting things or {advice|suggestions|tips}.
{Perhaps|Maybe} you {could|can} write next articles referring to this article.

Woah... it seems that these comments really do get customised... I mean, they still have NOTHING to do with my blog and the URLs they point to have NOTHING to do with the guts of the comment, but the contents of the comments seem to be variable.

I assume the variability is to prevent the crap getting marked as spam. The English makes sense, to the point where each of the permutations actually sound like a native speaker.

I wonder if a bot chooses, at random, which word to use from each array, or if a human is doing it all. A human should, at least, know that the entire body has nothing to do with any post on this blog; but then again, the poster may not even speak English.

I am sure this {article|post|piece of writing|paragraph} has touched all the internet {users|people|viewers|visitors}, its really really {nice|pleasant|good|fastidious} {article|post|piece of writing|paragraph} on building up new
{blog|weblog|webpage|website|web site}.
Wow, this {article|post|piece of writing|paragraph} is {nice|pleasant|good|fastidious}, my {sister|younger sister} is analyzing {such|these|these kinds of} things, {so|thus|therefore} I am going to {tell|inform|let know|convey} her.
{Saved as a favorite|bookmarked!!}, {I really like|I like|I love} {your blog|your site|your web site|your website}!

Then again.. if you keep reading the dribble you'll see how crap it is and, even though some sentences flow, others just don't belong where they are.

Meh... either way, it was a very interesting insight into the workings of these bots/humans/drones posting shitty comments on the world of blogging.

17Apr/150

Migrated WordPress database; Theme mods are gone!

This was fun... I just helped a friend migrate their database. The DB export and import was fine; just don't try and paste the SQL into the query window all at once... go to the import page on PHPMyAdmin and upload it there!

Meanwhile, once uploaded, all the custom settings on the themes (it inherited from a base theme) were lost! I watched the database and the fields were actually reset! There must have been an error parsing the data. It has to be noted that I had to change data in the database during the migration. As that I was changing from one domain to another, the hard-coded URLs needed to be migrated.

In the source database, the row in the wp_options table with key 'theme_mods_Divi' looked like this:

a:8:{
     i:0;b:0;s:30:"et_pb_predefined_layouts_added";s:2:"on";
     s:36:"et_pb_predefined_layouts_updated_2_0";
     s:2:"on";s:16:"background_color";s:6:"ffffff";
     s:49:"http://old_domain.com/images/background_image.jpg";s:17:"background_repeat";
}

I don't know what the first a:8 stands for, but all the s values inside mean string, followed by the length, then the data.

I actually, as a migration task, had to change the strings from one URL to another (as part of the domain shift.) Turns out that when you do this, if the URLs being replaced aren't the exact length, then the string lengths will change .... of course, this is obvious now .... WordPress was then trying to parse the values and overrunning/underrunning the values. In the end it just gives up and resets the custom mods.

So, when changing the strings, you need to change something like:

s:49:"http://old_domain.com/images/background_image.jpg";

to:

s:62:"http://google_is_the_best.com/images/zebra_in_a_tree_image.jpg";

...the key being that you've adjusted the length to the new variable.

Once this is done: drop all the tables, re-import them via the script and WordPress should then load the mods correctly! I hope this prevents at least one other person from wasting the 2 hours that I just did. Never lose your custom theme settings/mods when migrating ever again!