예제 #1
0
 /**
  * __construct
  *
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     $this->dir = GitPHP_Util::AddSlash(GitPHP_Config::GetInstance()->GetValue('gittmp'));
     if (empty($this->dir)) {
         $this->dir = GitPHP_TmpDir::SystemTmpDir();
     }
     if (empty($this->dir)) {
         throw new Exception(__('No tmpdir defined'));
     }
     if (file_exists($this->dir)) {
         if (is_dir($this->dir)) {
             if (!is_writeable($this->dir)) {
                 throw new Exception(sprintf(__('Specified tmpdir %1$s is not writable'), $this->dir));
             }
         } else {
             throw new Exception(sprintf(__('Specified tmpdir %1$s is not a directory'), $this->dir));
         }
     } else {
         if (!mkdir($this->dir, 0700)) {
             throw new Exception(sprintf(__('Could not create tmpdir %1$s'), $this->dir));
         }
     }
 }