summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL.txt2
-rw-r--r--i18n.inc14
2 files changed, 10 insertions, 6 deletions
diff --git a/INSTALL.txt b/INSTALL.txt
index 84f1994..2d6ae09 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -19,7 +19,7 @@ INSTALLATION:
In case you don't know how to apply the patches, patched files are available in my sandbox
-http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/jareyero/modules/i18n/patched_files_461/
+http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/jareyero/modules/i18n/
POST-INSTALLATION/CONFIGURATION:
============
diff --git a/i18n.inc b/i18n.inc
index 47ea464..2001c76 100644
--- a/i18n.inc
+++ b/i18n.inc
@@ -15,8 +15,11 @@
* Implementation of hook_db_rewrite_sql()
*/
function i18n_db_rewrite_sql($query, $primary_table, $primary_key){
+ // Some exceptions for query rewrites
+ if(strstr(request_uri(),'cron.php')) return;
+
$alias = $primary_table;
- //debug("$primary_table $primary_key $query");
+
switch ($alias) {
case 'n':
$result = i18n_db_node_rewrite($query, $primary_table, $primary_key);
@@ -26,15 +29,16 @@ function i18n_db_rewrite_sql($query, $primary_table, $primary_key){
$result = i18n_db_taxonomy_rewrite($query, $primary_table, $primary_key);
break;
}
- //if($result) debug($result);
+
return $result;
}
function i18n_db_node_rewrite($query, $primary_table, $primary_key){
- // When loading specific nodes, language conditions shouldn't apply
- if(arg(0) == 'node' && is_numeric(arg(1))) return;
$alias = $primary_key{0};
- if ($primary_table != 'n' || !strstr($query, '{node}')) {
+ // When loading specific nodes, language conditions shouldn't apply
+ if (preg_match("/WHERE.* $alias.nid\s*=/", $query)) return;
+
+ if ($primary_table != 'n' && !strstr($query, '{node}')) {
$result['join'] = 'INNER JOIN {node} n USING (nid)';
$alias = n;
}