Since PHP 5.2.1, PHP exposes the system temporary directory to us. Very handy. My version uses that, and if that's not present then it uses tempnam's capability of falling back to the very same directory, copied from a comment in the manual. I checked the source and it's indeed the very same dir just it was not exposed to userland before. This, IMO, makes the system setting totally unneeded.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | drupal.file-temp-dir.346258.9.patch | 2.28 KB | aaron |
| #7 | drupal.file-temp-dir.patch | 2.74 KB | sun |
| #6 | file_temp_1.patch | 2.18 KB | vietcoop |
| #1 | file_temp.patch | 1.81 KB | chx |
| file_temp.patch | 1.98 KB | chx |
Comments
Comment #1
chx commentedEven simpler.
Comment #2
alexanderpas commenteduhm... what about bad-configured shared hosting, using /tmp for every account, in combination with race-conditions.
(verry funny if that hoster also hosts adult content on the same server...)
Comment #3
drewish commentedlooks pretty good to me. the comments need some work to make them proper sentences. marking as CNW for that alone
i kind of liked the whole
foreach (array('TMP', 'TMPDIR', 'TEMP') as $key) {in the original patch but think we should be checking that the directory exists.i also wonder if we could just call
$tempfile = tempnam('', '');...Comment #4
drewish commentedthe word is that D7 will be PHP 5.2+... so we might be able to just use sys_get_temp_dir()
Comment #5
chx commentedalexender, I doubt that's possible, really. You are already using this dir, dont forget, your uploads to the server land in this dir. It's only Drupal's processsing that happens into another dir which IMO is quite pointless.
I am reluctant to rely on tempnam('' -- who knows what happens on different OSes for empty dirnames... while we are PHP 5.2.0+ we are not PHP 5.2.1+
Comment #6
vietcoop commentedReroll
Comment #7
sunRevamped for stream wrappers.
Comment #9
aaron commentedthe reason the test fails is that we're still trying to use that variable_get('file_temporary_path', NULL). this patch passes, but i'm sure there are more optimal means to achieve this.
Comment #10
retester2010 commented#9: drupal.file-temp-dir.346258.9.patch queued for re-testing.
Comment #11
damien tournoud commentedThis is already in. Marking as a duplicate of whatever issue introduced it.