@@ 4595-4621 (lines=27) @@ | ||
4592 | * |
|
4593 | * @return string Assumed site creation date and time. |
|
4594 | */ |
|
4595 | public static function get_assumed_site_creation_date() { |
|
4596 | $earliest_registered_users = get_users( array( |
|
4597 | 'role' => 'administrator', |
|
4598 | 'orderby' => 'user_registered', |
|
4599 | 'order' => 'ASC', |
|
4600 | 'fields' => array( 'user_registered' ), |
|
4601 | 'number' => 1, |
|
4602 | ) ); |
|
4603 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
4604 | ||
4605 | $earliest_posts = get_posts( array( |
|
4606 | 'posts_per_page' => 1, |
|
4607 | 'post_type' => 'any', |
|
4608 | 'post_status' => 'any', |
|
4609 | 'orderby' => 'date', |
|
4610 | 'order' => 'ASC', |
|
4611 | ) ); |
|
4612 | ||
4613 | // If there are no posts at all, we'll count only on user registration date. |
|
4614 | if ( $earliest_posts ) { |
|
4615 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
4616 | } else { |
|
4617 | $earliest_post_date = PHP_INT_MAX; |
|
4618 | } |
|
4619 | ||
4620 | return min( $earliest_registration_date, $earliest_post_date ); |
|
4621 | } |
|
4622 | ||
4623 | public static function apply_activation_source_to_args( &$args ) { |
|
4624 | list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' ); |
@@ 971-1001 (lines=31) @@ | ||
968 | * |
|
969 | * @return string Assumed site creation date and time. |
|
970 | */ |
|
971 | public function get_assumed_site_creation_date() { |
|
972 | $earliest_registered_users = get_users( |
|
973 | array( |
|
974 | 'role' => 'administrator', |
|
975 | 'orderby' => 'user_registered', |
|
976 | 'order' => 'ASC', |
|
977 | 'fields' => array( 'user_registered' ), |
|
978 | 'number' => 1, |
|
979 | ) |
|
980 | ); |
|
981 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
982 | ||
983 | $earliest_posts = get_posts( |
|
984 | array( |
|
985 | 'posts_per_page' => 1, |
|
986 | 'post_type' => 'any', |
|
987 | 'post_status' => 'any', |
|
988 | 'orderby' => 'date', |
|
989 | 'order' => 'ASC', |
|
990 | ) |
|
991 | ); |
|
992 | ||
993 | // If there are no posts at all, we'll count only on user registration date. |
|
994 | if ( $earliest_posts ) { |
|
995 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
996 | } else { |
|
997 | $earliest_post_date = PHP_INT_MAX; |
|
998 | } |
|
999 | ||
1000 | return min( $earliest_registration_date, $earliest_post_date ); |
|
1001 | } |
|
1002 | ||
1003 | /** |
|
1004 | * Adds the activation source string as a parameter to passed arguments. |