[TYPO3-german] Default Sprache im bestehenden Projekt ändern
Corrado Viotto
corrado at corrado.li
Wed Oct 8 16:42:10 CEST 2008
Leider werden meine Probleme immer grösser und das nur weil ich zu
Beginn die falsche Default Sprache gewählt habe.
Hab gelesen, dass es eine Möglichkeit gibt diese noch zu ändern durch
direkten Eingriff in die Datenbank.
Wäre aber überglücklich, wenn es eine elegantere Art gebe.
Hier ein mögliches Skript zu Version 3.8 (gefunden im Archiv dieser
Maillist):
------------------------------------------------------------------
connect();
$new_default_language_uid = 1;
$old_default_language_name = 'English';
$old_default_language_flag = 'gb.gif';
$dummy_language_uid = 999;
// Look for new-default-language objects that reference default language
datasets (parent)
$sql = "SELECT `uid`,`pid`,`l18n_parent` FROM `tt_content` WHERE
`sys_language_uid` = ".$new_default_language_uid." AND `l18n_parent` > 0";
$result = mysql_query($sql);
if (!$result) die(mysql_error());
else {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
// Set new references (for all languages except former default language)
$sql = "UPDATE `tt_content` SET `l18n_parent` = ". $row['uid'] . " WHERE
`l18n_parent` = " . $row['l18n_parent'];
mysql_query($sql) or die(mysql_error());
// Set new reference in default language objects which formerly have
been referenced (by new default language objects).
$sql = "UPDATE `tt_content` SET `l18n_parent` = ". $row['uid'] . ",
`sys_language_uid` = ".$dummy_language_uid." WHERE `uid` = " .
$row['l18n_parent'];
mysql_query($sql) or die(mysql_error());
}
// Make new language the default language (and clear the parent reference)
$sql = "UPDATE `tt_content` SET `sys_language_uid` = 0, `l18n_parent` =
0 WHERE `sys_language_uid` = ".$new_default_language_uid;
mysql_query($sql) or die(mysql_error());
// Make formerly default language objects the language which is now
default language
$sql = "UPDATE `tt_content` SET `sys_language_uid` = " .
$new_default_language_uid . " WHERE `sys_language_uid` =
".$dummy_language_uid;
mysql_query($sql) or die(mysql_error());
$sql = "UPDATE `sys_language` SET `title` = '" .
$old_default_language_name . "', `flag` = '" .
$old_default_language_flag . "' WHERE `uid` = " . $new_default_language_uid;
echo $sql."<br>\n";
mysql_query($sql) or die(mysql_error());
}
----------------------------------------------------------------
Könnte das klappen? Und kommen da die Extension wie tt_news nicht
durcheinander?
Ich verwende Version 4.2.1 mit TemplaVoila
Gruss
Corrado
More information about the TYPO3-german
mailing list