get(EntityManager::class); $subscribersRepository = ContainerWrapper::getInstance()->get(SubscribersRepository::class); $subscribersTable = $entityManager->getClassMetadata(SubscriberEntity::class)->getTableName(); $connection = $entityManager->getConnection(); $count = $subscribersRepository->countBy(['linkToken' => null]); if ($count) { $authKey = defined('AUTH_KEY') ? AUTH_KEY : ''; $connection->executeStatement( "UPDATE {$subscribersTable} SET link_token = SUBSTRING(MD5(CONCAT(:authKey, email)), 1, :tokenLength) WHERE link_token IS NULL LIMIT :limit", ['authKey' => $authKey, 'tokenLength' => SubscriberEntity::OBSOLETE_LINK_TOKEN_LENGTH, 'limit' => self::BATCH_SIZE], ['authKey' => \PDO::PARAM_STR, 'tokenLength' => \PDO::PARAM_INT, 'limit' => \PDO::PARAM_INT] ); $this->schedule(); } return true; } public function getNextRunDate() { $wp = new WPFunctions(); return Carbon::createFromTimestamp($wp->currentTime('timestamp')); } }