public/wordpress/wp-content/plugins/backupbuddy/_importbuddy/importbuddy/controllers/pages/default.php
/*	shutdown_function()
 *	
 *	Used for catching fatal PHP errors during backup to write to log for debugging.
 *	
 *	@return		null
 */


Used for catching fatal PHP errors during backup to write to log for debugging.

@return         null
Used for catching fatal PHP errors during backup to write to log for debugging . @return null
function shutdown_function() {
	$e = error_get_last();
	if ( $e === NULL ) { 
		return;
	} else { 
		if ( !is_array( $e ) || ( $e['type'] != E_ERROR ) && ( $e['type'] != E_USER_ERROR ) ) { 
			return;
		}
	}
	$log_directory = backupbuddy_core::getLogDirectory(); 
	$main_file = $log_directory . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
	if ( pb_backupbuddy::$_status_serial != '' ) {
		$serial = pb_backupbuddy::$_status_serial;
		$serial_file = $log_directory . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
		$write_serial = true;
	} else {
		$write_serial = false;
	}
	$e_string = '----- FATAL ERROR ----- A fatal PHP error was encountered: ';
	foreach( (array)$e as $e_line_title => $e_line ) {
		$e_string .= $e_line_title . ' => ' . $e_line . "; ";
	}
	$e_string = rtrim( $e_string, '; ' ) . '.';
	@file_put_contents( $main_file, $e_string, FILE_APPEND );
	$status = pb_backupbuddy::$format->date( time() ) . "\t" .
				sprintf( "%01.2f", round( microtime( true ) - pb_backupbuddy::$start_time, 2 ) ) . "\t" .
				sprintf( "%01.2f", round( memory_get_peak_usage() / 1048576, 2 ) ) . "\t" .
				'error' . "\t\t" .
				str_replace( chr(9), '   ', $e_string )
			;
	$status = str_replace( '\\', '/', $status );
	echo '<script type="text/javascript">pb_status_append("' . str_replace( '"', '&quot;', $status ) . '");</script>';
}
function shutdown_function ( ) { $ e = error_get_last ( ) ; if ( $ e === NULL ) { return ; } else { if ( ! is_array ( $ e ) || ( $ e [ 'type' ] != E_ERROR ) && ( $ e [ 'type' ] != E_USER_ERROR ) ) { return ; } } $ log_directory = backupbuddy_core :: getLogDirectory ( ) ; $ main_file = $ log_directory . 'log-' . pb_backupbuddy :: $ options [ 'log_serial' ] . '.txt' ; if ( pb_backupbuddy :: $ _status_serial != '' ) { $ serial = pb_backupbuddy :: $ _status_serial ; $ serial_file = $ log_directory . 'status-' . $ serial . '_' . pb_backupbuddy :: $ options [ 'log_serial' ] . '.txt' ; $ write_serial = true ; } else { $ write_serial = false ; } $ e_string = '----- FATAL ERROR ----- A fatal PHP error was encountered: ' ; foreach ( ( array ) $ e as $ e_line_title => $ e_line ) { $ e_string .= $ e_line_title . ' => ' . $ e_line . " ;  " ; } $ e_string = rtrim ( $ e_string , '; ' ) . '.' ; @ file_put_contents ( $ main_file , $ e_string , FILE_APPEND ) ; $ status = pb_backupbuddy :: $ format -> date ( time ( ) ) . " \t " . sprintf ( " %01.2f " , round ( microtime ( true ) - pb_backupbuddy :: $ start_time , 2 ) ) . " \t " . sprintf ( " %01.2f " , round ( memory_get_peak_usage ( ) / 1048576 , 2 ) ) . " \t " . 'error' . " \t \t " . str_replace ( chr ( 9 ) , '   ' , $ e_string ) ; $ status = str_replace ( '\\' , '/' , $ status ) ; echo '<script type="text/javascript">pb_status_append("' . str_replace ( '"' , '&quot;' , $ status ) . '");</script>' ; }
shutdown_function()
shutdown_function ()
// Get error message. // Error types: http://php.net/manual/en/errorfunc.constants.php // No error of any kind. // Some type of error. // Return if not a fatal error. //echo '<!-- ' . print_r( $e, true ) . ' -->' . "\n"; // Calculate log directory. // Also handle when in importbuddy. // Determine if writing to a serial log. // Format error message. // Write to log. // IMPORTBUDDY