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