use time() instead of strtotime( 'now' )

This commit is contained in:
Matthias Pfefferle 2023-05-10 18:52:13 +02:00
parent 75c1c6a402
commit 26a1dc9be5
4 changed files with 5 additions and 5 deletions

View file

@ -143,7 +143,7 @@ class Followers {
'single' => true, 'single' => true,
'sanitize_callback' => function( $value ) { 'sanitize_callback' => function( $value ) {
if ( ! is_numeric( $value ) && (int) $value !== $value ) { if ( ! is_numeric( $value ) && (int) $value !== $value ) {
$value = strtotime( 'now' ); $value = \time();
} }
return $value; return $value;

View file

@ -44,7 +44,7 @@ class Activity {
} }
$this->type = \ucfirst( $type ); $this->type = \ucfirst( $type );
$this->published = \gmdate( 'Y-m-d\TH:i:s\Z', \strtotime( 'now' ) ); $this->published = \gmdate( 'Y-m-d\TH:i:s\Z', \time() );
} }
public function __call( $method, $params ) { public function __call( $method, $params ) {

View file

@ -185,7 +185,7 @@ class Follower {
$this->shared_inbox = $meta['inbox']; $this->shared_inbox = $meta['inbox'];
} }
$this->updated_at = \strtotime( 'now' ); $this->updated_at = \time();
} }
/** /**
@ -320,7 +320,7 @@ class Follower {
) )
); );
$this->updated_at = \strtotime( 'now' ); $this->updated_at = \time();
$this->update_term_meta(); $this->update_term_meta();
} }

View file

@ -102,7 +102,7 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
$follower = new \Activitypub\Model\Follower( 'https://example.com/author/jon' ); $follower = new \Activitypub\Model\Follower( 'https://example.com/author/jon' );
update_term_meta( $follower->get_id(), 'updated_at', strtotime( 'now' ) - 804800 ); update_term_meta( $follower->get_id(), 'updated_at', \time() - 804800 );
$followers = \Activitypub\Collection\Followers::get_outdated_followers(); $followers = \Activitypub\Collection\Followers::get_outdated_followers();
$this->assertEquals( 1, count( $followers ) ); $this->assertEquals( 1, count( $followers ) );