Changeset 25801 for trunk/src/wp-admin/includes/update.php
- Timestamp:
- 10/15/2013 11:02:28 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/update.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update.php
r25783 r25801 92 92 93 93 /** 94 * Gets and caches the checksums for the given version s of WordPress94 * Gets and caches the checksums for the given version of WordPress. 95 95 * 96 96 * @since 3.7.0 97 97 * 98 * @param $version string|array A single version, or an array of versions to fetch 99 * 100 * @return bool|array False on failure, otherwise the array of checksums, keyed by version 101 */ 102 function get_core_checksums( $version ) { 103 if ( ! is_array( $version ) ) 104 $version = array( $version ); 105 98 * @param string $version Version string to query. 99 * @param string $locale Locale to query. 100 * @return bool|array False on failure. An array of checksums on success. 101 */ 102 function get_core_checksums( $version, $locale ) { 106 103 $return = array(); 107 104 108 // Check to see if we have cached copies available, if we do, no need to request them 109 foreach ( $version as $i => $v ) { 110 if ( $checksums = get_site_transient( "core_checksums_$v" ) ) { 111 unset( $version[ $i ] ); 112 $return[ $v ] = $checksums; 113 } 114 } 115 116 // We had cached copies for all of the versions! 117 if ( empty( $version ) ) 118 return $return; 119 120 $url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( array( 'version' => $version ), null, '&' ); 105 $url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' ); 121 106 122 107 if ( wp_http_supports( array( 'ssl' ) ) ) … … 138 123 return false; 139 124 140 // Cache the checksums for later 141 foreach ( $version as $v ) { 142 if ( ! isset( $body['checksums'][ $v ] ) ) 143 $body['checksums'][ $v ] = false; 144 set_site_transient( "core_checksums_$v", $body['checksums'][ $v ], HOUR_IN_SECONDS ); 145 $return[ $v ] = $body['checksums'][ $v ]; 146 } 147 148 // If the API didn't return anything for a version, explicitly set it's return value to false 149 foreach ( $return as $v => $r ) { 150 if ( empty( $r ) ) 151 $return[ $v ] = false; 152 } 153 154 return $return; 125 return $body['checksums']; 155 126 } 156 127
Note: See TracChangeset
for help on using the changeset viewer.