Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/04/2020 09:57:59 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility: Avoid compatibility issues between MySQL versions.

This commit introduces a new function - bbp_get_empty_datetime() - which returns a valid, filterable, "empty" MySQL formatted datetime value.

This new function is used inside the theme compatibility API to ensure that global WP_Post datetime values are not "0" to better support MySQL 8 and higher, which is dropping support for NO_ZERO_DATES.

Props GDragoN.

In trunk, for 2.7.0.

See #3354.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/abstraction.php

    r6889 r7099  
    476476        : $filtered;
    477477}
     478
     479/** Date/Time *****************************************************************/
     480
     481/**
     482 * Get an empty datetime value.
     483 *
     484 * @since 2.6.6 bbPress (r7094)
     485 *
     486 * @return string
     487 */
     488function bbp_get_empty_datetime() {
     489
     490    // Get the database version
     491    $db_version = bbp_db()->db_version();
     492
     493    // Default return value
     494    $retval = '0000-00-00 00:00:00';
     495
     496    // Filter & return
     497    return (string) apply_filters( 'bbp_get_default_zero_date', $retval, $db_version );
     498}
Note: See TracChangeset for help on using the changeset viewer.