WatchdogEmailPresenter
extends BasePresenter
in package
Table of Contents
Constants
- MODE_DIGEST : mixed = 2
- SETTINGS_GROUP : mixed = 5
Properties
- $cronLockManager : CronLockManager
- $operationRunner : OperationRunner
- Boundary of one cron action (see {@see self::tryCall()}).
- $settingContext : SettingContext
- $settingManager : SettingManager
- $debugMode : bool
- $productionMode : bool
- $watchdogSendManager : WatchdogSendManager
Methods
- __construct() : mixed
- actionDigest() : void
- Mode 2: daily digest.
- actionPurgeOld() : void
- Queue retention of the watchdog: deletes sent and canceled `*_watchdog_email_rel` rows older than N days, plus e-mails (`*_watchdog_emails` and texts) no row points to anymore.
- actionSend() : void
- Modes 1 (immediate) and 3 (after the advert becomes active).
- releaseLock() : void
- Releases the lock at most once; called by both `shutdown()` and the PHP shutdown function.
- sendResponse() : void
- setConfigParameters() : void
- shutdown() : void
- startup() : void
- isSameSiteRequest() : bool
- Tells whether the request comes from the own site (Nette SameSite cookie); protects GET actions with a side effect.
- sendError() : never
- sendSkipped() : never
- Reports that the job did only part of the work and the next call finishes the rest (e.g. a reindex done in chunks).
- sendSuccess() : never
- tryCall() : bool
- Runs the `action<Action>()` method as one operation (transitional).
- resolveMode() : int
Constants
MODE_DIGEST
private
mixed
MODE_DIGEST
= 2
SETTINGS_GROUP
private
mixed
SETTINGS_GROUP
= 5
Properties
$cronLockManager
public
CronLockManager
$cronLockManager
Attributes
- #[Inject]
$operationRunner
Boundary of one cron action (see {@see self::tryCall()}).
public
OperationRunner
$operationRunner
Attributes
- #[Inject]
$settingContext
public
SettingContext
$settingContext
Attributes
- #[Inject]
$settingManager
public
SettingManager
$settingManager
Attributes
- #[Inject]
$debugMode
protected
bool
$debugMode
= false
$productionMode
protected
bool
$productionMode
= false
$watchdogSendManager read-only
private
WatchdogSendManager
$watchdogSendManager
Methods
__construct()
public
__construct(WatchdogSendManager $watchdogSendManager) : mixed
Parameters
- $watchdogSendManager : WatchdogSendManager
actionDigest()
Mode 2: daily digest.
public
actionDigest() : void
Groups all unsent email_rel records (including older days) by user and sends one summary e-mail
listing all adverts; the whole queue is processed in batches.
URL: /cron/bazaar/watchdog-email/digest?token=xxx
Frequency: once a day, e.g. at 23:00.
Attributes
- #[CronJob]
- $frequency: 'daily:23:00'
- $outbound: true
actionPurgeOld()
Queue retention of the watchdog: deletes sent and canceled `*_watchdog_email_rel` rows older than N days, plus e-mails (`*_watchdog_emails` and texts) no row points to anymore.
public
actionPurgeOld([int|null $days = null ]) : void
Never deletes pending rows. Runs in every mode, so cleanup still happens after sending is turned off.
Retention is ?days, else the setting watchdog.email.retentionDays (group SETTINGS_GROUP), else 90 days.
URL: /cron/bazaar/watchdog-email/purge-old?token=xxx[&days=N]
Frequency: daily.
Parameters
- $days : int|null = null
Attributes
- #[CronJob]
- $frequency: 'daily:04:45'
- $outbound: false
actionSend()
Modes 1 (immediate) and 3 (after the advert becomes active).
public
actionSend() : void
Walks unsent email_rel records and sends each as a separate e-mail.
URL: /cron/bazaar/watchdog-email/send?token=xxx
Frequency: continuously, e.g. every 5-10 minutes.
Attributes
- #[CronJob]
- $frequency: 'every:10'
- $outbound: true
releaseLock()
Releases the lock at most once; called by both `shutdown()` and the PHP shutdown function.
public
releaseLock() : void
sendResponse()
public
sendResponse(Response $response) : void
Parameters
- $response : Response
setConfigParameters()
public
setConfigParameters([bool $debugMode = false ][, bool $productionMode = false ]) : void
Parameters
- $debugMode : bool = false
- $productionMode : bool = false
shutdown()
public
shutdown(Response $response) : void
Parameters
- $response : Response
startup()
public
startup() : void
isSameSiteRequest()
Tells whether the request comes from the own site (Nette SameSite cookie); protects GET actions with a side effect.
protected
isSameSiteRequest() : bool
getHttpRequest() returns the IRequest interface, while isSameSite() exists only on
Nette\Http\Request.
Return values
boolsendError()
protected
sendError(string $message[, int $code = 500 ]) : never
Parameters
- $message : string
- $code : int = 500
Return values
neversendSkipped()
Reports that the job did only part of the work and the next call finishes the rest (e.g. a reindex done in chunks).
protected
sendSkipped(string $reason[, array<string, mixed> $data = [] ]) : never
The scheduler does not record skipped as a run, so the job stays due and is called
again on the next tick.
Parameters
- $reason : string
- $data : array<string, mixed> = []
Return values
neversendSuccess()
protected
sendSuccess([array<string|int, mixed> $data = [] ]) : never
Parameters
- $data : array<string|int, mixed> = []
Return values
nevertryCall()
Runs the `action<Action>()` method as one operation (transitional).
protected
tryCall(string $method, array<string, mixed> $params) : bool
Cron has no internalAction*(): its actions call the Api managers directly, so without this in
scoped mode nothing would ever empty the unit of work of a cron run. The boundary is the action
only; startup() (settings, token, lock) stays outside like the startup of an Api request. A cron
action ends with AbortException from send*(), which is a regular end: the outcome comes from the
response (ok succeeded, skipped unknown — possibly a part of a batch was done, error failed).
Render and signal methods are not wrapped (cron presenters have none).
Parameters
- $method : string
- $params : array<string, mixed>
Return values
boolresolveMode()
private
resolveMode() : int