Jörg Napp
Developer PostNuke
$Revision: 1.3 $
$Date: 2004/02/28 18:48:55 $
0.3
28. Feb 2004

DocBook split for better re-use

0.2
07. October 2003

corrections and added IDs to tags

0.1
15. September 2003

Initial version

pnTemp

# The PostNuke temp directory (`pnTemp`)

## Introduction

The PostNuke temp directory has been introduced for module developers to store temporary files in a central writable file system point.

## Uses

### Obtaining the temp path

A module developer can obtain the path to the temp directory using `pnConfigGetVar('temp')`.

### File names

Developers should use their module name as a suffix to file names stored in the temp directory to avoid name conflicts. The foobar module shuld name its temporary files `foobar_temp1`, `foobar_temp2` a.s.o.

### Using Subdirectories

A module developer may use a subdirectory of the temp directory for his purposes. In this case, the module developer has to take care for this subdirectory to be created and deleted on module initialization or deletion time. The naming conventions stated above appliy to directory names as well.

### Automatic deletion

In short, automatic deletion or cleanup will not and must not take place.

There is no automatic cleanup machanism for the temp directory, so the developer needs to take care that the files he creates are deleted again. On the other hand, the system expects no automatic cleanup to run, so that files can be stored over a certain amount of time.

### Web access to files

Files stored in the temp directory are not accessible via http. Thus, this is not the place to store files like images, documents or such that you would like to be available via http.

## Implementation

At installation time, the PostNuke temp directory is located at `(PostNuke Root)/pnTemp`. The webmaster installing PostNuke needs to make this directory writable by the web server, typically by `chmod`ding it (and its subdirectories) to 777.

The place of the temp directory can be changed in the file `config.php`. Since if we use adodb query caching this temp directory will need to be known before we have access to our db so a config var is not appropriate here.

For security reasons, webmasters are strongly encouraged to move the temp directory outside the web root.

To avoid http access to the temp directory, there is a apache styte `.htaccess` included in the `pnTemp` directory prohibiting this access.