| @@ 1026-1056 (lines=31) @@ | ||
| 1023 | * |
|
| 1024 | * @return string Assumed site creation date and time. |
|
| 1025 | */ |
|
| 1026 | public function get_assumed_site_creation_date() { |
|
| 1027 | $earliest_registered_users = get_users( |
|
| 1028 | array( |
|
| 1029 | 'role' => 'administrator', |
|
| 1030 | 'orderby' => 'user_registered', |
|
| 1031 | 'order' => 'ASC', |
|
| 1032 | 'fields' => array( 'user_registered' ), |
|
| 1033 | 'number' => 1, |
|
| 1034 | ) |
|
| 1035 | ); |
|
| 1036 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
| 1037 | ||
| 1038 | $earliest_posts = get_posts( |
|
| 1039 | array( |
|
| 1040 | 'posts_per_page' => 1, |
|
| 1041 | 'post_type' => 'any', |
|
| 1042 | 'post_status' => 'any', |
|
| 1043 | 'orderby' => 'date', |
|
| 1044 | 'order' => 'ASC', |
|
| 1045 | ) |
|
| 1046 | ); |
|
| 1047 | ||
| 1048 | // If there are no posts at all, we'll count only on user registration date. |
|
| 1049 | if ( $earliest_posts ) { |
|
| 1050 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
| 1051 | } else { |
|
| 1052 | $earliest_post_date = PHP_INT_MAX; |
|
| 1053 | } |
|
| 1054 | ||
| 1055 | return min( $earliest_registration_date, $earliest_post_date ); |
|
| 1056 | } |
|
| 1057 | ||
| 1058 | /** |
|
| 1059 | * Adds the activation source string as a parameter to passed arguments. |
|
| @@ 4676-4702 (lines=27) @@ | ||
| 4673 | * |
|
| 4674 | * @return string Assumed site creation date and time. |
|
| 4675 | */ |
|
| 4676 | public static function get_assumed_site_creation_date() { |
|
| 4677 | $earliest_registered_users = get_users( array( |
|
| 4678 | 'role' => 'administrator', |
|
| 4679 | 'orderby' => 'user_registered', |
|
| 4680 | 'order' => 'ASC', |
|
| 4681 | 'fields' => array( 'user_registered' ), |
|
| 4682 | 'number' => 1, |
|
| 4683 | ) ); |
|
| 4684 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
| 4685 | ||
| 4686 | $earliest_posts = get_posts( array( |
|
| 4687 | 'posts_per_page' => 1, |
|
| 4688 | 'post_type' => 'any', |
|
| 4689 | 'post_status' => 'any', |
|
| 4690 | 'orderby' => 'date', |
|
| 4691 | 'order' => 'ASC', |
|
| 4692 | ) ); |
|
| 4693 | ||
| 4694 | // If there are no posts at all, we'll count only on user registration date. |
|
| 4695 | if ( $earliest_posts ) { |
|
| 4696 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
| 4697 | } else { |
|
| 4698 | $earliest_post_date = PHP_INT_MAX; |
|
| 4699 | } |
|
| 4700 | ||
| 4701 | return min( $earliest_registration_date, $earliest_post_date ); |
|
| 4702 | } |
|
| 4703 | ||
| 4704 | public static function apply_activation_source_to_args( &$args ) { |
|
| 4705 | list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' ); |
|