Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#5984 closed defect (bug) (fixed)

WordPress should not depend on access to /tmp/

Reported by: hangy's profile hangy Owned by: ryan's profile ryan
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

In some restricted hosting environments, the user might not be able to write to /tmp/.

As wp-admin/includes/file.php uses that directory directly in download_url() and get_filesystem_method(), some functions like for example automatic updating of plugins do not work under those circumstances.

Alternatives could be to use a temporary directory under wp-content as default or have an option in wp-config.php to change this to another directory.

Attachments (4)

5984.wp-content_tmp.diff (621 bytes) - added by hansengel 17 years ago.
Uses wp-content/tmp as a temporary directory
5984.userConfiguredTempDir.diff (1.1 KB) - added by hansengel 17 years ago.
Allows user to set value of const WPTEMPDIR in wp-config.php
5984.diff (1.2 KB) - added by DD32 17 years ago.
get_temp_dir.diff (1.0 KB) - added by ryan 17 years ago.
get_temp_dir()

Download all attachments as: .zip

Change History (12)

@hansengel
17 years ago

Uses wp-content/tmp as a temporary directory

@hansengel
17 years ago

Allows user to set value of const WPTEMPDIR in wp-config.php

#1 @hansengel
17 years ago

  • Keywords has-patch added
  • Owner changed from anonymous to hansengel
  • Status changed from new to assigned

I made a patch for each of the two methods you suggested.

#2 @DD32
17 years ago

the user might not be able to write to /tmp/.

Just an extra note on this, The user should allways be able to write to PHP's temporary directory, But, Some server setups are going to be half-arsed anwyay.

If PHP cant write to the specified directory, It'll try to create it in the systems Temp. directory.

@DD32
17 years ago

#3 @hangy
17 years ago

It is true that there will always be weird server setups and also assuming that one can write to sys_get_temp_dir() should be right in most cases. However, WordPress is probably used in the most awkward hosting environments one can think of, thus working around such problems as good as possible sounds pretty important to me. :)

I guess my "vote" would go to DD32's solution with the define renamed to hansengel's WPTEMPDIR. ;) My guess is that it is most likely that some dir in wp-content is writable (installer could check this?) than /tmp/ for all those server setups mentioned above.

While one obviously ditches the features of using a system-managed temporary directory using this approach as the default, it could be the most reliable one, cross-platform thinking. (Any idea how PHP on a Windows server reacts to a "/tmp/" path?)

#4 @lloydbudd
17 years ago

  • Milestone changed from 2.6 to 2.5

#5 @ryan
17 years ago

  • Owner changed from hansengel to ryan
  • Status changed from assigned to new

@ryan
17 years ago

get_temp_dir()

#6 @ryan
17 years ago

How about a get_temp_dir() function? See patch.

#7 @technosailor
17 years ago

+++1 :)

Get it in. It will help me out on another patch I'm working on - and I encountered this issue today as a result.

#8 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [7058]) get_temp_dir(). fixes #5984

Note: See TracTickets for help on using tickets.