@@ 4570-4596 (lines=27) @@ | ||
4567 | * |
|
4568 | * @return string Assumed site creation date and time. |
|
4569 | */ |
|
4570 | public static function get_assumed_site_creation_date() { |
|
4571 | $earliest_registered_users = get_users( array( |
|
4572 | 'role' => 'administrator', |
|
4573 | 'orderby' => 'user_registered', |
|
4574 | 'order' => 'ASC', |
|
4575 | 'fields' => array( 'user_registered' ), |
|
4576 | 'number' => 1, |
|
4577 | ) ); |
|
4578 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
4579 | ||
4580 | $earliest_posts = get_posts( array( |
|
4581 | 'posts_per_page' => 1, |
|
4582 | 'post_type' => 'any', |
|
4583 | 'post_status' => 'any', |
|
4584 | 'orderby' => 'date', |
|
4585 | 'order' => 'ASC', |
|
4586 | ) ); |
|
4587 | ||
4588 | // If there are no posts at all, we'll count only on user registration date. |
|
4589 | if ( $earliest_posts ) { |
|
4590 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
4591 | } else { |
|
4592 | $earliest_post_date = PHP_INT_MAX; |
|
4593 | } |
|
4594 | ||
4595 | return min( $earliest_registration_date, $earliest_post_date ); |
|
4596 | } |
|
4597 | ||
4598 | public static function apply_activation_source_to_args( &$args ) { |
|
4599 | list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' ); |
@@ 954-984 (lines=31) @@ | ||
951 | * |
|
952 | * @return string Assumed site creation date and time. |
|
953 | */ |
|
954 | public function get_assumed_site_creation_date() { |
|
955 | $earliest_registered_users = get_users( |
|
956 | array( |
|
957 | 'role' => 'administrator', |
|
958 | 'orderby' => 'user_registered', |
|
959 | 'order' => 'ASC', |
|
960 | 'fields' => array( 'user_registered' ), |
|
961 | 'number' => 1, |
|
962 | ) |
|
963 | ); |
|
964 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
965 | ||
966 | $earliest_posts = get_posts( |
|
967 | array( |
|
968 | 'posts_per_page' => 1, |
|
969 | 'post_type' => 'any', |
|
970 | 'post_status' => 'any', |
|
971 | 'orderby' => 'date', |
|
972 | 'order' => 'ASC', |
|
973 | ) |
|
974 | ); |
|
975 | ||
976 | // If there are no posts at all, we'll count only on user registration date. |
|
977 | if ( $earliest_posts ) { |
|
978 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
979 | } else { |
|
980 | $earliest_post_date = PHP_INT_MAX; |
|
981 | } |
|
982 | ||
983 | return min( $earliest_registration_date, $earliest_post_date ); |
|
984 | } |
|
985 | ||
986 | /** |
|
987 | * Adds the activation source string as a parameter to passed arguments. |