Created
April 30, 2020 17:30
-
-
Save bwmarkle/1236023235a724ff3747c31063e78aa3 to your computer and use it in GitHub Desktop.
Code examples used in https://youtu.be/cUeV3S7NGcU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code examples used in https://youtu.be/cUeV3S7NGcU | |
# How to specify your error_log file | |
ini_set( "error_log", "/home/user/error_log.txt" ); | |
--- | |
# How to hook into pre_update_option_{$option} | |
/* | |
* Log to our error log when Total Upkeep settings are updated. | |
* | |
* @param mixed $value The new, unserialized option value. | |
* @param mixed $old_value The old option value. | |
* @param string $option Option name. | |
*/ | |
add_filter( 'pre_update_option_boldgrid_backup_settings', function( $value, $old_value, $option ) { | |
$e = new \Exception(); | |
$e = explode( "\n", $e->getTraceAsString() ); | |
error_log( print_r( array( | |
'Message:' => 'Total Upkeep settings have been updated.', | |
'Old value for ftp retention:' => empty( $old_value['remote']['ftp']['retention_count'] ) ? 'empty' : $old_value['remote']['ftp']['retention_count'], | |
'New value for ftp retention:' => empty( $value['remote']['ftp']['retention_count'] ) ? 'empty' : $value['remote']['ftp']['retention_count'], | |
'Trace:' => $e, | |
),1)); | |
return $value; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment