Remove old Setting model usage from InactiveSubscribersController
[MAILPOET-2436]
This commit is contained in:
committed by
Jack Kitterhing
parent
e636562185
commit
06708e0065
@ -7,14 +7,21 @@ use MailPoet\Config\MP2Migrator;
|
|||||||
use MailPoet\Models\ScheduledTask;
|
use MailPoet\Models\ScheduledTask;
|
||||||
use MailPoet\Models\ScheduledTaskSubscriber;
|
use MailPoet\Models\ScheduledTaskSubscriber;
|
||||||
use MailPoet\Models\SendingQueue;
|
use MailPoet\Models\SendingQueue;
|
||||||
use MailPoet\Models\Setting;
|
|
||||||
use MailPoet\Models\StatisticsOpens;
|
use MailPoet\Models\StatisticsOpens;
|
||||||
use MailPoet\Models\Subscriber;
|
use MailPoet\Models\Subscriber;
|
||||||
|
use MailPoet\Settings\SettingsRepository;
|
||||||
|
|
||||||
class InactiveSubscribersController {
|
class InactiveSubscribersController {
|
||||||
|
|
||||||
private $inactives_task_ids_table_created = false;
|
private $inactives_task_ids_table_created = false;
|
||||||
|
|
||||||
|
/** @var SettingsRepository */
|
||||||
|
private $settings_repository;
|
||||||
|
|
||||||
|
function __construct(SettingsRepository $settings_repository) {
|
||||||
|
$this->settings_repository = $settings_repository;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $days_to_inactive
|
* @param int $days_to_inactive
|
||||||
* @param int $batch_size
|
* @param int $batch_size
|
||||||
@ -185,10 +192,7 @@ class InactiveSubscribersController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function getMP2MigrationDate() {
|
private function getMP2MigrationDate() {
|
||||||
$migration_complete = Setting::where('name', MP2Migrator::MIGRATION_COMPLETE_SETTING_KEY)->findOne();
|
$setting = $this->settings_repository->findOneByName(MP2Migrator::MIGRATION_COMPLETE_SETTING_KEY);
|
||||||
if ($migration_complete === false) {
|
return $setting ? Carbon::instance($setting->getCreatedAt()) : null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Carbon($migration_complete->created_at);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user