Files
piratepoet/mailpoet/lib/Util/Installation.php
Rostislav Wolny 33f4b2d729 Replace usage of WP's current_time without gmt parameter in libs
This commit replaces usages by Carbon::now or in case we need a timestamp it
keeps current_time but adds the gtm parameter as true.
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00

30 lines
803 B
PHP

<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Util;
use MailPoet\Settings\SettingsController;
use MailPoetVendor\Carbon\Carbon;
class Installation {
const NEW_INSTALLATION_DAYS_LIMIT = 30;
/** @var SettingsController */
private $settings;
public function __construct(
SettingsController $settings
) {
$this->settings = $settings;
}
public function isNewInstallation() {
$installedAt = $this->settings->get('installed_at');
if (is_null($installedAt)) {
return true;
}
$installedAt = Carbon::createFromTimestamp(strtotime($installedAt));
$currentTime = Carbon::now()->millisecond(0);
return $currentTime->diffInDays($installedAt) <= self::NEW_INSTALLATION_DAYS_LIMIT;
}
}