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