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