Horde::getTempDir PHP Method

getTempDir() public static method

Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.
public static getTempDir ( ) : string
return string A directory name that can be used for temp files. Returns false if one could not be found.
    public static function getTempDir()
    {
        global $conf;
        /* If one has been specifically set, then use that */
        if (!empty($conf['tmpdir'])) {
            $tmp = $conf['tmpdir'];
        }
        /* Next, try sys_get_temp_dir(). */
        if (empty($tmp)) {
            $tmp = sys_get_temp_dir();
        }
        /* If it is still empty, we have failed, so return false;
         * otherwise return the directory determined. */
        return empty($tmp) ? false : $tmp;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @throws Horde_Exception
  */
 public function create(Horde_Injector $injector)
 {
     if (empty($GLOBALS['conf']['timezone']['location'])) {
         throw new Horde_Exception('Timezone database location is not configured');
     }
     return new Horde_Timezone(array('cache' => $injector->getInstance('Horde_Cache'), 'location' => $GLOBALS['conf']['timezone']['location'], 'temp' => Horde::getTempDir()));
 }
All Usage Examples Of Horde::getTempDir