@@ 4588-4614 (lines=27) @@ | ||
4585 | * |
|
4586 | * @return string Assumed site creation date and time. |
|
4587 | */ |
|
4588 | public static function get_assumed_site_creation_date() { |
|
4589 | $earliest_registered_users = get_users( array( |
|
4590 | 'role' => 'administrator', |
|
4591 | 'orderby' => 'user_registered', |
|
4592 | 'order' => 'ASC', |
|
4593 | 'fields' => array( 'user_registered' ), |
|
4594 | 'number' => 1, |
|
4595 | ) ); |
|
4596 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
4597 | ||
4598 | $earliest_posts = get_posts( array( |
|
4599 | 'posts_per_page' => 1, |
|
4600 | 'post_type' => 'any', |
|
4601 | 'post_status' => 'any', |
|
4602 | 'orderby' => 'date', |
|
4603 | 'order' => 'ASC', |
|
4604 | ) ); |
|
4605 | ||
4606 | // If there are no posts at all, we'll count only on user registration date. |
|
4607 | if ( $earliest_posts ) { |
|
4608 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
4609 | } else { |
|
4610 | $earliest_post_date = PHP_INT_MAX; |
|
4611 | } |
|
4612 | ||
4613 | return min( $earliest_registration_date, $earliest_post_date ); |
|
4614 | } |
|
4615 | ||
4616 | public static function apply_activation_source_to_args( &$args ) { |
|
4617 | list( $activation_source_name, $activation_source_keyword ) = get_option( 'jetpack_activation_source' ); |
@@ 410-440 (lines=31) @@ | ||
407 | * |
|
408 | * @return string Assumed site creation date and time. |
|
409 | */ |
|
410 | public function get_assumed_site_creation_date() { |
|
411 | $earliest_registered_users = get_users( |
|
412 | array( |
|
413 | 'role' => 'administrator', |
|
414 | 'orderby' => 'user_registered', |
|
415 | 'order' => 'ASC', |
|
416 | 'fields' => array( 'user_registered' ), |
|
417 | 'number' => 1, |
|
418 | ) |
|
419 | ); |
|
420 | $earliest_registration_date = $earliest_registered_users[0]->user_registered; |
|
421 | ||
422 | $earliest_posts = get_posts( |
|
423 | array( |
|
424 | 'posts_per_page' => 1, |
|
425 | 'post_type' => 'any', |
|
426 | 'post_status' => 'any', |
|
427 | 'orderby' => 'date', |
|
428 | 'order' => 'ASC', |
|
429 | ) |
|
430 | ); |
|
431 | ||
432 | // If there are no posts at all, we'll count only on user registration date. |
|
433 | if ( $earliest_posts ) { |
|
434 | $earliest_post_date = $earliest_posts[0]->post_date; |
|
435 | } else { |
|
436 | $earliest_post_date = PHP_INT_MAX; |
|
437 | } |
|
438 | ||
439 | return min( $earliest_registration_date, $earliest_post_date ); |
|
440 | } |
|
441 | ||
442 | /** |
|
443 | * Adds the activation source string as a parameter to passed arguments. |