mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added timestamp on configurations #1480
This commit is contained in:
parent
dd058155c8
commit
cb36bdabdf
|
|
@ -5,6 +5,7 @@
|
|||
* Added new `media` and `vardump` Twig functions
|
||||
1. [](#improved)
|
||||
* Put in various checks to ensure Exif is available before trying to use it
|
||||
* Add timestamp to configuration settings [#1445](https://github.com/getgrav/grav/pull/1445)
|
||||
1. [](#bugfix)
|
||||
* Fix an issue saving YAML textarea fields in expert mode [#1480](https://github.com/getgrav/grav/pull/1480)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ abstract class CompiledBase
|
|||
*/
|
||||
public $checksum;
|
||||
|
||||
/**
|
||||
* @var string Timestamp of compiled configuration
|
||||
*/
|
||||
public $timestamp;
|
||||
|
||||
/**
|
||||
* @var string Cache folder to be used.
|
||||
*/
|
||||
|
|
@ -59,9 +64,10 @@ abstract class CompiledBase
|
|||
throw new \BadMethodCallException('Cache folder not defined.');
|
||||
}
|
||||
|
||||
$this->path = $path ? rtrim($path, '\\/') . '/' : '';
|
||||
$this->cacheFolder = $cacheFolder;
|
||||
$this->files = $files;
|
||||
$this->path = $path ? rtrim($path, '\\/') . '/' : '';
|
||||
$this->timestamp = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,6 +90,16 @@ abstract class CompiledBase
|
|||
*/
|
||||
public function modified() {}
|
||||
|
||||
/**
|
||||
* Get timestamp of compiled configuration
|
||||
*
|
||||
* @return int Timestamp of compiled configuration
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
return $this->timestamp ?: time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the configuration.
|
||||
*
|
||||
|
|
@ -196,6 +212,7 @@ abstract class CompiledBase
|
|||
}
|
||||
|
||||
$this->createObject($cache['data']);
|
||||
$this->timestamp = isset($cache['timestamp']) ? $cache['timestamp'] : 0;
|
||||
|
||||
$this->finalizeObject();
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class CompiledConfig extends CompiledBase
|
|||
protected function finalizeObject()
|
||||
{
|
||||
$this->object->checksum($this->checksum());
|
||||
$this->object->timestamp($this->timestamp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class CompiledLanguages extends CompiledBase
|
|||
protected function finalizeObject()
|
||||
{
|
||||
$this->object->checksum($this->checksum());
|
||||
$this->object->timestamp($this->timestamp());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class Config extends Data
|
|||
{
|
||||
protected $checksum;
|
||||
protected $modified = false;
|
||||
protected $timestamp = 0;
|
||||
|
||||
public function key()
|
||||
{
|
||||
|
|
@ -41,6 +42,15 @@ class Config extends Data
|
|||
return $this->modified;
|
||||
}
|
||||
|
||||
public function timestamp($timestamp = null)
|
||||
{
|
||||
if ($timestamp !== null) {
|
||||
$this->timestamp = $timestamp;
|
||||
}
|
||||
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
public function reload()
|
||||
{
|
||||
$grav = Grav::instance();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,15 @@ class Languages extends Data
|
|||
return $this->modified;
|
||||
}
|
||||
|
||||
public function timestamp($timestamp = null)
|
||||
{
|
||||
if ($timestamp !== null) {
|
||||
$this->timestamp = $timestamp;
|
||||
}
|
||||
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
public function reformat()
|
||||
{
|
||||
if (isset($this->items['plugins'])) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user