Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Sources/Db/Schema/v3_0/LogReportedComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ public function __construct()
),
'comment' => new Column(
name: 'comment',
type: 'varchar',
size: 255,
type: 'text',
not_null: true,
default: '',
),
'time_sent' => new Column(
name: 'time_sent',
Expand Down
71 changes: 71 additions & 0 deletions Sources/Maintenance/Migration/v3_0/ReportCommentLength.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2026 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 3.0 Alpha 4
*/

declare(strict_types=1);

namespace SMF\Maintenance\Migration\v3_0;

use SMF\Db\Schema;
use SMF\Maintenance\Migration\MigrationBase;

class ReportCommentLength extends MigrationBase
{
/*******************
* Public properties
*******************/

/**
*
*/
public string $name = 'Widening the report comment to fit its entity encoded form';

/****************
* Public methods
****************/

/**
*
*/
public function isCandidate(): bool
{
$table = new Schema\v3_0\LogReportedComments();
$existing_structure = $table->getCurrentStructure();

foreach ($existing_structure['columns'] as $column) {
if ($column['name'] === 'comment') {
return $column['type'] !== $table->columns['comment']->type;
}
}

return false;
}

/**
*
*/
public function execute(): bool
{
$table = new Schema\v3_0\LogReportedComments();

foreach ($table->columns as $column) {
if ($column->name === 'comment') {
// A text column takes no default, so the varchar one has to go.
$column->drop_default = true;

$table->alterColumn($column);
}
}

return true;
}
}
1 change: 1 addition & 0 deletions Sources/Maintenance/Tools/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class Upgrade extends ToolsBase implements ToolsInterface
Migration\v3_0\PermissionChanges::class,
Migration\v3_0\BoardPostsCount::class,
Migration\v3_0\ValidationCodeLength::class,
Migration\v3_0\ReportCommentLength::class,
],
];

Expand Down