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

Introduce node_mass_delete() or make node_mass_update() more flexible

$
0
0

Follow up for #1498674: Refactor node properties to multilingual

Problem/Motivation

Simplify code

In 1498674 was the @todo

   // @todo Introduce node_mass_delete() or make node_mass_update() more flexible.

On the line in the patch in comment #303:
2850

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

For example,

function node_user_predelete($account) {
   // Delete nodes (current revisions).
   // @todo Introduce node_mass_delete() or make node_mass_update() more flexible.
-  $nodes = db_select('node', 'n')
+  $nodes = db_select('node_field_data', 'n')
+    ->distinct()
     ->fields('n', array('nid'))
     ->condition('uid', $account->uid)
     ->execute()
     ->fetchCol();
   node_delete_multiple($nodes);
   // Delete old revisions.
-  $revisions = db_query('SELECT vid FROM {node_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
+  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
   foreach ($revisions as $revision) {
     node_revision_delete($revision);
   }

Proposed resolution

Introduce node_mass_delete() or make node_mass_update() more flexible.

Remaining Tasks

  • use git blame to identify the issue that added this @todo and link to it, and link it back to here.

User interface changes

No.

API changes

maybe


Viewing all articles
Browse latest Browse all 293320

Trending Articles



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