- The selectable recipients are no longer a hand-maintained setting but
every active frontend user of the feedback group (feUserGroup) with a
valid e-mail address; the id is the fe_users uid, so a stored selection
survives users joining or leaving. The `recipients` setting is marked
unused
- Each recipient in the state payload carries label, email and selected
(the stored choice), for a checkbox list with "select all" above the
submit button
- submit accepts the checked ids directly ({"recipients": [uids]}),
validates them against the group, stores and uses them, and reports
the addresses used as sentTo; no selection falls back to mailTo
- migrations/check_fecomment_user.php: all summaries and items of one
user incl. deleted ones, for diagnosis
36 lines
1.8 KiB
PHP
36 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Diagnose: all fe_comment summaries and items of one FE user, including
|
|
* deleted ones, with timestamps. Notes are shortened, no secrets printed.
|
|
* php migrations/check_fecomment_user.php 2
|
|
*/
|
|
$feUser = (int)($argv[1] ?? 0);
|
|
if ($feUser <= 0) {
|
|
fwrite(STDERR, "Aufruf: php migrations/check_fecomment_user.php <fe_users-uid>\n");
|
|
exit(1);
|
|
}
|
|
$settings = require __DIR__ . '/../config/system/settings.php';
|
|
$db = $settings['DB']['Connections']['Default'];
|
|
$pdo = new PDO('mysql:host=' . $db['host'] . ';dbname=' . $db['dbname'] . ';charset=utf8mb4', $db['user'], $db['password']);
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$summaries = $pdo->prepare(
|
|
"SELECT uid, status, deleted, FROM_UNIXTIME(crdate) AS created, FROM_UNIXTIME(tstamp) AS changed,
|
|
FROM_UNIXTIME(NULLIF(sent_at,0)) AS sent, recipients, CHAR_LENGTH(general_notes) AS notes_len
|
|
FROM tx_fecomment_summary WHERE fe_user = ? ORDER BY uid"
|
|
);
|
|
$summaries->execute([$feUser]);
|
|
$items = $pdo->prepare(
|
|
"SELECT uid, deleted, FROM_UNIXTIME(crdate) AS created, FROM_UNIXTIME(tstamp) AS changed, url,
|
|
CHAR_LENGTH(note) AS note_len
|
|
FROM tx_fecomment_feedback WHERE summary = ? ORDER BY sorting"
|
|
);
|
|
foreach ($summaries->fetchAll(PDO::FETCH_ASSOC) as $s) {
|
|
echo "Summary {$s['uid']} | status={$s['status']} deleted={$s['deleted']} | erstellt {$s['created']} | geaendert {$s['changed']}"
|
|
. ($s['sent'] ? " | gesendet {$s['sent']}" : '') . " | recipients=[{$s['recipients']}] | general_notes " . (int)$s['notes_len'] . " Zeichen\n";
|
|
$items->execute([(int)$s['uid']]);
|
|
foreach ($items->fetchAll(PDO::FETCH_ASSOC) as $i) {
|
|
echo " Item {$i['uid']} | deleted={$i['deleted']} | erstellt {$i['created']} | geaendert {$i['changed']} | note " . (int)$i['note_len'] . " Zeichen | {$i['url']}\n";
|
|
}
|
|
}
|