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"

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 05:08:10
Script start
Timing: Jan 18 2025 05:08:10
Module start 'layout'
Timing: Jan 18 2025 05:08:10
Module start 'content'
Timing: Jan 18 2025 05:08:11
Module end 'content'
Timing: Jan 18 2025 05:08:11
Script end

Main resources:

Total runtime1.2693 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 594.1797152.6250
Module start 'layout' 0.00480.0030 746.804739.4453
Module start 'content' 0.00791.2600 786.2500762.9688
Module end 'content' 1.26780.0015 1,549.218820.1719
Script end 1.2693  1,569.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2434160.0002
Check MTime0.00140.1068160.0001
Mysql Total
Database connection0.00070.058910.0007
Mysqli_queries1.194594.1070770.0155
Looping result0.00080.0640750.0000
Template Total1.239597.620.6197
Template load0.00190.153020.0010
Template processing1.237597.492720.6188
Template load and register function0.00010.007910.0001
states
state_id_array0.00080.062410.0008
state_identifier_array0.00240.186820.0012
Override
Cache load0.00170.1306350.0000
Sytem overhead
Fetch class attribute can translate value0.00180.141560.0003
Fetch class attribute name0.00130.0988120.0001
XML
Image XML parsing0.00620.490660.0010
class_abstraction
Instantiating content class attribute0.00000.0019130.0000
General
dbfile0.00430.3372410.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs