<?php namespace MailPoet\Cron\Workers; if (!defined('ABSPATH')) exit; use MailPoet\Models\ScheduledTask; use MailPoet\Models\Subscriber; use MailPoet\WP\Functions as WPFunctions; use MailPoetVendor\Carbon\Carbon; use MailPoetVendor\Idiorm\ORM; if (!defined('ABSPATH')) exit; class SubscriberLinkTokens extends SimpleWorker { const TASK_TYPE = 'subscriber_link_tokens'; const BATCH_SIZE = 10000; const AUTOMATIC_SCHEDULING = false; public function processTaskStrategy(ScheduledTask $task, $timer) { $count = Subscriber::whereNull('link_token')->count(); if ($count) { $authKey = defined('AUTH_KEY') ? AUTH_KEY : ''; ORM::rawExecute( sprintf('UPDATE %s SET link_token = SUBSTRING(MD5(CONCAT(?, email)), 1, ?) WHERE link_token IS NULL LIMIT ?', Subscriber::$_table), [$authKey, Subscriber::OBSOLETE_LINK_TOKEN_LENGTH, self::BATCH_SIZE] ); $this->schedule(); } return true; } public function getNextRunDate() { $wp = new WPFunctions(); return Carbon::createFromTimestamp($wp->currentTime('timestamp')); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
KeyCheck | Folder | 0755 |
|
|
SendingQueue | Folder | 0755 |
|
|
StatsNotifications | Folder | 0755 |
|
|
AuthorizedSendingEmailsCheck.php | File | 888 B | 0644 |
|
Beamer.php | File | 1.61 KB | 0644 |
|
Bounce.php | File | 5.69 KB | 0644 |
|
ExportFilesCleanup.php | File | 863 B | 0644 |
|
InactiveSubscribers.php | File | 2.28 KB | 0644 |
|
Scheduler.php | File | 8.62 KB | 0644 |
|
SimpleWorker.php | File | 2.55 KB | 0644 |
|
SubscriberLinkTokens.php | File | 1.06 KB | 0644 |
|
SubscribersCountCacheRecalculation.php | File | 3.31 KB | 0644 |
|
SubscribersEngagementScore.php | File | 2.36 KB | 0644 |
|
SubscribersLastEngagement.php | File | 4.76 KB | 0644 |
|
UnsubscribeTokens.php | File | 1.67 KB | 0644 |
|
WooCommercePastOrders.php | File | 2.37 KB | 0644 |
|
WooCommerceSync.php | File | 1.01 KB | 0644 |
|
WorkersFactory.php | File | 3.96 KB | 0644 |
|
index.php | File | 0 B | 0644 |
|