Sucuri imonitor

’nuff said.



The Way of A WordPress Developer

From my very old private programming diary:

2 months later…



WordPress Database Optimizations

delete from wp_usermeta where meta_value = '';
delete from wp_postmeta where meta_value = '';
delete from wp_options where option_value = '';

Because why not?



WordPress HTTPS to HTTP Cookie Error

After switching from HTTPS to HTTP (local development) WordPress may sometimes get stuck in the following error message:

Cookies are blocked or not supported by your browser.

The browser complains:

This Set-Cookie was blocked because it was not sent over a secure connection and would have overwritten a cookie with the Secure attribute.

The solution is:

1. Visit the https:// version of the site (it would error out as Connection Refused, or give you an SSL warning, whatever)
2. Clear the cookies while in the error screen.

Makes sense.



Cleaning Up Bot Registrations in WooCommerce

…or Optimizing Slow Sub-Queries in WordPress

Bot registrations are a nuisance in many WooCommerce sites. Cleaning them up seems to be a trivial task: just delete all users without a placed order from a month ago and backwards.

select * from wp_users where user_registered < "2020-07-01 00:00:00";                                                                                                         
47665 rows in set (0.06 sec)

select meta_value from wp_postmeta where meta_value = '_customer_user';                                                                                                       
51253 rows in set (0.44 sec)

Okay, so we almost 50 thousand customers and a bit over 50 thousand orders.

The query to delete all the users that have no order is seemingly a simple one:

delete from wp_users where user_registered < "2020-07-01 00:00:00"
and id not in (select meta_value from wp_postmeta where meta_key = '_customer_user' group by meta_value);

Great. Yet there's a huge issue: Query OK, (59 min 7.22 sec)

Ooomph! This won't effing do!

Continue reading



WooCommerce Can’t Count Either

In continuation of yesterday’s post about bbPress, I decided to look for a more impactful race condition vulnerability. What’s more impactful on an online business than ecommerce?

WooCommerce is up for the thread-safety test in this post and probably a couple of other to follow.

WooCommerce Can't Count Either

Continue reading



bbPress Can’t Count

In a highly-concurrent high-load environment bbPress will not count the topics and replies correctly. This happens due to several race conditions in the code. While not a critical vulnerability, it’s annoying. I wonder how the dotorg forums keep the numbers accurate? Maybe they don’t and nobody cares 🙂 but it’s something I’ve been very passionate about – data accuracy and race conditions.

bbPress Can't Count

Continue reading



On Startup Partnerships

As a contractor, I’m often approached by startup founders (or founders-to-be). They’re looking to reach some kind of partnership deal, where I would do backend development work without charging any money. As a wantrepreneur, I’m sometimes approached to fund some sort of startup. When, or rather, if the startup becomes profitable, I would get a cut of the profits.

I’ve learned some important lessons in the past 10 years. These help me deal with new partnership proposals without getting carried away, and steer some of friends and colleagues away from lucrative business proposals.

Continue reading



W3TCache + nginx + subdirectories

This is a simple instruction on how to make W3Total Cache (version 0.13.1) work with nginx (version 0.14) and subdirectory installs.

W3TCache + nginx + subdirectories

Continue reading



Bustone – Time and Space

…or the lost and found of underground ultra rare Christian Hip-Hop songs

…or “Are you insane? You haven’t written anything programming-related in over a year and you come back with this nonsense?”

Continue reading