Exemplo n.º 1
0
 /**
  * Ensures that the media root directory is available
  *
  * @return bool
  */
 private function ensureRootDirectoryAvailable()
 {
     if (!$this->Filesystem->exists(public_path() . '/' . $this->config['root-dir'])) {
         $this->Filesystem->makeDirectory(public_path() . '/' . $this->config['root-dir'], 0775);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Stores the category in the filesystem
  *
  * @param $input
  * @return bool
  * @throws CategoryAlreadyExistsException
  */
 public function storeNewCategory($input)
 {
     if (isset($input['name']) && isset($input['category'])) {
         $localPath = $this->CategoryPaths->fromDot($input['category']);
         $serverPath = $this->CategoryPaths->serverPath($localPath);
         if ($this->Filesystem->isDirectory($serverPath . $input['name'])) {
             throw new CategoryAlreadyExistsException('This category already exists, cannot create ' . $input['name']);
         }
         return $this->Filesystem->makeDirectory($serverPath . $input['name'], 0775);
     }
     return false;
 }