| @@ 426-438 (lines=13) @@ | ||
| 423 | * @param integer $pri Priority |
|
| 424 | * @return resource|boolean |
|
| 425 | */ |
|
| 426 | public static function truncate($path, $offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) |
|
| 427 | { |
|
| 428 | $cb = CallbackWrapper::forceWrap($cb); |
|
| 429 | if (!FileSystem::$supported) { |
|
| 430 | $fp = fopen($path, 'r+'); |
|
| 431 | $r = $fp && ftruncate($fp, $offset); |
|
| 432 | if ($cb) { |
|
| 433 | $cb($path, $r); |
|
| 434 | } |
|
| 435 | return $r; |
|
| 436 | } |
|
| 437 | return eio_truncate($path, $offset, $pri, $cb, $path); |
|
| 438 | } |
|
| 439 | ||
| 440 | /** |
|
| 441 | * sendfile() |
|
| @@ 506-519 (lines=14) @@ | ||
| 503 | * @param integer $pri = EIO_PRI_DEFAULT Priority |
|
| 504 | * @return resource|boolean |
|
| 505 | */ |
|
| 506 | public static function chown($path, $uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) |
|
| 507 | { |
|
| 508 | $cb = CallbackWrapper::forceWrap($cb); |
|
| 509 | if (!FileSystem::$supported) { |
|
| 510 | $r = chown($path, $uid); |
|
| 511 | if ($gid !== -1) { |
|
| 512 | $r = $r && chgrp($path, $gid); |
|
| 513 | } |
|
| 514 | $cb($path, $r); |
|
| 515 | return $r; |
|
| 516 | } |
|
| 517 | ||
| 518 | return eio_chown($path, $uid, $gid, $pri, $cb, $path); |
|
| 519 | } |
|
| 520 | ||
| 521 | /** |
|
| 522 | * Reads whole file |
|