Changeset 41627 for trunk/src/wp-includes/option.php
- Timestamp:
- 09/28/2017 12:22:48 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r41242 r41627 187 187 global $wpdb; 188 188 189 if ( ! wp_installing() || ! is_multisite() ) 189 if ( ! wp_installing() || ! is_multisite() ) { 190 190 $alloptions = wp_cache_get( 'alloptions', 'options' ); 191 else191 } else { 192 192 $alloptions = false; 193 194 if ( !$alloptions ) { 193 } 194 195 if ( ! $alloptions ) { 195 196 $suppress = $wpdb->suppress_errors(); 196 if ( ! $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )197 if ( ! $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) { 197 198 $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); 198 $wpdb->suppress_errors($suppress); 199 } 200 $wpdb->suppress_errors( $suppress ); 201 199 202 $alloptions = array(); 200 203 foreach ( (array) $alloptions_db as $o ) { 201 204 $alloptions[$o->option_name] = $o->option_value; 202 205 } 203 if ( ! wp_installing() || ! is_multisite() ) 206 207 if ( ! wp_installing() || ! is_multisite() ) { 208 /** 209 * Filters all options before caching them. 210 * 211 * @since 4.9.0 212 * 213 * @param array $alloptions Array with all options. 214 */ 215 $alloptions = apply_filters( 'pre_cache_alloptions', $alloptions ); 204 216 wp_cache_add( 'alloptions', $alloptions, 'options' ); 205 } 206 207 return $alloptions; 217 } 218 } 219 220 /** 221 * Filters all options after retrieving them. 222 * 223 * @since 4.9.0 224 * 225 * @param array $alloptions Array with all options. 226 */ 227 return apply_filters( 'alloptions', $alloptions ); 208 228 } 209 229
Note: See TracChangeset
for help on using the changeset viewer.