Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299521

Refactor query to use desired language rather than default language while providing fallback to default

$
0
0

#1498674: Refactor node properties to multilingual has split various fields out from the {node} table into {node_field_data}, which has a row for each node + language.

Since there are now different rows per node, SQL queries which previously used node.status/changed/... should now use node_field_data.status/changed/..., for one of the specific language rows. Figuring out how all individual queries could now be improved to make use of language specific properties, was split into followup issues, and @todos were inserted in various parts of the code.

Three of the places where there still is a @todo, have now moved into the ForumManager class.

Remaining tasks

Figure out whether and how the query should work on different language rows in {node_field_data}, dependent on language context.

Change the code or remove the @todos, in 4 places in tracker.module.

Original issue text follows

Problem/Motivation

Simplify code

In 1498674 was the @todo

@todo This should be actually filtering on the desired language and just fall back to the default language.

On the line in the patch in comment #303:
3741, 3752, 3763, 3774 and 3792.

The line of the final patch might change but that info might help to find them.

For example,

-    $result = db_query_range('SELECT nid, uid, status FROM {node} WHERE nid <= :max_nid ORDER BY nid DESC', 0, $batch_size, array(':max_nid' => $max_nid), array('target' => 'slave'));
+    // @todo This should be actually filtering on the desired language and just
+    //   fall back to the default language.
+    $result = db_query_range('SELECT nid, uid, status FROM {node_field_data} WHERE nid <= :max_nid AND default_langcode = 1 ORDER BY nid DESC', 0, $batch_size, array(':max_nid' => $max_nid), array('target' => 'slave'));;

Proposed resolution

@todo This should be actually filtering on the desired language and just fall back to the default language.

User interface changes

No.

API changes

No.


Viewing all articles
Browse latest Browse all 299521

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>