Skip to content

Instantly share code, notes, and snippets.

View pj-dave's full-sized avatar

Dave Matthews pj-dave

View GitHub Profile
<?php
/** XHProf configuration */
if ( isset( $_REQUEST['pressjitsu-profile'] ) && $_REQUEST['pressjitsu-profile'] == 'enable' ) {
xhprof_enable( XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU );
ob_start();
register_shutdown_function( function() {
ob_end_clean();
header( 'Content-type: application/octet-stream' );
header( sprintf( 'Content-Disposition: attachment; filename="%d.perf.xhprof"', time() ) );
<?php
add_action( 'init', function() {
global $wpdb;
if ( empty( $_GET['pageviews-pvc-export'] ) )
return;
$config = get_option( 'pageviews_config' );
echo $config['account'] . PHP_EOL;
<?php
add_action( 'init', function() {
global $wpdb;
$years = 5;
$batch = 500;
if ( empty( $_GET['pageviews-jetpack-stats'] ) )
return;