Tribe__PUE__Checker::check_for_updates( array|object $updates = array(), boolean $force_recheck = false )

Check for plugin updates.

The results are stored in the DB option specified in $pue_option_name.


Parameters

$updates

(array|object) (Optional) Existing updates.

Default value: array()

$force_recheck

(boolean) (Optional) Whether to force a recheck of the update status.

Default value: false


Top ↑

Return

(array|object)


Top ↑

Source

File: src/Tribe/PUE/Checker.php

		public function check_for_updates( $updates = array(), $force_recheck = false ) {
			$state = $this->get_state( $force_recheck );

			$state->lastCheck      = time();
			$state->checkedVersion = $this->get_installed_version();

			// Save before checking in case something goes wrong
			$this->update_state( $state );

			$state->update = $this->request_update();

			// If a null update was returned, skip the end of the function.
			if ( null !== $state->update ) {
				//Is there an update to insert?
				if ( version_compare( $state->update->version, $this->get_installed_version(), '>' ) ) {
					if ( empty( $updates ) ) {
						$updates = (object) array( 'response' => array() );
					}

					$updates->response[ $this->get_plugin_file() ] = $state->update->to_wp_format();

					// If the key has expired we should register an appropriate admin notice
					if ( $this->plugin_info->api_expired ) {
						Tribe__Main::instance()->pue_notices()->add_notice( Tribe__PUE__Notices::EXPIRED_KEY, $this->plugin_name );
					}
				}
			}

			$this->update_state( $state );

			return $updates;
		}