<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Events on wt-modules</title><link>https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/</link><description>Recent content in Events on wt-modules</description><generator>Hugo</generator><language>en</language><atom:link href="https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/index.xml" rel="self" type="application/rss+xml"/><item><title>Pseudo-events</title><link>https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/pseudo/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/pseudo/</guid><description>&lt;p&gt;webtrees has no event bus, so core actions (logins, failed logins, logouts, record edits, errors, searches) are detected by &lt;strong&gt;polling the webtrees log table&lt;/strong&gt; (&lt;code&gt;app/Log.php&lt;/code&gt;, table &lt;code&gt;log&lt;/code&gt;) and firing an event per new matching log entry. It is &lt;strong&gt;off by default&lt;/strong&gt;: nothing runs until you enable the offered &lt;code&gt;cronjob:pseudo-events&lt;/code&gt; job.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Built-in events&lt;/strong&gt; (one &lt;code&gt;cj_event&lt;/code&gt; per new log row, payload = the row):&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th style="text-align: left"&gt;Event&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th style="text-align: left"&gt;Log filter (log_type, message prefix)&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th style="text-align: left"&gt;Fires when&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-auth-failed&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;Login failed&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a login attempt failed (wrong password, unknown user, unverified, not approved, no session cookies)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-auth-login&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;Login:&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a user logged in&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-auth-logout&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;Logout:&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a user logged out&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-error&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;error&lt;/code&gt;, –&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;an exception was caught and logged (the message is the trace)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-edit-update&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;edit&lt;/code&gt;, &lt;code&gt;Update:&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a record was updated (&lt;code&gt;GedcomRecord::updateRecord()&lt;/code&gt;)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-edit-delete&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;edit&lt;/code&gt;, &lt;code&gt;Delete:&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a record was deleted (&lt;code&gt;GedcomRecord::deleteRecord()&lt;/code&gt;)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;cronjob:log-search&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;&lt;code&gt;search&lt;/code&gt;, –&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;a search ran (&lt;strong&gt;one log row per searched tree&lt;/strong&gt;)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;&lt;strong&gt;Payload:&lt;/strong&gt; &lt;code&gt;log_id&lt;/code&gt;, &lt;code&gt;log_time&lt;/code&gt;, &lt;code&gt;log_message&lt;/code&gt; (truncated to 250 characters, UTF-8-safe) plus &lt;code&gt;gedcom_id&lt;/code&gt; / &lt;code&gt;user_id&lt;/code&gt; when the log row carries them. The message prefixes are the hard-coded English strings of the current core; a core update that changes them silently stops the matching event (no fallback by design) — the event catalog descriptions and the &lt;code&gt;test-pseudo-events&lt;/code&gt; suite pin the current mapping.&lt;/p&gt;</description></item><item><title>Route events</title><link>https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/route/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://bschwede.codeberg.page/wt-modules/en/docs/cronjob/events/route/</guid><description>&lt;p&gt;A complementary, &lt;em&gt;immediate&lt;/em&gt; detection mechanism: instead of polling state on a schedule, the module observes the HTTP request itself. When a request to a &lt;strong&gt;mapped mutating route&lt;/strong&gt; has been handled successfully (2xx/3xx), it queues the matching event into the same &lt;code&gt;cj_event&lt;/code&gt; queue — a listening event job then reacts at the next tick (~60 s), with no polling latency.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Which routes are mapped&lt;/strong&gt; — two rules, both derived from the live webtrees route table. Common prerequisites: path starts with &lt;code&gt;/tree/{tree}/&lt;/code&gt;, the handler is in webtrees&amp;rsquo; request-handler namespace (&lt;code&gt;RequestHandlers&lt;/code&gt; in 2.2.6, &lt;code&gt;Controllers&lt;/code&gt; in 2.3), and the request is a &lt;strong&gt;POST&lt;/strong&gt; mutation. In 2.2.6 this is enforced at map time (GET page routes are not mapped); in 2.3 the route carries no HTTP method, so the POST check happens at fire-time and the GET form-load of the same route is ignored.&lt;/p&gt;</description></item></channel></rss>