public/wordpress/wp-content/plugins/backupbuddy/destinations/live/live_periodic.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
public static 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_files = array();
			$statusSerials = pb_backupbuddy::$_status_serial;
			if ( ! is_array( $statusSerials ) ) {
				$statusSerials = array( $statusSerials );
			}
			foreach( $statusSerials as $serial ) {
				$serial_files[] = $log_directory . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
			}
			$write_serial = true;
		} else {
			$write_serial = false;
		}
		$e_string = "---\n" . __( 'Fatal PHP error encountered:', 'it-l10n-backupbuddy' ) . "\n";
		foreach( (array)$e as $e_line_title => $e_line ) {
			$e_string .= $e_line_title . ' => ' . $e_line . "\n";
		}
		$e_string .= "---\n";
		file_put_contents( $main_file, $e_string, FILE_APPEND );
		if ( $write_serial === true ) {
			foreach( $serial_files as $serial_file ) {
				@file_put_contents( $serial_file, $e_string, FILE_APPEND );
			}
		}
	}
public static 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_files = array ( ) ; $ statusSerials = pb_backupbuddy :: $ _status_serial ; if ( ! is_array ( $ statusSerials ) ) { $ statusSerials = array ( $ statusSerials ) ; } foreach ( $ statusSerials as $ serial ) { $ serial_files [ ] = $ log_directory . 'status-' . $ serial . '_' . pb_backupbuddy :: $ options [ 'log_serial' ] . '.txt' ; } $ write_serial = true ; } else { $ write_serial = false ; } $ e_string = " --- \n " . __ ( 'Fatal PHP error encountered:' , 'it-l10n-backupbuddy' ) . " \n " ; foreach ( ( array ) $ e as $ e_line_title => $ e_line ) { $ e_string .= $ e_line_title . ' => ' . $ e_line . " \n " ; } $ e_string .= " --- \n " ; file_put_contents ( $ main_file , $ e_string , FILE_APPEND ) ; if ( $ write_serial === true ) { foreach ( $ serial_files as $ serial_file ) { @ file_put_contents ( $ serial_file , $ e_string , FILE_APPEND ) ; } } }
shutdown_function()
shutdown_function ()
// Get error message. // Error types: http://php.net/manual/en/errorfunc.constants.php //error_log( print_r( $e, true ) ); // No error of any kind. // Some type of error. // Return if not a fatal error. // Calculate log directory. // Also handles when importbuddy. // Determine if writing to a serial log. // Format error message. // Write to log.