mirror of
https://github.com/processwire/processwire.git
synced 2025-08-14 10:45:54 +02:00
Add $config->installedAfter($date) and $config->installedBefore($date) methods
This commit is contained in:
@@ -449,5 +449,33 @@ class Config extends WireData {
|
|||||||
public function version($minVersion = '') {
|
public function version($minVersion = '') {
|
||||||
return version_compare($this->version, $minVersion) >= 0;
|
return version_compare($this->version, $minVersion) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Was this ProcessWire installation installed after a particular date?
|
||||||
|
*
|
||||||
|
* @param int|string $date Unix timestamp or strtotime() compatible date string
|
||||||
|
* @return bool
|
||||||
|
* @see Config::installedBefore(), Config::installed
|
||||||
|
* @since 3.0.129
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function installedAfter($date) {
|
||||||
|
if(!ctype_digit("$date")) $date = strtotime($date);
|
||||||
|
return $this->installed > $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Was this ProcessWire installation installed before a particular date?
|
||||||
|
*
|
||||||
|
* @param int|string $date Unix timestamp or strtotime() compatible date string
|
||||||
|
* @return bool
|
||||||
|
* @see Config::installedAfter(), Config::installed
|
||||||
|
* @since 3.0.129
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function installedBefore($date) {
|
||||||
|
if(!ctype_digit("$date")) $date = strtotime($date);
|
||||||
|
return $this->installed < $date;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user