DataInconsistency
3 weeks ago
License
2 months ago
Notices
2 months ago
pQuery
2 months ago
APIPermissionHelper.php
1 year ago
CdnAssetUrl.php
3 years ago
ConflictResolver.php
1 month ago
Cookies.php
2 months ago
DBCollationChecker.php
2 months ago
DOM.php
2 years ago
DateConverter.php
3 years ago
FreeDomains.php
3 years ago
Headers.php
1 year ago
Helpers.php
1 month ago
Installation.php
1 year ago
LegacyDatabase.php
1 year ago
Request.php
2 months ago
SecondLevelDomainNames.php
3 years ago
Security.php
2 months ago
ThirdPartyOutput.php
1 month ago
Url.php
2 months ago
index.php
3 years ago
Installation.php
33 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Util; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Settings\SettingsController; |
| 9 | use MailPoetVendor\Carbon\Carbon; |
| 10 | |
| 11 | class Installation { |
| 12 | const NEW_INSTALLATION_DAYS_LIMIT = 30; |
| 13 | |
| 14 | /** @var SettingsController */ |
| 15 | private $settings; |
| 16 | |
| 17 | public function __construct( |
| 18 | SettingsController $settings |
| 19 | ) { |
| 20 | $this->settings = $settings; |
| 21 | } |
| 22 | |
| 23 | public function isNewInstallation() { |
| 24 | $installedAt = $this->settings->get('installed_at'); |
| 25 | if (is_null($installedAt)) { |
| 26 | return true; |
| 27 | } |
| 28 | $installedAt = Carbon::createFromTimestamp(strtotime($installedAt)); |
| 29 | $currentTime = Carbon::now()->millisecond(0); |
| 30 | return $currentTime->diffInDays($installedAt) <= self::NEW_INSTALLATION_DAYS_LIMIT; |
| 31 | } |
| 32 | } |
| 33 |