Use UUID for saving inbox messagse. Makes them less likely to clash.
rodzic
3e41d98c35
commit
69b0df6e87
|
@ -269,8 +269,8 @@
|
|||
default => false,
|
||||
} ) {
|
||||
// Save the message in `/data/inbox/`
|
||||
$timestamp = ( new DateTime() )->format( DATE_RFC3339_EXTENDED );
|
||||
$inbox_filename = $timestamp . "." . urlencode( $inbox_type ) . ".json";
|
||||
$uuid = uuid();
|
||||
$inbox_filename = $uuid . "." . urlencode( $inbox_type ) . ".json";
|
||||
file_put_contents( $directories["inbox"] . "/{$inbox_filename}", json_encode( $inbox_message ) );
|
||||
}
|
||||
|
||||
|
@ -1125,7 +1125,10 @@ HTML;
|
|||
if ( isset( $inbox_message["published"] ) ) {
|
||||
$published = $inbox_message["published"];
|
||||
} else {
|
||||
$published = end( explode( "/", explode( ".", $inbox_file)[0] ) ) ;
|
||||
$published_hexstamp = end( explode( "/", explode( "-", $inbox_file)[0] ) ) ;
|
||||
$published_time = hexdec( $published_hexstamp );
|
||||
$published = date( "c", $published_time );
|
||||
|
||||
}
|
||||
// Place in an array where the key is the timestamp
|
||||
$inbox_ordered[$published] = $inbox_message;
|
||||
|
|
Ładowanie…
Reference in New Issue