Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The array of files returned by upload_load is in no particular order. This patch adds an ORDER BY to the query so that array_pop on the result array will give you the file with the lowest fid. It then becomes possible to do things with the files based on their order.
Comment | File | Size | Author |
---|---|---|---|
#8 | upload.patch.txt | 806 bytes | killes@www.drop.org |
57307.patch | 759 bytes | robertDouglass | |
Comments
Comment #1
dopry CreditAttribution: dopry commentedcode looks good... idea is sound.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commented+1 from me too. code looks proper. minimal change.
Comment #3
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedapplied
Comment #4
(not verified) CreditAttribution: commentedComment #5
jhriggs CreditAttribution: jhriggs commentedOK, although the idea may be sound, this broke a lot of feeds. Upload.module encloses the first attached file in feeds. By ordering with fid DESC rather than ASC, this changed the enclosed file on any feed items with more than one attachment. So, for instance, all of my podcasts that have a PPT slideshow attached also are now completely borked, because they enclose the pdf file rather than the mp3. While I agree the attachments should be ordered, they should be ordered ascending rather than descending (or it should be an option).
Comment #6
jhriggs CreditAttribution: jhriggs commented(I should have mentioned, of course, that it breaks things when upgrading from a previous version.)
Comment #7
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedWe chould probably change DESC to ASC (or simply remove it).
Comment #8
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedSolution: Remove DESC
Comment #9
Dries CreditAttribution: Dries commentedLooks OK to me.
Comment #10
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied to 4.7.
Comment #11
robertDouglass CreditAttribution: robertDouglass commentedDoes that mean it is closed? Or are we waiting to have it forward-ported to HEAD?
Comment #12
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedwe are just waiting for Dries to commit to HEAD.
Comment #13
drummCommitted to HEAD.
Comment #14
(not verified) CreditAttribution: commented