Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function unlink($path)
 {
     $this->incrementPending();
     $promisor = new Deferred();
     $priority = \EIO_PRI_DEFAULT;
     \eio_unlink($path, $priority, [$this, "onGenericResult"], $promisor);
     return $promisor->promise();
 }
Esempio n. 2
0
 /**
  * Unlink file
  * @param  string   $path Path
  * @param  callable $cb   Callback
  * @param  integer  $pri  Priority
  * @return resource|boolean
  */
 public static function unlink($path, $cb = null, $pri = EIO_PRI_DEFAULT)
 {
     $cb = CallbackWrapper::forceWrap($cb);
     if (!self::$supported) {
         $r = unlink($path);
         if ($cb) {
             call_user_func($cb, $path, $r);
         }
         return $r;
     }
     return eio_unlink($path, $pri, $cb, $path);
 }
Esempio n. 3
0
 public static function unlink($path, $cb = null, $pri = EIO_PRI_DEFAULT)
 {
     if (!self::$supported) {
         $r = unlink($path);
         if ($cb) {
             call_user_func($cb, $path, $r);
         }
         return;
     }
     return eio_unlink($path, $pri, $cb, $path);
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function unlink(string $path) : \Generator
 {
     if (!(yield from $this->isFile($path))) {
         // Ensure file exists before attempting to unlink.
         throw new FileException('File does not exist or is a directory.');
     }
     $delayed = new Delayed();
     \eio_unlink($path, null, function (Delayed $delayed, $result, $req) {
         if (-1 === $result) {
             $delayed->reject(new FileException(sprintf('Unlinking the file 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;
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function unlink($path)
 {
     \call_user_func($this->incrementor, 1);
     $promisor = new Deferred();
     $priority = \EIO_PRI_DEFAULT;
     $data = [$promisor, $path];
     \eio_unlink($path, $priority, [$this, "onUnlink"], $data);
     return $promisor->promise();
 }