style: auto-fix 1340 phpcs PSR-12 violations via phpcbf; exclude MissingNamespace and SideEffects
This commit is contained in:
+22
-7
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
error_reporting(E_ALL);
|
||||
@@ -26,8 +27,10 @@ if (!$envVars) {
|
||||
// Strip quotes from values if present (parse_ini_file may include them)
|
||||
foreach ($envVars as $key => $value) {
|
||||
if (is_string($value)) {
|
||||
if ((substr($value, 0, 1) === '"' && substr($value, -1) === '"') ||
|
||||
(substr($value, 0, 1) === "'" && substr($value, -1) === "'")) {
|
||||
if (
|
||||
(substr($value, 0, 1) === '"' && substr($value, -1) === '"') ||
|
||||
(substr($value, 0, 1) === "'" && substr($value, -1) === "'")
|
||||
) {
|
||||
$envVars[$key] = substr($value, 1, -1);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +104,8 @@ if (!is_array($data) || empty($data['title'])) {
|
||||
}
|
||||
|
||||
// Generate hash from stable components
|
||||
function generateTicketHash($data) {
|
||||
function generateTicketHash($data)
|
||||
{
|
||||
$title = (string)($data['title'] ?? '');
|
||||
|
||||
// Prefer explicit serial from payload; fall back to extracting device path from title
|
||||
@@ -139,10 +143,12 @@ function generateTicketHash($data) {
|
||||
$issueCategory = 'network';
|
||||
} elseif (stripos($title, 'Ceph') !== false || stripos($title, '[ceph]') !== false) {
|
||||
$issueCategory = 'ceph';
|
||||
if (stripos($title, '[cluster-wide]') !== false ||
|
||||
if (
|
||||
stripos($title, '[cluster-wide]') !== false ||
|
||||
stripos($title, 'HEALTH_ERR') !== false ||
|
||||
stripos($title, 'HEALTH_WARN') !== false ||
|
||||
stripos($title, 'cluster usage') !== false) {
|
||||
stripos($title, 'cluster usage') !== false
|
||||
) {
|
||||
$isClusterWide = true;
|
||||
}
|
||||
// Normalize the specific Ceph warning type so different warnings get distinct tickets
|
||||
@@ -343,8 +349,17 @@ $insertStmt = $conn->prepare(
|
||||
"INSERT INTO tickets (ticket_id, title, description, status, priority, category, type, hash, created_by)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
$insertStmt->bind_param("ssssssssi",
|
||||
$ticket_id, $title, $description, $status, $priority, $category, $type, $ticketHash, $userId
|
||||
$insertStmt->bind_param(
|
||||
"ssssssssi",
|
||||
$ticket_id,
|
||||
$title,
|
||||
$description,
|
||||
$status,
|
||||
$priority,
|
||||
$category,
|
||||
$type,
|
||||
$ticketHash,
|
||||
$userId
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user