The directory where the backup files of validation logs are saved.
Description
The filter hook “ip-location-block-backup-dir” assigns the absolute path to the directory where the backup files of validation logs are saved.
The maximum entries of each validation log for the target (e.g. comment, xmlrpc, login, admin and public) is limited to 100. So if you want to save backups, use this hook.
Parameters
-
$dir
(string) Absolute path to the directory. Default value isnull. -
$hook
(string)'comment','xmlrpc','login','admin'or'public'.
Use case
The following code snippet in your theme’s functions.php selectively saves the CSV formatted text files which will be named as ip-location-block-YYYY-MM.log.
function my_backup_dir( $dir, $hook ) {
if ( 'login' === $hook )
return '/absolute/path/to/';
else
return null; // do not keep backups
}
add_filter( 'ip-location-block-backup-dir', 'my_backup_dir', 10, 2 );
WARNING: The ‘
/absolute/path/to/‘ should be outside of your public area. NOTE: When you select
"mu-plugins" (ip-location-block-mu.php) as Validation timing , you should put your code snippet into drop-in.php in Geolocation API folder instead of functions.php. See My custom functions in “functions.php” doesn’t work. in FAQ for detail. The CSV format is as follows:
| Entry | Description |
|---|---|
| time | requested time in seconds |
| ip address | ip address of requester |
| target | requested target e.g. comment, xmlrpc, login, admin |
| authority | logged in user or not |
| country | country code |
| result | validation result e.g. blocked, wp-zep, failed, badsig |
| method | HTTP method and port e.g. GET, POST |
| UA | user agent strings |
| headers | HTTP headers |
| queries | requested queries |
Since
1.4.0
