示例#1
0
文件: GitObject.php 项目: git4p/git4p
 /**
  * Stores the object on disk.
  *
  * @throws  Exception   'Unable to create path [filename]'
  */
 public function store()
 {
     $path = sprintf('%s/%s/%s', $this->git->dir(), Git::DIR_OBJECTS, $this->location());
     if (file_exists($path) === false) {
         $result = mkdir($path, 0774, true);
         if ($result === false) {
             throw new Exception('Unable to create path ' . $path);
         }
     }
     Git::writeFile($path . '/' . $this->filename(), $this->header() . $this->data(), true);
 }