public/wordpress/wp-content/plugins/backupbuddy/controllers/cron.php
/* cron()
	 *
	 * Master cron handling function as of v6.4.0.9. Wraps all cron functions so we can limit to one cron run per PHP load.
	 * Method to call such as "process_backup" will call the method in this function prefixed with an underscore
	 * "_process_backup" (to prevent accidently directly calling).
	 *
	 */
cron()
Master cron handling function as of v6.4.0.9. Wraps all cron functions so we can limit to one cron run per PHP load.
Method to call such as "process_backup" will call the method in this function prefixed with an underscore
"_process_backup" (to prevent accidently directly calling).
cron () Master cron handling function as of v6 . 4 . 0 . 9 . Wraps all cron functions so we can limit to one cron run per PHP load . Method to call such as " process_backup " will call the method in this function prefixed with an underscore " _process_backup " ( to prevent accidently directly calling ) .
function cron( $method, $args, $rescheduleCount = 0 ) {
		if ( ( 'live_periodic' == $method ) && ( 'live_periodic' == $this->_prev_method ) ) {
			return true;
		}
		if ( ( '1' == pb_backupbuddy::$options['limit_single_cron_per_pass'] ) && ( $this->_methods_ran > 0 ) ) { 
			$rescheduleCount++;
			$nextRun = time() + 1;
			if ( $rescheduleCount >= backupbuddy_constants::CRON_SINGLE_PASS_RESCHEDULE_LIMIT ) { 
				$message = 'Error #8399823: Max cron single pass reschedule limit of `' . backupbuddy_constants::CRON_SINGLE_PASS_RESCHEDULE_LIMIT . '` hit. Method: `' . $method . '`; Args: `' . print_r( $args, true ) . '`. Previous method: `' . $this->_prev_method . '`.';
				pb_backupbuddy::status( 'error', $message );
				if ( 'process_backup' == $method ) { 
					pb_backupbuddy::status( 'error', $message, $args[0] );
				}
				return false;
			}
			if ( false === backupbuddy_core::schedule_single_event( $nextRun, $method, $args, $rescheduleCount ) ) {
				$message = 'Error #838923: Unable to reschedule cron based on setting to limit single cron per pass enabled. Method: `' . $method . '`; Args: `' . print_r( $args, true ) . '`. Reschedule count: `' . $rescheduleCount . '`. Previous method: `' . $this->_prev_method . '`.';
				pb_backupbuddy::status( 'error', $message );
				if ( 'process_backup' == $method ) { 
					pb_backupbuddy::status( 'error', $message, $args[0] );
				}
				return false;
			}
			$message = 'Rescheduled cron for method `' . $method . '` as setting to limit single cron per pass enabled. Details: `' . print_r( $args, true ) . '`. Reschedule count: `' . $rescheduleCount . '`. Previous method: `' . $this->_prev_method . '`.';
			pb_backupbuddy::status( 'details', $message );
			if ( 'process_backup' == $method ) { 
				pb_backupbuddy::status( 'details', $message, $args[0] );
			}
			require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live.php' );
			if ( false !== backupbuddy_live::getLiveID() ) {
				require_once( pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php' );
				pb_backupbuddy_destination_stash2::cron_kick_api( pb_backupbuddy::$options['remote_destinations'][ backupbuddy_live::getLiveID() ] );
			}
			return true;
		}
		$this->_methods_ran++;
		call_user_func_array( array( &$this, '_' . $method ), $args );
		$this->_prev_method = $method;
		return true;
	}
function cron ( $ method , $ args , $ rescheduleCount = 0 ) { if ( ( 'live_periodic' == $ method ) && ( 'live_periodic' == $ this -> _prev_method ) ) { return true ; } if ( ( '1' == pb_backupbuddy :: $ options [ 'limit_single_cron_per_pass' ] ) && ( $ this -> _methods_ran > 0 ) ) { $ rescheduleCount ++ ; $ nextRun = time ( ) + 1 ; if ( $ rescheduleCount >= backupbuddy_constants :: CRON_SINGLE_PASS_RESCHEDULE_LIMIT ) { $ message = 'Error #8399823: Max cron single pass reschedule limit of `' . backupbuddy_constants :: CRON_SINGLE_PASS_RESCHEDULE_LIMIT . '` hit. Method: `' . $ method . '`; Args: `' . print_r ( $ args , true ) . '`. Previous method: `' . $ this -> _prev_method . '`.' ; pb_backupbuddy :: status ( 'error' , $ message ) ; if ( 'process_backup' == $ method ) { pb_backupbuddy :: status ( 'error' , $ message , $ args [ 0 ] ) ; } return false ; } if ( false === backupbuddy_core :: schedule_single_event ( $ nextRun , $ method , $ args , $ rescheduleCount ) ) { $ message = 'Error #838923: Unable to reschedule cron based on setting to limit single cron per pass enabled. Method: `' . $ method . '`; Args: `' . print_r ( $ args , true ) . '`. Reschedule count: `' . $ rescheduleCount . '`. Previous method: `' . $ this -> _prev_method . '`.' ; pb_backupbuddy :: status ( 'error' , $ message ) ; if ( 'process_backup' == $ method ) { pb_backupbuddy :: status ( 'error' , $ message , $ args [ 0 ] ) ; } return false ; } $ message = 'Rescheduled cron for method `' . $ method . '` as setting to limit single cron per pass enabled. Details: `' . print_r ( $ args , true ) . '`. Reschedule count: `' . $ rescheduleCount . '`. Previous method: `' . $ this -> _prev_method . '`.' ; pb_backupbuddy :: status ( 'details' , $ message ) ; if ( 'process_backup' == $ method ) { pb_backupbuddy :: status ( 'details' , $ message , $ args [ 0 ] ) ; } require_once ( pb_backupbuddy :: plugin_path ( ) . '/destinations/live/live.php' ) ; if ( false !== backupbuddy_live :: getLiveID ( ) ) { require_once ( pb_backupbuddy :: plugin_path ( ) . '/destinations/stash2/init.php' ) ; pb_backupbuddy_destination_stash2 :: cron_kick_api ( pb_backupbuddy :: $ options [ 'remote_destinations' ] [ backupbuddy_live :: getLiveID ( ) ] ) ; } return true ; } $ this -> _methods_ran ++ ; call_user_func_array ( array ( & $ this , '_' . $ method ) , $ args ) ; $ this -> _prev_method = $ method ; return true ; }
cron()
 Master cron handling function as of v6.4.0.9.
cron () Master cron handling function as of v6 . 4 . 0 . 9 .
// If trying to run live_periodic a second time, just drop it as we should not have more than one running at once. //error_log( 'cron:' . $method . '; args:' . print_r( $args, true ) ); // If limiting to one cron method per PHP load AND we have already ran one method this PHP process then chunk to next run. //error_log( 'reschedule' ); // Safety net to prevent runaway rescheduling. // If backup process then log to serial log file. // If backup process then log to serial log file. // If backup process then log to serial log file. // If user has BackupBuddy Stash Live then call cron kicker. //error_log( 'rescheduled_cron' );