3.0.5 Release Note

I have been frequently asked about a question in the forum something like:

I still get traffic from blacklisted countries!

I believe that this kind of question may be solved if you configure the settings like UA string and Qualification properly. But I agree that it’s a bit difficult to find the reason and the solution.

So I had decided to provide some useful features in this release.

New screen: Validation logs

You may notice a new screen of “Validation logs”. Previously, it was divided into some tables for each target, but they were integrated and displayed in one table.

New screen - Logs

Currently, it keeps 500 entries as a whole to limit the size of table in MySQL database.

New feature: Live update

You may also notice the checkbox “Live update” at the top of the section. It enables you to audit all the requests which are validated by this plugin almost in real time. Please turn it on and push the “Start” button to activate capturing the requests.

Live update

The “Pause” button can stop updating the screen while it keeps capturing new requests for 60 seconds. After 60 seconds has passed or just pushing “Stop” button, it stops capturing. If you leave it as activated and jump to another page, then capturing will stop automatically at server side.

Unlike the normal logging, “Live update” doesn’t need to be persistent. So I prefer to hold it in SQLite database rather than MySQL as an internal buffer for read (client) and write (server). SQLite makes its database on the file system, and you can change its path via filter hook ip-geo-block-live-log.

function my_sqlite_dsn( $path ) {
    return '/tmp/' . basename( $path );
}
add_filter( 'ip-geo-block-live-log', 'my_sqlite_dsn' );

Please note that it takes a few tens of milliseconds for writing as overhead. In the future, I’d implement it as “In-Memory” database that may significantly reduce the overhead (it would be executed within a few milliseconds). It has been almost done but still has some issues on it emoji .

New screen: Statistics in cache

The screen of “Statistics in cache” has been also updated and each IP address in the table is manageable. For example, if someone fails to login multiple times, then you can remove the IP address from the cache so that he/she can try to login again.

New screen - Statistics in cache

Improvement: Statistics and Logs settings

In the previous version, this section was named as “Record settings”. And now, you can select a new mode “When blocked or passed from undesired country” as a condition to record logs.

Statistics and Logs settings

With this mode, you can audit not only the blocked requests but also the requests “passed” from undesired countries (i.e. blacklisted countries or countries not in the whitelist). So I hope you can check if the rules in UA string and Qualification at “Front-end settings” works as you intend.

New feature: filter hooks for Google APIs

People in China can’t reach API Client Libraries like Google Charts, Google Hosted Libraries and Google Maps API. Although they utilize those services via VPN, the speed might be slow.

So two new filter hooks are now available in your functions.php :

function my_google_jsapi( $url ) {
    return 'https://www.google.cn/jsapi';
}
function my_google_maps( $url ) {
    return 'https://maps.google.cn/maps/api/js';
}
add_filter( 'google-jsapi', 'my_google_jsapi' );
add_filter( 'google-maps',  'my_google_maps'  );

See also filter hook “google-jspai, google-maps”.

Enjoy blocking! emoji