From 6d7198f2a63741ffb6e20aba7c6d200324a2ce73 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 5 Apr 2019 11:02:28 -0400 Subject: [PATCH] Add $config->installedAfter($date) and $config->installedBefore($date) methods --- wire/core/Config.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/wire/core/Config.php b/wire/core/Config.php index f4cea1c9..e9b5a606 100644 --- a/wire/core/Config.php +++ b/wire/core/Config.php @@ -449,5 +449,33 @@ class Config extends WireData { public function version($minVersion = '') { 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; + } }