Changeset 44468 for trunk/src/wp-includes/ms-blogs.php
- Timestamp:
- 01/08/2019 08:47:37 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r44467 r44468 757 757 */ 758 758 function update_sitemeta_cache( $site_ids ) { 759 if ( ! is_site_meta_supported() ) {760 return false;761 }762 763 759 return update_meta_cache( 'blog', $site_ids ); 764 760 } … … 1476 1472 */ 1477 1473 function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) { 1478 // Bail if site meta table is not installed. 1479 if ( ! is_site_meta_supported() ) { 1480 /* translators: %s: database table name */ 1481 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); 1482 return false; 1483 } 1484 1485 $added = add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique ); 1486 1487 // Bust site query cache. 1488 if ( $added ) { 1489 wp_cache_set( 'last_changed', microtime(), 'sites' ); 1490 } 1491 1492 return $added; 1474 return add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique ); 1493 1475 } 1494 1476 … … 1509 1491 */ 1510 1492 function delete_site_meta( $site_id, $meta_key, $meta_value = '' ) { 1511 // Bail if site meta table is not installed. 1512 if ( ! is_site_meta_supported() ) { 1513 /* translators: %s: database table name */ 1514 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); 1515 return false; 1516 } 1517 1518 $deleted = delete_metadata( 'blog', $site_id, $meta_key, $meta_value ); 1519 1520 // Bust site query cache. 1521 if ( $deleted ) { 1522 wp_cache_set( 'last_changed', microtime(), 'sites' ); 1523 } 1524 1525 return $deleted; 1493 return delete_metadata( 'blog', $site_id, $meta_key, $meta_value ); 1526 1494 } 1527 1495 … … 1539 1507 */ 1540 1508 function get_site_meta( $site_id, $key = '', $single = false ) { 1541 // Bail if site meta table is not installed.1542 if ( ! is_site_meta_supported() ) {1543 /* translators: %s: database table name */1544 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' );1545 return false;1546 }1547 1548 1509 return get_metadata( 'blog', $site_id, $key, $single ); 1549 1510 } … … 1568 1529 */ 1569 1530 function update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' ) { 1570 // Bail if site meta table is not installed. 1571 if ( ! is_site_meta_supported() ) { 1572 /* translators: %s: database table name */ 1573 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); 1574 return false; 1575 } 1576 1577 $updated = update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value ); 1578 1579 // Bust site query cache. 1580 if ( $updated ) { 1581 wp_cache_set( 'last_changed', microtime(), 'sites' ); 1582 } 1583 1584 return $updated; 1531 return update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value ); 1585 1532 } 1586 1533 … … 1594 1541 */ 1595 1542 function delete_site_meta_by_key( $meta_key ) { 1596 // Bail if site meta table is not installed. 1597 if ( ! is_site_meta_supported() ) { 1598 /* translators: %s: database table name */ 1599 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); 1600 return false; 1601 } 1602 1603 $deleted = delete_metadata( 'blog', null, $meta_key, '', true ); 1604 1605 // Bust site query cache. 1606 if ( $deleted ) { 1607 wp_cache_set( 'last_changed', microtime(), 'sites' ); 1608 } 1609 1610 return $deleted; 1543 return delete_metadata( 'blog', null, $meta_key, '', true ); 1611 1544 } 1612 1545 … … 2310 2243 update_blog_option( $site_id, 'blog_public', $public ); 2311 2244 } 2245 2246 /** 2247 * Sets the last changed time for the 'sites' cache group. 2248 * 2249 * @since 5.1.0 2250 */ 2251 function wp_cache_set_sites_last_changed() { 2252 wp_cache_set( 'last_changed', microtime(), 'sites' ); 2253 } 2254 2255 /** 2256 * Aborts calls to site meta if it is not supported. 2257 * 2258 * @since 5.1.0 2259 * 2260 * @global wpdb $wpdb WordPress database abstraction object. 2261 * 2262 * @param mixed $check Skip-value for whether to proceed site meta function execution. 2263 * @return mixed Original value of $check, or false if site meta is not supported. 2264 */ 2265 function wp_check_site_meta_support_prefilter( $check ) { 2266 if ( ! is_site_meta_supported() ) { 2267 /* translators: %s: database table name */ 2268 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); 2269 return false; 2270 } 2271 2272 return $check; 2273 }
Note: See TracChangeset
for help on using the changeset viewer.