Skip to content

Feat: rename oversized containers from their edit form (GLPI 11) - #1311

Merged
Rom1-B merged 3 commits into
11.0/bugfixesfrom
support_45901_11
Oct 27, 2026
Merged

Rom1-B merged 3 commits into
11.0/bugfixesfrom
support_45901_11

Conversation

@Rom1-B

@Rom1-B Rom1-B commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !45901
  • Backport of Feat: rename oversized containers from their edit form #1248 to GLPI 11.
  • When a container's computed table name exceeds MySQL's 64-character limit, the plugin now disables it instead of crashing, and shows a rename form directly on the container's edit page.
  • Submitting a shorter name renames the container and reactivates it; if a table with matching data already exists under that name (e.g. after a version migration), its data is preserved instead of being replaced by an empty table.
  • plugins:fields:check_database now also reports container/item type pairs with no matching table, and tables with no matching container/item type pair.

Screenshots (if appropriate):

@MyvTsv MyvTsv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please apply this review?

#1248 (comment)

@Rom1-B
Rom1-B requested a review from MyvTsv October 26, 2026 09:36
Comment thread inc/container.class.php Outdated
$data_preserved = true;
} else {
// Empty leftover table: drop it, a fresh one is created below.
$migration->dropTable($old_table);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the old or orphan table exists but is empty, it is dropped and recreated through self::create(), whose install() only creates the base columns, so the container's existing fields lose their columns. Saving a value afterwards silently stores nothing. Maybe it would be better to rename the empty table instead of dropping it, like when it contains data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the table is now renamed even when empty, with a test. Same fix applied to #1248.

@Rom1-B
Rom1-B requested a review from Mary-Clb October 27, 2026 13:02
@Rom1-B
Rom1-B merged commit 920c601 into 11.0/bugfixes Oct 27, 2026
7 checks passed
@Rom1-B
Rom1-B deleted the support_45901_11 branch October 27, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants