WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/07/2019 09:11:37 AM (20 months ago)
Author:
SergeyBiryukov
Message:

Date/Time: Reduce explicit local current_time( 'timestamp' ) usage in favor of native PHP functions.

Timestamps don't carry any timezone information, using the intended format directly simplifies the logic and makes the code less confusing.

Props Rarst, jdgrimes.
See #40657.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r44469 r44809  
    519519    if ( $signup != null ) {
    520520        $registered_at = mysql2date( 'U', $signup->registered );
    521         $now           = current_time( 'timestamp', true );
     521        $now           = time();
    522522        $diff          = $now - $registered_at;
    523523        // If registered more than two days ago, cancel registration and let this signup go through.
     
    531531    $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email ) );
    532532    if ( $signup != null ) {
    533         $diff = current_time( 'timestamp', true ) - mysql2date( 'U', $signup->registered );
     533        $diff = time() - mysql2date( 'U', $signup->registered );
    534534        // If registered more than two days ago, cancel registration and let this signup go through.
    535535        if ( $diff > 2 * DAY_IN_SECONDS ) {
     
    689689    $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) ); // TODO: Check email too?
    690690    if ( ! empty( $signup ) ) {
    691         $diff = current_time( 'timestamp', true ) - mysql2date( 'U', $signup->registered );
     691        $diff = time() - mysql2date( 'U', $signup->registered );
    692692        // If registered more than two days ago, cancel registration and let this signup go through.
    693693        if ( $diff > 2 * DAY_IN_SECONDS ) {
Note: See TracChangeset for help on using the changeset viewer.