Astra_Cache_Base::maybe_get_new_timestamp( string $post_timestamp, string $assets_info )
Returns the current Post Meta/ Option Timestamp or creates a new timestamp.
Description
Parameters
- $post_timestamp
-
(string) (Required) Timestamp of the post meta/ option.
- $assets_info
-
(string) (Required) Gets the assets path info.
Return
(array) $data.
Source
File: classes/cache/class-astra-cache-base.php
public function maybe_get_new_timestamp( $post_timestamp, $assets_info ) {
// Creates a new timestamp if the file does not exists or the timestamp is empty.
// If post_timestamp is empty that means it is an new post or the post is updated and a new file needs to be created.
// If a file does not exists then we need to create a new file.
if ( '' == $post_timestamp || ! file_exists( $assets_info['path'] ) ) {
$timestamp = $this->get_current_timestamp();
$data = array(
'create_new_file' => true,
'timestamp' => $timestamp,
);
} else {
$timestamp = $post_timestamp;
$data = array(
'create_new_file' => false,
'timestamp' => $timestamp,
);
}
return $data;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |