fix: [internal] Raise size for access_logs action column

pull/9538/head
Jakub Onderka 2024-01-31 16:26:59 +01:00
parent 065b492280
commit 3d8a3919d0
2 changed files with 19 additions and 7 deletions

View File

@ -86,7 +86,7 @@ class AppModel extends Model
99 => false, 100 => false, 101 => false, 102 => false, 103 => false, 104 => false,
105 => false, 106 => false, 107 => false, 108 => false, 109 => false, 110 => false,
111 => false, 112 => false, 113 => true, 114 => false, 115 => false, 116 => false,
117 => false, 118 => false
117 => false, 118 => false, 119 => false,
);
const ADVANCED_UPDATES_DESCRIPTION = array(
@ -2006,6 +2006,9 @@ class AppModel extends Model
case 118:
$sqlArray[] = "ALTER TABLE `event_reports` MODIFY `content` mediumtext;";
break;
case 119:
$sqlArray[] = "ALTER TABLE `access_logs` MODIFY `action` varchar(191) NOT NULL";
break;
case 'fixNonEmptySharingGroupID':
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
@ -4018,6 +4021,12 @@ class AppModel extends Model
*/
public function _remoteIp()
{
static $remoteIp;
if ($remoteIp) {
return $remoteIp;
}
$clientIpHeader = Configure::read('MISP.log_client_ip_header');
if ($clientIpHeader && isset($_SERVER[$clientIpHeader])) {
$headerValue = $_SERVER[$clientIpHeader];
@ -4025,9 +4034,12 @@ class AppModel extends Model
if (($commaPos = strpos($headerValue, ',')) !== false) {
$headerValue = substr($headerValue, 0, $commaPos);
}
return trim($headerValue);
$remoteIp = trim($headerValue);
} else {
$remoteIp = $_SERVER['REMOTE_ADDR'] ?? null;
}
return $_SERVER['REMOTE_ADDR'] ?? null;
return $remoteIp;
}
public function find($type = 'first', $query = array())
@ -4060,7 +4072,7 @@ class AppModel extends Model
return false;
}
public function checkParam($param)
private function checkParam($param)
{
return preg_match('/^[\w\_\-\. ]+$/', $param);
}

View File

@ -115,10 +115,10 @@
"column_name": "action",
"is_nullable": "NO",
"data_type": "varchar",
"character_maximum_length": "20",
"character_maximum_length": "191",
"numeric_precision": null,
"collation_name": "utf8mb4_unicode_ci",
"column_type": "varchar(20)",
"column_type": "varchar(191)",
"column_default": null,
"extra": ""
},
@ -9702,5 +9702,5 @@
"uuid": false
}
},
"db_version": "118"
"db_version": "119"
}