private function get_updates( $assoc_args ) {
		wp_version_check();
		$from_api = get_site_transient( 'update_core' );
		if ( ! $from_api ) {
			return [];
		}

		$compare_version = str_replace( '-src', '', $GLOBALS['wp_version'] );

		$updates = [
			'major' => false,
			'minor' => false,
		];
		foreach ( $from_api->updates as $offer ) {

			$update_type = Utils\get_named_sem_ver( $offer->version, $compare_version );
			if ( ! $update_type ) {
				continue;
			}

			// WordPress follow its own versioning which is roughly equivalent to semver
			if ( 'minor' === $update_type ) {
				$update_type = 'major';
			} elseif ( 'patch' === $update_type ) {
				$update_type = 'minor';
			}

			if ( ! empty( $updates[ $update_type ] ) && ! Comparator::greaterThan( $offer->version, $updates[ $update_type ]['version'] ) ) {
				continue;
			}

			$updates[ $update_type ] = [
				'version'     => $offer->version,
				'update_type' => $update_type,
				'package_url' => ! empty( $offer->packages->partial ) ? $offer->packages->partial : $offer->packages->full,
			];
		}

		foreach ( $updates as $type => $value ) {
			if ( empty( $value ) ) {
				unset( $updates[ $type ] );
			}
		}

		foreach ( [ 'major', 'minor' ] as $type ) {
			if ( true === Utils\get_flag_value( $assoc_args, $type ) ) {
				return ! empty( $updates[ $type ] )
					? [ $updates[ $type ] ]
					: false;
			}
		}
		return array_values( $updates );
	}
private function get_updates( $assoc_args ) {
		wp_version_check();
		$from_api = get_site_transient( 'update_core' );
		if ( ! $from_api ) {
			return [];
		}

		$compare_version = str_replace( '-src', '', $GLOBALS['wp_version'] );

		$updates = [
			'major' => false,
			'minor' => false,
		];
		foreach ( $from_api->updates as $offer ) {

			$update_type = Utils\get_named_sem_ver( $offer->version, $compare_version );
			if ( ! $update_type ) {
				continue;
			}

			// WordPress follow its own versioning which is roughly equivalent to semver
			if ( 'minor' === $update_type ) {
				$update_type = 'major';
			} elseif ( 'patch' === $update_type ) {
				$update_type = 'minor';
			}

			if ( ! empty( $updates[ $update_type ] ) && ! Comparator::greaterThan( $offer->version, $updates[ $update_type ]['version'] ) ) {
				continue;
			}

			$updates[ $update_type ] = [
				'version'     => $offer->version,
				'update_type' => $update_type,
				'package_url' => ! empty( $offer->packages->partial ) ? $offer->packages->partial : $offer->packages->full,
			];
		}

		foreach ( $updates as $type => $value ) {
			if ( empty( $value ) ) {
				unset( $updates[ $type ] );
			}
		}

		foreach ( [ 'major', 'minor' ] as $type ) {
			if ( true === Utils\get_flag_value( $assoc_args, $type ) ) {
				return ! empty( $updates[ $type ] )
					? [ $updates[ $type ] ]
					: false;
			}
		}
		return array_values( $updates );
	}
private function get_updates ( $ assoc_args ) { wp_version_check ( ) ; $ from_api = get_site_transient ( 'update_core' ) ; if ( ! $ from_api ) { return [ ] ; } $ compare_version = str_replace ( '-src' , '' , $ GLOBALS [ 'wp_version' ] ) ; $ updates = [ 'major' => false , 'minor' => false , ] ; foreach ( $ from_api -> updates as $ offer ) { $ update_type = Utils \ get_named_sem_ver ( $ offer -> version , $ compare_version ) ; if ( ! $ update_type ) { continue ; } // WordPress follow its own versioning which is roughly equivalent to semver if ( 'minor' === $ update_type ) { $ update_type = 'major' ; } elseif ( 'patch' === $ update_type ) { $ update_type = 'minor' ; } if ( ! empty ( $ updates [ $ update_type ] ) && ! Comparator :: greaterThan ( $ offer -> version , $ updates [ $ update_type ] [ 'version' ] ) ) { continue ; } $ updates [ $ update_type ] = [ 'version' => $ offer -> version , 'update_type' => $ update_type , 'package_url' => ! empty ( $ offer -> packages -> partial ) ? $ offer -> packages -> partial : $ offer -> packages -> full , ] ; } foreach ( $ updates as $ type => $ value ) { if ( empty ( $ value ) ) { unset ( $ updates [ $ type ] ) ; } } foreach ( [ 'major' , 'minor' ] as $ type ) { if ( true === Utils \ get_flag_value ( $ assoc_args , $ type ) ) { return ! empty ( $ updates [ $ type ] ) ? [ $ updates [ $ type ] ] : false ; } } return array_values ( $ updates ) ; }
Returns update information.
Returns update information .