Forums / Developer / 30 languages limitation

30 languages limitation

Author Message

Andreas Adelsberger

Tuesday 09 June 2009 7:11:32 am

Hi,

i need more than 30 languages.

I have changed the language_id fields to bigint and changed the constant, that limited the amount of languages. Is there anything else I have to change?

Thanx in advance.

greetz Andi.

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Gunnstein Lye

Tuesday 09 June 2009 8:12:12 am

There is one instance where it is hardcoded. Below you will find the patch I used, it covers 3 files. There may be others I have missed; I have not tested this much, but it seemed to work fine.

It's good you're testing this. If you are successful it would be great if you could create an enhancement request in the issue tracker, with your patches.

Index: kernel/classes/ezcontentlanguage.php
===================================================================
--- kernel/classes/ezcontentlanguage.php    (revision 1075)
+++ kernel/classes/ezcontentlanguage.php    (working copy)
@@ -31,8 +31,6 @@

 class eZContentLanguage extends eZPersistentObject
 {
-    const MAX_COUNT = 30;
-
     /**
      * Constructor.
      *
@@ -78,7 +76,7 @@
      * \param name Optional. Name of the language. If not specified, the international language name for the $locale locale
      *             will be used.
      * \return eZContentLanguage object of the added language (or the existing one if specified language has been already used)
-     *         or false in case of any error (invalid locale code or already reached eZContentLanguage::MAX_COUNT languages).
+     *         or false in case of any error (invalid locale code or already reached eZContentLanguage::maxCount() languages).
      * \static
      */
     static function addLanguage( $locale, $name = null )
@@ -105,7 +103,7 @@
             return $existingLanguage;
         }

-        if ( count( $languages ) >= eZContentLanguage::MAX_COUNT )
+        if ( count( $languages ) >= eZContentLanguage::maxCount() )
         {
             eZDebug::writeError( 'Too many languages, cannot add more!', 'eZContentLanguage::addLanguage' );
             return false;
@@ -881,6 +879,19 @@
                $GLOBALS['eZContentLanguageMask'],
                $GLOBALS['eZContentLanguageCronjobMode'] );
     }
+
+    /**
+     * The maximum number of languages supported.
+     * On 64-bit platforms we support more languages. PHP uses signed integers,
+     * so we can use 63 bits on 64 bits hardware, or 31 on 32-bit. The database
+     * uses a 64-bit integer on all platforms.
+     *
+     * \static
+     */
+    static function maxCount()
+    {
+        return PHP_INT_SIZE == 8 ? 63 : 31;
+    }
 }

 ?>
Index: extension/ezurlaliasmigration/classes/ezpurlaliasquerystrict.php
===================================================================
--- extension/ezurlaliasmigration/classes/ezpurlaliasquerystrict.php    (revision 1075)
+++ extension/ezurlaliasmigration/classes/ezpurlaliasquerystrict.php    (working copy)
@@ -80,7 +80,7 @@

         $list = array();

-        $maxNumberOfLanguges = eZContentLanguage::MAX_COUNT;
+        $maxNumberOfLanguges = eZContentLanguage::maxCount();
         $maxInteger = pow( 2, $maxNumberOfLanguges );
         $defaultLanguage = eZContentLanguage::topPriorityLanguage();

Index: kernel/classes/ezurlaliasquery.php
===================================================================
--- kernel/classes/ezurlaliasquery.php  (revision 1075)
+++ kernel/classes/ezurlaliasquery.php  (working copy)
@@ -338,11 +338,12 @@
         if ( !is_array( $rows ) || count( $rows ) == 0 )
             return array();
         $list = array();
+        $maxNumberOfLanguges = eZContentLanguage::maxCount();
         foreach ( $rows as $row )
         {
             $row['always_available'] = $row['lang_mask'] % 2;
             $mask = $row['lang_mask'] & ~1;
-            for ( $i = 1; $i < 30; ++$i )
+            for ( $i = 1; $i < $maxNumberOfLanguges; ++$i )
             {
                 $newMask = (1 << $i);
                 if ( ($newMask & $mask) > 0 )

Gaetano Giunta

Tuesday 09 June 2009 8:46:15 am

Maybe implicit in the previous posts, but you will have to compile php in 64 bit mode

Principal Consultant International Business
Member of the Community Project Board

Björn Dieding@xrow.de

Tuesday 09 June 2009 10:33:02 am

Can someone make a feature request out of this?

We need this sooner or later anyway.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Andreas Adelsberger

Tuesday 09 June 2009 11:28:47 pm

I filed a feature request:

http://issues.ez.no/IssueView.php?Id=15040

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Stefan Gross

Friday 17 July 2009 9:27:22 am

Hi,
is there a patch for eZ Publish version 3.9.4?

In version 3.9.4 the method eZContentLanguage->sqlFilter() also needs some modifications in order to support more than 30 languages.

Unfortunately there is not inline documentation about the language_mask handling.

Best regards
Stefan

Guillaume Kulakowski

Tuesday 22 February 2011 9:58:04 am

Is there a solution since 2009 ? Apply a patch to DB and kernel is it a good solution ?

My blog : http://www.llaumgui.com (not in eZ Publish ;-))
eZC on RHEL : http://blog.famillecollet.com/pages/Config-en
eZC on Fedora : just "yum install php-channel-ezc"

eZ debug

Timing: Jan 18 2025 02:00:17
Script start
Timing: Jan 18 2025 02:00:17
Module start 'content'
Timing: Jan 18 2025 02:00:17
Module end 'content'
Timing: Jan 18 2025 02:00:17
Script end

Main resources:

Total runtime0.1680 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 587.7031180.8438
Module start 'content' 0.00720.0065 768.5469105.9766
Module end 'content' 0.01360.1543 874.5234533.8750
Script end 0.1679  1,408.3984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00362.1568200.0002
Check MTime0.00140.8250200.0001
Mysql Total
Database connection0.00070.406410.0007
Mysqli_queries0.118070.22321410.0008
Looping result0.00140.83251390.0000
Template Total0.153891.610.1538
Template load0.00090.554110.0009
Template processing0.152990.998510.1529
Override
Cache load0.00070.396910.0007
Sytem overhead
Fetch class attribute can translate value0.00080.486810.0008
XML
Image XML parsing0.00020.139310.0002
General
dbfile0.00502.9953200.0003
String conversion0.00000.021330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs