diff --git a/modules/system/system.install b/modules/system/system.install index 7fad4a2..eac4fba 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2740,11 +2740,12 @@ function system_update_7061(&$sandbox) { // Delete stale rows from {upload} where the vid is not in the // {node_revisions} table. - $delete_node_subquery = db_select('node_revision', 'nr'); - $delete_node_subquery->fields('nr', array('vid')); - $delete_node_subquery->where('nr.vid = ' . $upload_table_prefix . 'upload.vid'); db_delete('upload') - ->notExists($delete_node_subquery) + ->notExists( + db_select('node_revision', 'nr') + ->fields('nr', array('vid')) + ->where('nr.vid = {upload}.vid') + ) ->execute(); // Retrieve a list of node revisions that have uploaded files attached.