Monthly Archives: April 2020

Transactions and Locks in MySQL

Refer: https://stackoverflow.com/questions/61212438/why-do-we-need-to-lock-a-mysql-table-during-select-when-beginning-a-transaction/ TL;DR: MySQL docs are wrong Transactions act like a try-catch block. They don’t provide protection against concurrency. If something fails in a transaction, it can be rolled back to undo pending operations that were not committed. To handle … Continue reading

Posted in Software | Tagged | Leave a comment

A note on the dbDelta function

The dbDelta function documented at https://codex.wordpress.org/Creating_Tables_with_Plugins: The dbDelta function examines the current table structure, compares it to the desired table structure, and either adds or modifies the table as necessary, so it can be very handy for updates (see wp-admin/upgrade-schema.php … Continue reading

Posted in Software | Tagged | Leave a comment

Writing Your First WordPress Plugin

This post describes how to develop a WordPress plugin that can be used to count visits to a WordPress site. The basic idea is that we will create a table visitor_log in which we will store the timestamp, url_visited, ip_address, … Continue reading

Posted in Software | Tagged | 2 Comments

Backing up WordPress db

It is very important to backup wordpress db. This is done using mysqldump command. In the basic form: mysqldump -u wpreader –password=’password’ wordpress > backup.sql But we need to automate this and protect the password. This is done by following … Continue reading

Posted in Software | Tagged | 1 Comment