File: //wordpress/mu-plugins/atomic-cli-wpcom-php-errors.php
<?php
/**
* Output contents of php-errors
*
* [--limit=<number>]
* : Limit the number of lines returned
* ---
* default: 100
* ---
*
* @when before_wp_load
*/
function atomic_tail_php_errors( $args, $assoc_args ) {
$limit = (int) $assoc_args['limit'];
$error_log_file = '/tmp/php-errors';
if ( file_exists( $error_log_file ) ) {
system( "/usr/bin/tail -n $limit $error_log_file" );
} else {
WP_CLI::warning( "No php-errors found" );
}
};
if ( class_exists( 'WP_CLI' ) ) {
WP_CLI::add_command( 'php-errors', 'atomic_tail_php_errors' );
}