Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,12 @@ public static function getExistingSettings(): array
'display' => [
[
'name' => 'show_tabs',
'title' => 'Tabs in the header',
'comment' => 'Check the tabs you want to see appear in the header. The unchecked tabs will appear on the right hand menu on the portal homepage and my courses page if these need to appear',
'title' => 'Main menu entries',
'comment' => 'Check the entrie you want to see appear in the main menu',
],
[
'name' => 'show_tabs_per_role',
'title' => 'Show tabs per role',
'title' => 'Main menu entries per role',
'comment' => 'Define header tabs visibility per role.',
],
[
Expand Down
60 changes: 60 additions & 0 deletions src/CoreBundle/Migrations/Schema/V200/Version20251021202800.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/* For licensing terms, see /license.txt */

declare(strict_types=1);

namespace Chamilo\CoreBundle\Migrations\Schema\V200;

use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;

final class Version20251021202800 extends AbstractMigrationChamilo
{
private const DEBUG = true;

public function getDescription(): string
{
return 'Update titles/comments for show_tabs and show_tabs_per_role and ensure they live under category "display".';
}

private const UPDATES = [
'show_tabs' => [
'title' => 'Main menu entries',
'comment' => 'Check the entrie you want to see appear in the main menu',
],
'show_tabs_per_role' => [
'title' => 'Main menu entries per role',
'comment' => 'Define header tabs visibility per role.',
],
];

public function up(Schema $schema): void
{
$conn = $this->connection;

foreach (self::UPDATES as $var => $meta) {
$affected = $conn->executeStatement(
"UPDATE settings
SET title = ?, comment = ?, category = 'display'
WHERE variable = ?",
[$meta['title'], $meta['comment'], $var]
);

$this->dbg(sprintf(
"[UP] variable='%s' -> title='%s', comment='%s', category='display' (rows=%d)",
$var, $meta['title'], $meta['comment'], $affected
));

if ($affected === 0) {
$this->dbg(sprintf("[WARN] No rows found for variable='%s' to update.", $var));
}
}
}

private function dbg(string $msg): void
{
if (self::DEBUG) {
error_log('[MIG][show_tabs_titles] ' . $msg);
}
}
}
Loading