License
4 years ago
Notices
3 years ago
pQuery
4 years ago
APIPermissionHelper.php
4 years ago
CdnAssetUrl.php
4 years ago
ConflictResolver.php
4 years ago
Cookies.php
4 years ago
DBCollationChecker.php
4 years ago
DOM.php
4 years ago
DateConverter.php
4 years ago
FreeDomains.php
4 years ago
Helpers.php
4 years ago
Installation.php
4 years ago
ProgressBar.php
4 years ago
SecondLevelDomainNames.php
4 years ago
Security.php
4 years ago
Url.php
4 years ago
index.php
4 years ago
Installation.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace MailPoet\Util; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Settings\SettingsController; |
| 9 | use MailPoet\WP\Functions as WPFunctions; |
| 10 | use MailPoetVendor\Carbon\Carbon; |
| 11 | |
| 12 | class Installation { |
| 13 | const NEW_INSTALLATION_DAYS_LIMIT = 30; |
| 14 | |
| 15 | /** @var SettingsController */ |
| 16 | private $settings; |
| 17 | |
| 18 | /** @var WPFunctions */ |
| 19 | private $wp; |
| 20 | |
| 21 | public function __construct( |
| 22 | SettingsController $settings, |
| 23 | WPFunctions $wp |
| 24 | ) { |
| 25 | $this->settings = $settings; |
| 26 | $this->wp = $wp; |
| 27 | } |
| 28 | |
| 29 | public function isNewInstallation() { |
| 30 | $installedAt = $this->settings->get('installed_at'); |
| 31 | if (is_null($installedAt)) { |
| 32 | return true; |
| 33 | } |
| 34 | $installedAt = Carbon::createFromTimestamp(strtotime($installedAt)); |
| 35 | $currentTime = Carbon::createFromTimestamp($this->wp->currentTime('timestamp')); |
| 36 | return $currentTime->diffInDays($installedAt) <= self::NEW_INSTALLATION_DAYS_LIMIT; |
| 37 | } |
| 38 | } |
| 39 |