setup:
Install i18n..
edit the page content type and set the synchronization on for taxonomy terms.
create a page in one language (french) and set the alias
create a translation for this page (english) and set the alias to the same thing as the french page.
After this edit the english page and press save.
At some point the english page will revert to the node/XXX notation. (there is no alias for it)
I took a quick look at the code in path.module
in this function: function path_set_alias
in this case:
else if ($path && $alias) {
// Check for existing aliases.
if ($alias == drupal_get_path_alias($path, $language)) {
this is the problem sql:
db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias);
********************************
when you have synchronization turned on it will update the english node.. then it will update the french (if you edit english and save)
when it updates the french.. (which has the same alias as the english) it will override the english entry because it does not check for language in the WHERE clause. It simply updates all entries with that alias.
Here is my suggested solution..
else if ($path && $alias) {
// Check for existing aliases.
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.
if (!empty($language)){
$updateresult = db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s' and language = '%s'", $path, $alias, $language, $alias, $language);
//if the update failed the alias is going from language neutral to language specific
if ($updateresult == FALSE){
db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias);
}
}else{
db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias);
}
}
Comments
Comment #1
gnindl commentedI think that's a duplicate of #790338: All aliases get deleted when translatable nodes with same URL alias are reverted to previous revision.