Ticket #35517: class-wp-filesystem-ssh2.php.patch
| File class-wp-filesystem-ssh2.php.patch, 2.3 KB (added by , 10 years ago) |
|---|
-
wp-admin/includes/class-wp-filesystem-ssh2.php
437 437 * @return bool 438 438 */ 439 439 public function exists($file) { 440 return file_exists( $this->sftp_path( $file ) ); 440 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 441 if ( false === $stat ) { 442 return false; 443 } 444 445 return (true); 441 446 } 442 447 443 448 /** … … 447 452 * @return bool 448 453 */ 449 454 public function is_file($file) { 450 return is_file( $this->sftp_path( $file ) ); 455 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 456 if ( false === $stat ) { 457 return false; 458 } 459 460 $mode = $stat['mode']; 461 $type = $mode & 0xf000; 462 return ($type == 0x8000); 451 463 } 452 464 453 465 /** … … 457 469 * @return bool 458 470 */ 459 471 public function is_dir($path) { 460 return is_dir( $this->sftp_path( $path ) ); 472 $stat = @ssh2_sftp_stat( $this->sftp_link, $path ); 473 if ( false === $stat ) { 474 return false; 475 } 476 477 $mode = $stat['mode']; 478 $type = $mode & 0xf000; 479 return ($type == 0x4000); 461 480 } 462 481 463 482 /** … … 467 486 * @return bool 468 487 */ 469 488 public function is_readable($file) { 470 return is_readable( $this->sftp_path( $file ) ); 489 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 490 if ( false === $stat ) { 491 return false; 492 } 493 494 $mode = $stat['mode']; 495 return ($type & 0x0004); 471 496 } 472 497 473 498 /** … … 488 513 * @return int 489 514 */ 490 515 public function atime($file) { 491 return fileatime( $this->sftp_path( $file ) ); 516 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 517 if ( false === $stat ) { 518 return false; 519 } 520 521 return $stat['atime']; 492 522 } 493 523 494 524 /** … … 498 528 * @return int 499 529 */ 500 530 public function mtime($file) { 501 return filemtime( $this->sftp_path( $file ) ); 531 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 532 if ( false === $stat ) { 533 return false; 534 } 535 536 return $stat['mtime']; 502 537 } 503 538 504 539 /** … … 508 543 * @return int 509 544 */ 510 545 public function size($file) { 511 return filesize( $this->sftp_path( $file ) ); 546 $stat = @ssh2_sftp_stat( $this->sftp_link, $file ); 547 if ( false === $stat ) { 548 return false; 549 } 550 551 return $stat['size']; 512 552 } 513 553 514 554 /**