eZ Community » Blogs » Philippe VINCENT-ROYOL » Limitation languages

By

Limitation languages

Tuesday 31 January 2012 10:05:47 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Pour les personnes francophones ne parlant pas anglais, vous trouverez l'article à cet adresse: http://www.pheelit.fr/HighTech/Developpement/eZ-Publish-Limitation-de-langues

eZ Publish is a great improved CMS (or CXM as you wish), like other CMS of course. Today we ll talk about language limitation.

By default, an eZ Publish installation could natively uses 30 languages by content objects. But if your website needs to exceed this limit, some rules and others limitations should be anticipated.

How language systems works ?

In order not to confuse everyone, i ll detail the system in a simplistic way. Imagine, our machine is running in 32bits.

Each language, created, is assigned to an id mask corresponding to a power of two. Why use it? An example should clarify this ;) Imagine our website manages two languages: French(1st language) and English (2nd language)

In our database, explore ezcontent_language table and you ll find something like that :

 

We observe that each language is incremented by a power of two. So in binary, we get:

000010 for french
000100 for english

etc.

Stay tunned for the next episode ;)

Languages and content objects

This part is funnier. Okay okay, more interesting ;) So each object is mapping with its own content language. If we decide to create a new translation, we ll not create a new entry on our table ezcontentobject, but only change mask language. (Of course new entry with attribute values will be create) If my article is in french and english, binary mask should be :

000110 for french and english

More efficient to find in which language content object exists.

 

Warning : system is running in 32bits mode, so we should have 32 boolean octets. 

Right bit is a flag, to know if object is always available or not. I let you read documentation files :)

Defeating this limitation !

This method is not a miracle but seems to work. An official method should be released soon (hopefully ;))

First step, our server should run in 64bits ! Second step, run apache, php and mysql in 64bits too to avoid wrong datas manipulations.

2 files to hack: first one is located on kernel/classes/ezcontentlanguage.php (line 13) and kernel/classes/ezurlaliasquery.php (line 324)

Replace MAX COUNT from 30 to 63:

13   const MAX_COUNT = 63; 

And for the second file: 

323        $mask = $row['lang_mask'] & ~1;
324        for( $i = 1; $i < 63; ++$i )
325        {

That's all for the code. Now we must change some fields in the database.

We should change INT type field to UNSIGNED BIGINT:

  • ezcobj_state:default_language_id
  • ezcobj_state:language_mask
  • ezcobj_state_group:default_language_id
  • ezcobj_state_group:language_mask
  • ezcobj_state_group_language:default_language_id
  • ezcobj_state_group_language:language_mask
  • ezcobj_state_language:language_id
  • ezcontentclass:initial_language_id
  • ezcontentclass:language_mask
  • ezcontentclass_name:language_id
  • ezcontentobject:initial_language_id
  • ezcontentobject:language_mask
  • ezcontentobject_attribute:language_id
  • ezcontentobject_name:language_id
  • ezcontentobject_version:initial_language_id
  • ezcontentobject_version:language_mask
  • ezcontent_language:id
  • ezurlalias_ml:lang_mask

Tadaaaaa !!!!. You could have 63 languages :) You need more than 63 ? Unfortunately, we should rewrite ezcontentlanguage.php file and more others files to keep a working systems.

You could find a "preview" patch from Gunnstein Lye on public tracker here : http://issues.ez.no/IssueView.php?Id=15040

Have fun

Proudly Developed with from