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 )
|
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
|