By ClearXS on
Fatal error: Cannot redeclare ts() in .../sites/all/modules/civicrm/CRM/Core/I18n.php on line 320
=> error happened after installing the internationalisation i18n module
http://drupal.org/project/i18n
resulting in: "administer => site building => modules" being unreachable, except for that error message.
Like to get rid of that error message with a quick solution. Like deleting the i18n module, but I fear its already integrated in the CiviCRM, so I don't want to make the mess bigger.
Any idea? -thanks.
Comments
It looked like I'd already
It looked like I'd already deleted the i18 dir
Couldn't find it, so most probably have deleted it accidently, instead of deleting something else.
Uploaded again and installed the i18, but that doesn't make any difference anymore.
I can run cron.php, I can update, but finally it gives the same error.
Maybe rebuilding the index or something? Where can I find that directly; how do I get Drupal doing that?
P.S.: I now see that some other file I'd deleted, is back again. Maybe my webhoster megahost.drupalvaluehosting.com had a restore of just a little bit older backup after a yam, but does that not correspondend with the database of that same moment ?
Follow-up:
Deleted the CiviCRM database & created new one + added civicrm user and drupaluser + cron.php & update.php => no effect
Deleted CiviCRM module => Has no effect
Deleted Drupal database & made new database + added drupal user + install.php =>
"Drupal installation complete - Congratualations, Drupal has been successfully installed. You may now visit your new site."
Yes, that was the 4th or 5th time I deleted and reinstalled in two weeks of daily working on it. Same old drupal problem as 2 years ago; if something goes wrong when installing one of the many modules, I dont know a method to correct it in another way.
At least I saved my configuration of many mods; because that also is 2 days work toupload and extract them +some changes for the modsto other files. But now I have to vink/click a few hundred timse to activites them + the throtle function, etc...
Anyway; better than when this would have been a production site and installing a new mod that causes these issues; also a good reason to try to install all suitable mods right now.
Follow-up 2:
Th CiviCRM dir turned automatically back again! How is this possible? Deleted another time.
After 10 hours of reinstalling... same error -anyone?
Fatal error: Cannot redeclare ts() in /home1/.../public_html/d/sites/all/modules/civicrm/CRM/Core/I18n.php on line 321
I had the new civicrm of today/yesterday installed. Even the i18 went OK together with civicrm,both vinked on. But only after I had some other translation mods vinked on, this happened.
Hope someone has a quick solution for me to get rid of this ! Go sleep now and hope that when I wake up in 6 hours, I dont have to work 10 hours again reinstalling...
civicrm/CRM/core/I18n.php code
0316| /** * Short-named function for string translation, defined in global scope so it's available everywhere.
0317| * @param $text string string for trnaslating
0318| * @param $params array an array of additional parameters
0319| * @return string the translated string
0320| */
0321| function ts($text, $params = array())
0322| {
0323| static $config = null;
0324| static $locale = null;
0325| static $i18n = null;
0326| static $function = null;
0327|
0328| if ($text == '') {
0329| return '';
0330| }
0331|
0332| if (!$config) {
0333| $config =& CRM_Core_Config::singleton();
0334| }
0335|
0336| if (!$i18n or $locale != $config->lcMessages) {
0337| $i18n =& CRM_Core_I18n::singleton();
0338| $locale = $config->lcMessages;
0339| if (isset($config->customTranslateFunction) and function_exists($config->customTranslateFunction)) {
0340| $function = $config->customTranslateFunction;
0341| }
0342| }
0343|
0344| if ($function) {
0345| return $function($text, $params);
0346| } else {
0347| return $i18n->crm_translate($text, $params);
0348| }
0349| }
Drupaldir/includes/module.inc
Drupaldir/includes/module.inc :
/* *
* Load all the modules that have been enabled in the system table.
*/
function module_load_all() {
foreach (module_list(TRUE, FALSE) as $module) {
drupal_load('module', $module);
}
}
=> With PHPMyAdmin, that' s installed on my hostserver, I'll try to find the activated modules and try to deactivate some language modules and/or civicrm:
There doesnt seem to be a database field modules_list
But there is: d1_i18n_strings
...but it seems empty with many records containg 0
So where is "modules_list" ??!
http://api.drupal.org/api/function/module_list/6
Still no answer, I suppose every database name is a module-list record?
If so, then I should remove the database records for i18; risky...
"Export" just try it.. Many options, but I hope the proper options are already there =>
d1_i18n_strings.sql saved to my PC
d1_i18n_blocks.sql idem
d1_i18n_variable.sql idem
Deleting the d1_i18n_strings record only =>
But I see some edit possibility that shows something like:
("PRIMARY" must be the name of and only of a primary key!)
No idea. so continue "drop =>
back to /admin/build/modules in drupal :
no, same error.
ran cron.php and update.php
=> returns with
Fatal error: Cannot redeclare ts() in /home1/cyborg/public_html/d/sites/all/modules/civicrm/CRM/Core/I18n.php on line 321
so dropped the other two i18 records/bases too:
noppes.
So now saving and dropping all civicrm datafields:
NO; the names do not correspondend with the civicrm modules, so I think the modules_list just is not here..?
So now what..?
unvink /unhook in module itself?
drupaldir/includes/module.inc :
* @defgroup hooks Hooks
* @{
* Allow modules to interact with the Drupal core.
*
* Drupal's module system is based on the concept of "hooks". A hook is a PHP
* function that is named foo_bar(), where "foo" is the name of the module (whose
* filename is thus foo.module) and "bar" is the name of the hook. Each hook has
* a defined set of parameters and a specified result type.
*
* To extend Drupal, a module need simply implement a hook. When Drupal wishes to
* allow intervention from modules, it determines which modules implement a hook
* and call that hook in all enabled modules that implement it.
=> so the "hook" is in each module itself..?
* Determine whether a module implements a hook.
*
* @param $module
* The name of the module (without the .module extension).
* @param $hook
* The name of the hook (e.g. "help" or "menu").
* @return
* TRUE if the module is both installed and enabled, and the hook is
* implemented in that module.
=> but in modules/i18n there are two files:
i18n.install
i18n.module
containing a lot of text about hook, so I cant find just a simple yes or no to get the module unvinked.
This is it for now; will continue in some hours,
hopefully then someone came up with a bright and simple idea.. -thanks..!
XXXXXXXXXXXXXXXXXXXXXXXXXXX
FOLLOW-UP:
Jose notified me of a page that I couldn't find myself earlier through google, because it hadn't included the full error message:
duplicate ts() function in CiviCRM module for drupal 6
http://drupal.org/node/298154
patch changed into the files, but error needs more to repair
Administered the above patch into the i18 files (not too easy; others have to wait till the new release). But same error stays.
cron & update.php don't change anything.
So I try this one that I'd saved (dont know where to find it inside drupal):
http://yoursite.xxx/drupaldir/admin/content/node-settings/rebuild
=> no; same error remains, but it was something rebuilding for i18
So then I have to reinstall civicrm module + some other module(s) that have been affected by the old i18.
civicrm re-installed + civicrm database deleted to be sure + new database for civicrm.
ran the civicrm installer in the module's address etc etc
=>
Fatal error: Cannot redeclare ts() in .../all/modules/civicrm/CRM/Core/I18n.php on line 321
Another time:
http://.../admin/content/node-settings/rebuild
=> same error
So I'll delete & reinstall everything again , or just wait another two years again for version 8.xx, or 10.xx, hoping Drupal gets easier and more secure to repair, when something gets wrong wrong on installing a (new) mod.