Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function chown($path, $uid, $gid)
 {
     // @TODO Return a failure in windows environments
     $this->reactor->addRef();
     $promisor = new Deferred();
     \uv_fs_chown($this->loop, $path, $uid, $gid, function ($fh) use($promisor) {
         $this->reactor->delRef();
         $promisor->succeed((bool) $fh);
     });
     return $promisor->promise();
 }
 /**
  * Change the ownership of a file/directory by path
  *
  * @param string $path
  * @param int|string $uid
  * @param int|string $gid
  * @param callable $callback
  * @return $this
  */
 public function chown($path, $uid, $gid, callable $callback = null)
 {
     $self = $this;
     \uv_fs_chown($this->getLoop()->getBackend(), $path, $uid, $gid, function ($fd) use($callback, $self) {
         if ($callback === null) {
             return;
         }
         $callback($self, $fd);
     });
     return $this;
 }