We've talked about this in multiple places, and kept trying to work-around it, but I think it's going to be impossible to finish #11416: Please provide *.zip downloads. and have everything display consistently without finally adding a weight column to {project_release_file}. I don't even care if there's no UI for it (at least not yet). We just need a way to record and order things (especially the various views related to release files) that doesn't rely on fid, since we're not going to be able to make that work consistently. Hopefully this will be relatively quick. Stay tuned.

Comments

dww’s picture

Status: Active » Needs review
StatusFileSize
new10.13 KB

I'm punting the d.o-specific initialization of {project_release_file}.weight (to handle our profile stuff) to a separate patch against drupalorg_project (I'll still attach that here), but I wanted to get this much up for review. I've tested the DB update and the views stuff a bit, all seems to be fine. Any objections?

dww’s picture

StatusFileSize
new927 bytes

One more hunk for one of the default views. The other is going to be changed over at #11416: Please provide *.zip downloads. (and possibly #1006238: Add a weight limit for project_release_handler_field_files) so I don't think it's worth fixing that one in this issue.

dww’s picture

Here's a totally untested patch for drupalorg_project to initialize the weight properly for our files.

dww’s picture

I just took those subselects, turned them into COUNT(*) queries, and ran on the live DB. Looks right. ;)

mysql> SELECT COUNT(*) FROM project_release_file prf INNER JOIN project_release_nodes prn ON prf.nid = prn.nid INNER JOIN term_node tn ON prn.pid = tn.nid WHERE tn.tid = 96;
+----------+
| count(*) |
+----------+
|     5385 | 
+----------+
1 row in set (0.01 sec)

mysql> SELECT COUNT(*) FROM project_release_file prf INNER JOIN files f ON prf.fid = f.fid INNER JOIN project_release_nodes prn ON prf.nid = prn.nid INNER JOIN term_node tn ON prn.pid = tn.nid WHERE tn.tid = 96 and f.filename RLIKE '-core.tar';
+----------+
| count(*) |
+----------+
|     3052 | 
+----------+
1 row in set (0.06 sec)

mysql> SELECT COUNT(*) FROM project_release_file prf INNER JOIN files f ON prf.fid = f.fid INNER JOIN project_release_nodes prn ON prf.nid = prn.nid INNER JOIN term_node tn ON prn.pid = tn.nid WHERE tn.tid = 96 and f.filename RLIKE '-no-core.tar';
+----------+
| COUNT(*) |
+----------+
|     1526 | 
+----------+
1 row in set (0.12 sec)
dww’s picture

Status: Needs review » Needs work

#3 needs work, since you can't update {project_release_file} with a subselect that JOINs on the same table:

User warning: You can't specify target table 'prf' for update in FROM clause query: UPDATE project_release_file prf SET weight = 0 WHERE fid IN (SELECT prf.fid FROM project_release_file prf INNER JOIN files f ON prf.fid = f.fid INNER JOIN project_release_nodes prn ON prf.nid = prn.nid INNER JOIN term_node tn ON prn.pid = tn.nid WHERE tn.tid = 96 and f.filename RLIKE '-core.tar') in _db_query() (line 143 of .../includes/database.mysql.inc).

Originally in IRC, nnewton and I discussed running 1 query to find all the records we need to update, saving that in RAM in PHP, and then just updating all those records with other queries. So, that's what I'll do. I just have to wait until morning, since I really need sleep now.

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new3.68 KB

A bit ugly, but this totally works. Ran very quickly on beta.d.o.

dww’s picture

StatusFileSize
new11.32 KB

Given #1006238: Add a weight limit for project_release_handler_field_files I needed to slightly fix the weight logic in package-release-nodes.php for install profiles. I also folded the patch from #2 into this.

dww’s picture

Committed #7 to HEAD of project. Still waiting on a review of #6 before I commit that to drupalorg_project. ;)

Status: Needs review » Needs work

The last submitted patch, 1006346-7.project-release-file-weight.patch, failed testing.

dww’s picture

Project: Project » Drupal.org customizations
Version: 6.x-1.x-dev »
Component: Releases » Miscellaneous
Status: Needs work » Needs review

Moving to drupalorg.module's queue for now. Shut up, bot. ;) #6 (against drupalorg_project.install) still needs review...

nnewton’s picture

Reviewed #6 from a performance standpoint and this should be fine to run on live.

-N

dww’s picture

Project: Drupal.org customizations » Project
Version: » 6.x-1.x-dev
Component: Miscellaneous » Releases
Status: Needs review » Fixed

Committed #6 to drupalorg HEAD, merged into bzr, deployed, and ran update.php (was nearly instantaneous).

It's working fine, e.g. the order of files here are correct:

http://drupal.org/node/945570

(first full profile with core, then the "no-core" profile with all the projects, and finally the profile-only release).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.