LLMS_DB_Upgrader::enqueue_updates()

Enqueue and dispatch required updates


Description Description

Adds callbacks for all required updates to the LLMS_Background_Updater and dispatches the updater in the background.

If the update group cannot be auto-updated the following admin notices will be included:

  • The "update started" notice will be immediately displayed/added.
  • The "update complete" notice will be added to the end of the queue (and then displayed when the update is complete).

Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-llms-db-ugrader.php

	public function enqueue_updates() {

		$queued = false;
		foreach ( $this->get_required_updates() as $version => $info ) {

			$prefix = $this->get_callback_prefix( $info, $version );
			foreach ( $info['updates'] as $callback ) {

				$callback = $prefix . $callback;

				$this->updater->log( sprintf( 'Queuing %s - %s', $version, $callback ) );
				$this->updater->push_to_queue( $callback );
				$queued = true;

			}
		}

		// No updates to add, return early.
		if ( ! $queued ) {
			return;
		}

		// Show a start and complete notice for manual updates.
		if ( ! $this->can_auto_update() ) {
			$this->show_notice_started();
			$this->updater->push_to_queue( array( $this, 'show_notice_complete' ) );
		}

		$this->updater->save();

		add_action( 'shutdown', array( 'LLMS_Install', 'dispatch_db_updates' ) );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.6.0 Add namespace prefix to qualifying callback functions.
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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