BP_Background_Updater::task( string $callback )

Task

Description

Override this method to perform any actions required on each queue item. Return the modified item for further processing in the next pass through. Or, return false to remove the item from the queue.

Parameters

$callback

(Required) Update callback function.

Return

(string|bool)

Source

File: bp-core/classes/class-bp-background-updater.php

		protected function task( $callback ) {
			$result = false;

			if ( is_callable( $callback ) ) {
				error_log( sprintf( 'Running %s callback', $callback ) );
				$result = (bool) call_user_func( $callback, $this );

				if ( $result ) {
					error_log( sprintf( '%s callback needs to run again', $callback ) );
				} else {
					error_log( sprintf( 'Finished running %s callback', $callback ) );
				}
			} else {
				error_log( sprintf( 'Could not find %s callback', $callback ) );
			}

			return $result ? $callback : false;
		}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.