@@ 956-986 (lines=31) @@ | ||
953 | * |
|
954 | * @return string Assumed site creation date and time. |
|
955 | */ |
|
956 | public function get_assumed_site_creation_date() { |
|
957 | $earliest_registered_users = get_users( |
|
958 | array( |
|
959 | 'role' => 'administrator', |
|
960 | 'orderby' => 'user_registered', |
|
961 | 'order' => 'ASC', |
|
962 | 'fields' => array( 'user_registered' ), |
|
963 | 'number' => 1, |
|
964 | ) |
|
965 | ); |
|
966 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
967 | ||
968 | $earliest_posts = get_posts( |
|
969 | array( |
|
970 | 'posts_per_page' => 1, |
|
971 | 'post_type' => 'any', |
|
972 | 'post_status' => 'any', |
|
973 | 'orderby' => 'date', |
|
974 | 'order' => 'ASC', |
|
975 | ) |
|
976 | ); |
|
977 | ||
978 | // If there are no posts at all, we'll count only on user registration date. |
|
979 | if ( $earliest_posts ) { |
|
980 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
981 | } else { |
|
982 | $earliest_post_date = PHP_INT_MAX; |
|
983 | } |
|
984 | ||
985 | return min( $earliest_registration_date, $earliest_post_date ); |
|
986 | } |
|
987 | ||
988 | /** |
|
989 | * Adds the activation source string as a parameter to passed arguments. |
@@ 4617-4643 (lines=27) @@ | ||
4614 | * |
|
4615 | * @return string Assumed site creation date and time. |
|
4616 | */ |
|
4617 | public static function get_assumed_site_creation_date() { |
|
4618 | $earliest_registered_users = get_users( array( |
|
4619 | 'role' => 'administrator', |
|
4620 | 'orderby' => 'user_registered', |
|
4621 | 'order' => 'ASC', |
|
4622 | 'fields' => array( 'user_registered' ), |
|
4623 | 'number' => 1, |
|
4624 | ) ); |
|
4625 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
4626 | ||
4627 | $earliest_posts = get_posts( array( |
|
4628 | 'posts_per_page' => 1, |
|
4629 | 'post_type' => 'any', |
|
4630 | 'post_status' => 'any', |
|
4631 | 'orderby' => 'date', |
|
4632 | 'order' => 'ASC', |
|
4633 | ) ); |
|
4634 | ||
4635 | // If there are no posts at all, we'll count only on user registration date. |
|
4636 | if ( $earliest_posts ) { |
|
4637 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
4638 | } else { |
|
4639 | $earliest_post_date = PHP_INT_MAX; |
|
4640 | } |
|
4641 | ||
4642 | return min( $earliest_registration_date, $earliest_post_date ); |
|
4643 | } |
|
4644 | ||
4645 | public static function apply_activation_source_to_args( &$args ) { |
|
4646 | list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' ); |