Created
December 20, 2013 17:10
-
-
Save fjarrett/8058052 to your computer and use it in GitHub Desktop.
Attempt to resolve IP value database error
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
<?php | |
/** | |
* Log handler | |
* @param string $message sprintf-ready error message string | |
* @param array $args sprintf (and extra) arguments to use | |
* @param int $object_id Target object id | |
* @param string $action Action performed (stream_action) | |
* @param int $user_id User responsible for the action | |
* @param array $contexts Contexts of the action | |
* @return void | |
*/ | |
public function log( $connector, $message, $args, $object_id, $contexts, $user_id = null ) { | |
if ( is_null( $user_id ) ) { | |
$user_id = get_current_user_id(); | |
} | |
$ip = filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ); | |
$ip = ( $ip ) ? $ip : null; | |
$recordarr = array( | |
'object_id' => $object_id, | |
'author' => $user_id, | |
'created' => current_time( 'mysql', 1 ), | |
'summary' => vsprintf( $message, $args ), | |
'parent' => self::$instance->prev_record, | |
'connector' => $connector, | |
'contexts' => $contexts, | |
'meta' => $args, | |
'ip' => $ip, | |
); | |
$record_id = WP_Stream_DB::get_instance()->insert( $recordarr ); | |
return $record_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment