This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Astra_Addon_Background_Updater::update( bool $fallback )

Push all needed DB updates to the queue for processing.


Description


Parameters

$fallback

(bool) (Required) Fallback migration.


Source

File: classes/class-astra-addon-background-updater.php

		private function update( $fallback ) {

			$current_db_version = Astra_Addon_Update::astra_addon_stored_version();

			error_log( 'Astra Addon: Batch Process Started!' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
			if ( count( $this->get_db_update_callbacks() ) > 0 ) {
				foreach ( $this->get_db_update_callbacks() as $version => $update_callbacks ) {
					if ( version_compare( $current_db_version, $version, '<' ) ) {
						foreach ( $update_callbacks as $update_callback ) {
							if ( $fallback ) {
								call_user_func( $update_callback );
							} else {
								error_log( sprintf( 'Astra Addon: Queuing %s - %s', $version, $update_callback ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
								self::$background_updater->push_to_queue( $update_callback );
							}
						}
					}
				}

				if ( $fallback ) {
					error_log( 'Astra Addon: Running migration without batch processing.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
					self::update_db_version();
				} else {
					$customizer_options = get_option( 'astra-settings' );

					// Get all customizer options.
					$version_array = array(
						'is_astra_addon_queue_running' => true,
					);

					// Merge customizer options with version.
					$astra_options = wp_parse_args( $version_array, $customizer_options );

					update_option( 'astra-settings', $astra_options );

					self::$background_updater->push_to_queue( 'update_db_version' );
				}
			} else {
				self::$background_updater->push_to_queue( 'update_db_version' );
			}
			self::$background_updater->save()->dispatch();
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.