Ejemplo n.º 1
0
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $root = $this->fs->toAbsolutePath($input->getOption('root'));
     if (!$this->fs->exists($root)) {
         throw new \Exception("Failed to locate root: " . $root);
     } else {
         $input->setOption('root', $root);
     }
 }
Ejemplo n.º 2
0
 /**
  * Set the permissions for a directory
  *
  * @param string $perm eg PermissionInterface::WEB_WRITE
  * @param string $dir the directory whose permissions should change
  */
 public function applyDirPermission($perm, $dir)
 {
     if (!$this->fs->exists($dir)) {
         return;
     }
     $dirCommand = strtr($this->getDirCommand($perm), array('{DIR}' => escapeshellarg($dir)));
     if ($dirCommand == '') {
         return;
     }
     $process = new Process($dirCommand);
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     print $process->getOutput();
     // REMOVE
 }