warning shown when the same url alias name is used for different languages
brucepearson - February 6, 2009 - 08:39
| Project: | Path |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
user warning: Duplicate entry 'home-es' for key 2 query: UPDATE url_alias SET src = 'node/19', dst = 'home', language = 'es' WHERE dst = 'home' in /home/amir/websites/drupal-translation/drupal-6.9/modules/path/path.module on line 108.
The current code updates the url_alias based only on the alias
<?php
db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias);
?>This patch updates the url_alias based on the alias and the path. This will be safe because the previous line checks that the alias is correct for the path and language.
<?php
if ($alias == drupal_get_path_alias($path, $language)) {
// There is already such an alias, neutral or in this language.
// Update the alias based on alias; setting the language if not yet done.
db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s' AND src='%s'", $path, $alias, $language, $alias, $path);
}
?>Attached is a patch against the drupal-6.9 release.
| Attachment | Size |
|---|---|
| path.module.patch | 737 bytes |

#1
I ran into this same problem today.
This warning occures when adding a translation for a node and the option Synchronise translations (Internationalisation module) is used.
As a result the translated node is created as an independant node, not as translation of the original node.
Althoug it is a warning message in the path module, it results in an incorrect output of the translation.