Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function chown($path, $uid, $gid)
 {
     $this->incrementPending();
     $promisor = new Deferred();
     $priority = \EIO_PRI_DEFAULT;
     \eio_chown($path, $uid, $gid, $priority, [$this, "onGenericResult"], $promisor);
     return $promisor->promise();
 }
Beispiel #2
0
 /**
  * @coroutine
  *
  * @param int $uid
  * @param int $gid
  *
  * @return \Generator
  *
  * @resolve bool
  */
 private function chowngrp(string $path, int $uid, int $gid) : \Generator
 {
     $delayed = new Delayed();
     \eio_chown($path, $uid, $gid, null, function (Delayed $delayed, $result, $req) {
         if (-1 === $result) {
             $delayed->reject(new FileException(sprintf('Changing the owner or group failed: %s.', \eio_get_last_error($req))));
         } else {
             $delayed->resolve(true);
         }
     }, $delayed);
     $this->poll->listen();
     try {
         $result = (yield $delayed);
     } finally {
         $this->poll->done();
     }
     return $result;
 }
Beispiel #3
0
 /**
  * Changes ownership of file/directory
  * @param  string   $path Path
  * @param  integer  $uid  User ID
  * @param  integer  $gid  Group ID
  * @param  callable $cb   Callback
  * @param  integer  $pri  Priority
  * @return resource|boolean
  */
 public static function chown($path, $uid, $gid = -1, $cb, $pri = EIO_PRI_DEFAULT)
 {
     $cb = CallbackWrapper::forceWrap($cb);
     if (!FileSystem::$supported) {
         $r = chown($path, $uid);
         if ($gid !== -1) {
             $r = $r && chgrp($path, $gid);
         }
         call_user_func($cb, $path, $r);
         return $r;
     }
     return eio_chown($path, $uid, $gid, $pri, $cb, $path);
 }
Beispiel #4
0
 public static function chown($path, $uid, $gid = -1, $pri = EIO_PRI_DEFAULT)
 {
     if (!FS::$supported) {
         $r = chown($path, $uid);
         if ($gid !== -1) {
             $r = $r && chgrp($path, $gid);
         }
         call_user_func($cb, $path, $r);
         return;
     }
     return eio_chown($path, $uid, $gid, $pri, $cb, $path);
 }