Fixed an issue with log entries being truncated (Requires administrator action!)

- added a new entry to the admin tools (Administartion -> Administrative tools)
- converts title and change columns in the logs table to text from varchar(255)
pull/541/head
Iglocska 2015-06-05 15:24:26 +02:00
parent 56cff7c186
commit 2b0a1e5c4e
4 changed files with 18 additions and 3 deletions

View File

@ -139,13 +139,13 @@ CREATE TABLE IF NOT EXISTS `jobs` (
CREATE TABLE IF NOT EXISTS `logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`title` text COLLATE utf8_bin DEFAULT NULL,
`created` datetime DEFAULT NULL,
`model` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`model_id` int(11) DEFAULT NULL,
`action` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`change` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`change` text COLLATE utf8_bin DEFAULT NULL,
`email` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`org` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`description` varchar(255) COLLATE utf8_bin DEFAULT NULL,

View File

@ -125,6 +125,16 @@ CREATE TABLE IF NOT EXISTS `template_tags` (
-- --------------------------------------------------------
--
-- Change in the servers table and the logs table, addressing
-- hotfixes 2.3.57 and 2.3.78
--
ALTER TABLE `servers` MODIFY COLUMN `organization` varchar(255) NOT NULL;
ALTER TABLE `logs` MODIFY COLUMN `title` text, MODIFY COLUMN `change` text;
-- --------------------------------------------------------
--
-- Default templates
--

View File

@ -356,9 +356,13 @@ class AppController extends Controller {
$sql = '';
switch ($command) {
case 'extendServerOrganizationLength':
$sql = 'ALTER TABLE servers MODIFY COLUMN organization varchar(255) NOT NULL';
$sql = 'ALTER TABLE `servers` MODIFY COLUMN `organization` varchar(255) NOT NULL;';
$controller = 'Servers';
break;
case 'convertLogFieldsToText':
$sql = 'ALTER TABLE `logs` MODIFY COLUMN `title` text, MODIFY COLUMN `change` text;';
$controller = 'Logs';
break;
default:
$this->Session->setFlash('Invalid command.');
$this->redirect(array('controller' => 'pages', 'action' => 'display', 'administration'));

View File

@ -17,6 +17,7 @@ if (!$isSiteAdmin) exit();
<li><a href="/users/verifyGPG">Verify GPG keys</a> (Check whether every user's GPG key is usable)</li>
<li><a href="/events/generateThreatLevelFromRisk">Upgrade Risk to Threat Level</a> (As of version 2.2 the risk field is replaced by Threat Level. This script will convert all values in risk to threat level.)</li>
<li><a href="/servers/updateDatabase/extendServerOrganizationLength">Extend Organization length</a> (Hotfix 2.3.57: Increase the max length of the organization field when adding a new server connection.)</li>
<li><a href="/servers/updateDatabase/convertLogFieldsToText">Convert log fields to text</a> (Hotfix 2.3.78: Some of the log fields that were varchar(255) ended up truncating the data. This function will change them to "text")</li>
</ul>
</div>
<?php