Skip to content

Commit

Permalink
Issue #27 - use blog_id in daily trace summary report file name
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Aug 2, 2016
1 parent d88337c commit 966f947
Showing 1 changed file with 48 additions and 22 deletions.
70 changes: 48 additions & 22 deletions includes/oik-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,26 +459,30 @@ function bw_trace_determine_request() {
* Record the summary values for this transaction
*
* Note: The columns are dynamically created from the fields recorded by bw_trace_status_report()
*
* 0 - request
* 1 - AJAX action
* 2 - elapsed ( final figure )
* 3 - PHP version
* 4 - PHP functions
* 5 - User functions
* 6 - Classes
* 7 - Plugins
* 8 - Files
* 9 - Registered Widgets
* 10 - Post types
* 11 - Taxonomies
* 12 - Queries
* 13 - Query time
* 14 - Trace file
* 15 - Trace records
* 16 - Remote address ( IP address )
* 17 - Elapsed
* 18 - Date - ISO 8601 date
*
* Index | Field
* ----- | -----------
* 0 | request
* 1 | AJAX action
* 2 | elapsed ( final figure )
* 3 | PHP version
* 4 | PHP functions
* 5 | User functions
* 6 | Classes
* 7 | Plugins
* 8 | Files
* 9 | Registered Widgets
* 10 | Post types
* 11 | Taxonomies
* 12 | Queries
* 13 | Query time
* 14 | Trace file
* 15 | Trace records
* 16 | Remote address ( IP address )
* 17 | Elapsed
* 18 | Date - ISO 8601 date
* 19 | HTTP user agent
* 20 | REQUEST_METHOD
*/
function bw_record_vt( $vnoisy=false ) {
global $vt_values, $vt_text;
Expand All @@ -500,10 +504,32 @@ function bw_record_vt( $vnoisy=false ) {
$line .= bw_array_get( $_SERVER, "REQUEST_METHOD", null );

$line .= PHP_EOL;
$file = ABSPATH . "bwtrace.vt." . date( "md" );
$file = bw_trace_vt_file();
bw_write( $file, $line );
}

/**
* Returns the 'vt' file name
*
* Format: bwtrace.vt.mmdd
*
* For WPMS this includes the blog ID, but not the site ID
*
* Format: bwtrace.vt.mmdd.blog_ID
*
* @return string Fully qualified file name
*/
function bw_trace_vt_file() {
$file = ABSPATH . "bwtrace.vt." . date( "md" );
global $blog_id;
bw_trace2( $blog_id, "blog_id !$blog_id!", false, BW_TRACE_VERBOSE );
if ( $blog_id != 1 ) {
$file .= ".$blog_id";
}
return( $file );
}


/**
* Extract the HTTP_USER_AGENT
*
Expand Down Expand Up @@ -556,7 +582,7 @@ function bw_trace_get_hook_type( $hook ) {
* * the request is an AJAX request
* * the request is a JSON request
* * the request is for robots.txt
* * the request is an async-upload
* * the request is an async|upload
* * the request is an async-upload of a new file ( $_REQUEST contains "short" )
* * the request is a SiteGround cache check
* * and other situations we don't yet know about
Expand Down

0 comments on commit 966f947

Please sign in to comment.