[STD] Version-provenance sulle segnalazioni (feedback-version-provenance) — mig.062, v1.24.4
feedback_reports += client_surface/client_version/client_build; FeedbackController/Service li salvano; feedback.js li invia (surface web-v2 + version/build da version.json). Standard hub_standards id=30. Smoke verde (provenance salvata, test pulito). NB: il widget feedback.js è oggi dormiente (rimosso dall'iniezione 14/6) → plumbing pronto per la riattivazione. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
3b1d909e6e
commit
14c4c2a7d2
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/** migrate_062_feedback_provenance.php — version-provenance su feedback_reports (std feedback-version-provenance). IDEMPOTENTE. */
|
||||
if (PHP_SAPI !== 'cli') { http_response_code(403); exit("CLI only\n"); }
|
||||
require_once __DIR__.'/../config/env.php'; require_once __DIR__.'/../config/database.php';
|
||||
$pdo=Database::getInstance(); $db=$pdo->query('SELECT DATABASE()')->fetchColumn();
|
||||
function addc($p,$db,$t,$c,$ddl){ $s=$p->prepare("SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?"); $s->execute([$db,$t,$c]); if($s->fetchColumn()){echo " = $t.$c\n";return;} $p->exec("ALTER TABLE `$t` ADD COLUMN $ddl"); echo " + $t.$c\n"; }
|
||||
echo "Mig 062 — version-provenance feedback_reports\n";
|
||||
addc($pdo,$db,'feedback_reports','client_surface',"client_surface VARCHAR(16) NULL");
|
||||
addc($pdo,$db,'feedback_reports','client_version',"client_version VARCHAR(32) NULL");
|
||||
addc($pdo,$db,'feedback_reports','client_build', "client_build VARCHAR(64) NULL");
|
||||
echo "FATTO. Prossima mig=063.\n";
|
||||
@@ -40,6 +40,10 @@ class FeedbackController extends BaseController
|
||||
$descrizione = trim($body['descrizione'] ?? '');
|
||||
$pageUrl = trim($body['page_url'] ?? '');
|
||||
$attachment = $body['attachment'] ?? null; // base64 string
|
||||
// version-provenance (std feedback-version-provenance): superficie + release REALE del prodotto + build
|
||||
$clientSurface = substr(trim((string) ($body['client_surface'] ?? '')), 0, 16) ?: null;
|
||||
$clientVersion = substr(trim((string) ($body['client_version'] ?? '')), 0, 32) ?: null;
|
||||
$clientBuild = substr(trim((string) ($body['client_build'] ?? '')), 0, 64) ?: null;
|
||||
|
||||
if (strlen($descrizione) < 10) {
|
||||
$this->jsonError('Descrizione troppo breve (minimo 10 caratteri).', 422);
|
||||
@@ -67,6 +71,9 @@ class FeedbackController extends BaseController
|
||||
'descrizione' => $descrizione,
|
||||
'page_url' => $pageUrl,
|
||||
'attachment' => $attachment,
|
||||
'client_surface' => $clientSurface,
|
||||
'client_version' => $clientVersion,
|
||||
'client_build' => $clientBuild,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -45,14 +45,19 @@ class FeedbackService
|
||||
$descrizione = $data['descrizione'] ?? '';
|
||||
$pageUrl = $data['page_url'] ?? '';
|
||||
$attachment = $data['attachment'] ?? null;
|
||||
$clientSurface = $data['client_surface'] ?? null;
|
||||
$clientVersion = $data['client_version'] ?? null;
|
||||
$clientBuild = $data['client_build'] ?? null;
|
||||
|
||||
Database::query(
|
||||
'INSERT INTO feedback_reports
|
||||
(organization_id, user_id, user_email, user_role, page_url,
|
||||
tipo, priorita, descrizione, attachment)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
tipo, priorita, descrizione, attachment,
|
||||
client_surface, client_version, client_build)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
[$orgId, $userId, $userEmail, $userRole, $pageUrl,
|
||||
$tipo, $priorita, $descrizione, $attachment]
|
||||
$tipo, $priorita, $descrizione, $attachment,
|
||||
$clientSurface, $clientVersion, $clientBuild]
|
||||
);
|
||||
|
||||
$reportId = (int) Database::lastInsertId();
|
||||
|
||||
Reference in New Issue
Block a user