Skip to content

IRSS: Change il_resource_flavour.variant to length 638#11718

Open
lscharmer wants to merge 1 commit into
ILIAS-eLearning:trunkfrom
lscharmer:12/irss/shorten-resorce-flavor-key
Open

IRSS: Change il_resource_flavour.variant to length 638#11718
lscharmer wants to merge 1 commit into
ILIAS-eLearning:trunkfrom
lscharmer:12/irss/shorten-resorce-flavor-key

Conversation

@lscharmer

Copy link
Copy Markdown
Contributor

This PR fixes an issue with the table il_resource_flavour when changing the database collation from utf8mb3 to utf8mb4.

Currently the table cannot be converted to utf8mb4 because the key for the table will be too long:

Error: query: Specified key was too long; max key length is 3072 bytes

This PR shortens the length of the variant field from 768 to 638, which is small enough.

I found one theoretically problematic place:

In ILIAS\ResourceStorage\Flavour\Definition\CropToRectangle 2 concatenated ints and 1 float are saved. Without the float the value has a max length of 40, which leaves 598 chars for the float. Theoretically this is not enough to store every float as a string but the previous value of 728 chars for the float wouldn't cover every float either. So I hope this is still acceptable.

For completeness here are all other (unproblematic) places with their max variant length, in case that I missed something:

  • ILIAS\ILIASObject\Properties\CoreProperties\TileImage\FlavourDefinition.php: Constant 79 chars
  • FirstPageToTileImageFlavourDefinition: Constant 79 chars
  • ilUserProfilePictureDefinition: Constant 71 chars
  • ILIAS\ResourceStorage\Flavour\Definition\CropToSquare: Max 39 chars
  • ILIAS\ResourceStorage\Flavour\Definition\FitToSquare: Max 39 chars
  • ILIAS\ResourceStorage\Flavour\Definition\PagesToExtract: Max 64 chars
  • ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition\ZipStructureDefinition: Saves null
  • ILIAS\ResourceStorage\Flavour\Definition\ToGreyScale: Saves null

This PR is in preparation for an upcoming PR to change the Database charset & collation from utf8mb3 to utf8mb4.

@lscharmer lscharmer requested a review from chfsx July 3, 2026 09:56
@lscharmer lscharmer added improvement php Pull requests that update Php code labels Jul 3, 2026
@lscharmer lscharmer force-pushed the 12/irss/shorten-resorce-flavor-key branch from f8a9c17 to 5ba7c96 Compare July 3, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants