Changeset 45226
- Timestamp:
- 04/17/2019 04:12:27 AM (6 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r42343 r45226 8 8 9 9 /** 10 * Base WordPress Filesystem class for which Filesystem implementations extend10 * Base WordPress Filesystem class which Filesystem implementations extend. 11 11 * 12 12 * @since 2.5.0 13 13 */ 14 14 class WP_Filesystem_Base { 15 15 16 /** 16 17 * Whether to display debug data for the connection. … … 47 48 48 49 /** 49 * Return the path on the remote filesystem of ABSPATH.50 * Returns the path on the remote filesystem of ABSPATH. 50 51 * 51 52 * @since 2.7.0 … … 63 64 64 65 /** 65 * Return the path on the remote filesystem of WP_CONTENT_DIR.66 * Returns the path on the remote filesystem of WP_CONTENT_DIR. 66 67 * 67 68 * @since 2.7.0 … … 74 75 75 76 /** 76 * Return the path on the remote filesystem of WP_PLUGIN_DIR.77 * Returns the path on the remote filesystem of WP_PLUGIN_DIR. 77 78 * 78 79 * @since 2.7.0 … … 85 86 86 87 /** 87 * Return the path on the remote filesystem of the Themes Directory.88 * Returns the path on the remote filesystem of the Themes Directory. 88 89 * 89 90 * @since 2.7.0 90 91 * 91 * @param string $theme The Theme stylesheet or template for the directory. 92 * @param string|false $theme Optional. The theme stylesheet or template for the directory. 93 * Default false. 92 94 * @return string The location of the remote path. 93 95 */ … … 104 106 105 107 /** 106 * Return the path on the remote filesystem of WP_LANG_DIR.108 * Returns the path on the remote filesystem of WP_LANG_DIR. 107 109 * 108 110 * @since 3.2.0 … … 115 117 116 118 /** 117 * Locate a folder on the remote filesystem.119 * Locates a folder on the remote filesystem. 118 120 * 119 121 * @since 2.5.0 … … 137 139 138 140 /** 139 * Locate a folder on the remote filesystem.141 * Locates a folder on the remote filesystem. 140 142 * 141 143 * @since 2.5.0 … … 158 160 159 161 /** 160 * Locate a folder on the remote filesystem.162 * Locates a folder on the remote filesystem. 161 163 * 162 164 * Assumes that on Windows systems, Stripping off the Drive 163 * letter is OK Sanitizes \\ to / in windows filepaths.165 * letter is OK Sanitizes \\ to / in Windows filepaths. 164 166 * 165 167 * @since 2.7.0 … … 230 232 231 233 /** 232 * Locate a folder on the remote filesystem.234 * Locates a folder on the remote filesystem. 233 235 * 234 236 * Expects Windows sanitized path. … … 268 270 * Working from /home/ to /user/ to /wordpress/ see if that file exists within 269 271 * the current folder, If it's found, change into it and follow through looking 270 * for it. If it can t find WordPress down that route, it'll continue onto the next272 * for it. If it can't find WordPress down that route, it'll continue onto the next 271 273 * folder level, and see if that matches, and so on. If it reaches the end, and still 272 * can t find it, it'll return false for the entire function.274 * can't find it, it'll return false for the entire function. 273 275 */ 274 276 if ( isset( $files[ $key ] ) ) { … … 312 314 313 315 /** 314 * Return the *nix-style file permissions for a file.316 * Returns the *nix-style file permissions for a file. 315 317 * 316 318 * From the PHP documentation page for fileperms(). … … 367 369 368 370 /** 369 * Gets the permissions of the specified file or filepath in their octal format 370 * 371 * @since 2.5.0 372 * @param string $file 373 * @return string the last 3 characters of the octal number 371 * Gets the permissions of the specified file or filepath in their octal format. 372 * 373 * @since 2.5.0 374 * 375 * @param string $file Path to the file. 376 * @return string Mode of the file (the last 3 digits). 374 377 */ 375 378 public function getchmod( $file ) { … … 378 381 379 382 /** 380 * Convert *nix-style file permissions to a octal number.383 * Converts *nix-style file permissions to a octal number. 381 384 * 382 385 * Converts '-rw-r--r--' to 0644 … … 418 421 419 422 /** 420 * Determine if the string provided contains binary characters.423 * Determines if the string provided contains binary characters. 421 424 * 422 425 * @since 2.7.0 423 426 * 424 427 * @param string $text String to test against. 425 * @return bool true if string is binary, false otherwise.428 * @return bool True if string is binary, false otherwise. 426 429 */ 427 430 public function is_binary( $text ) { … … 430 433 431 434 /** 432 * Change the ownership of a file / folder.435 * Changes the owner of a file or directory. 433 436 * 434 437 * Default behavior is to do nothing, override this in your subclass, if desired. … … 436 439 * @since 2.5.0 437 440 * 438 * @param string $file Path to the file. 439 * @param mixed $owner A user name or number. 440 * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. 441 * @return bool Returns true on success or false on failure. 441 * @param string $file Path to the file or directory. 442 * @param string|int $owner A user name or number. 443 * @param bool $recursive Optional. If set to true, changes file owner recursively. 444 * Default false. 445 * @return bool True on success, false on failure. 442 446 */ 443 447 public function chown( $file, $owner, $recursive = false ) { … … 446 450 447 451 /** 448 * Connect filesystem.449 * 450 * @since 2.5.0 451 * @abstract 452 * 453 * @return bool True on success orfalse on failure (always true for WP_Filesystem_Direct).452 * Connects filesystem. 453 * 454 * @since 2.5.0 455 * @abstract 456 * 457 * @return bool True on success, false on failure (always true for WP_Filesystem_Direct). 454 458 */ 455 459 public function connect() { … … 458 462 459 463 /** 460 * Read entire file into a string.464 * Reads entire file into a string. 461 465 * 462 466 * @since 2.5.0 … … 464 468 * 465 469 * @param string $file Name of the file to read. 466 * @return mixed|bool Returns the read data orfalse on failure.470 * @return string|false Read data on success, false on failure. 467 471 */ 468 472 public function get_contents( $file ) { … … 471 475 472 476 /** 473 * Read entire file into an array.477 * Reads entire file into an array. 474 478 * 475 479 * @since 2.5.0 … … 477 481 * 478 482 * @param string $file Path to the file. 479 * @return array| bool the file contents in an array orfalse on failure.483 * @return array|false File contents in an array on success, false on failure. 480 484 */ 481 485 public function get_contents_array( $file ) { … … 484 488 485 489 /** 486 * Write a string to a file. 487 * 488 * @since 2.5.0 489 * @abstract 490 * 491 * @param string $file Remote path to the file where to write the data. 492 * @param string $contents The data to write. 493 * @param int $mode Optional. The file permissions as octal number, usually 0644. 494 * @return bool False on failure. 490 * Writes a string to a file. 491 * 492 * @since 2.5.0 493 * @abstract 494 * 495 * @param string $file Remote path to the file where to write the data. 496 * @param string $contents The data to write. 497 * @param int|false $mode Optional. The file permissions as octal number, usually 0644. 498 * Default false. 499 * @return bool True on success, false on failure. 495 500 */ 496 501 public function put_contents( $file, $contents, $mode = false ) { … … 499 504 500 505 /** 501 * Get the current working directory.502 * 503 * @since 2.5.0 504 * @abstract 505 * 506 * @return string| bool The current working directory on success, orfalse on failure.506 * Gets the current working directory. 507 * 508 * @since 2.5.0 509 * @abstract 510 * 511 * @return string|false The current working directory on success, false on failure. 507 512 */ 508 513 public function cwd() { … … 511 516 512 517 /** 513 * Change current directory.518 * Changes current directory. 514 519 * 515 520 * @since 2.5.0 … … 517 522 * 518 523 * @param string $dir The new current directory. 519 * @return bool |string524 * @return bool True on success, false on failure. 520 525 */ 521 526 public function chdir( $dir ) { … … 524 529 525 530 /** 526 * Change the file group. 527 * 528 * @since 2.5.0 529 * @abstract 530 * 531 * @param string $file Path to the file. 532 * @param mixed $group A group name or number. 533 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. 534 * @return bool|string 531 * Changes the file group. 532 * 533 * @since 2.5.0 534 * @abstract 535 * 536 * @param string $file Path to the file. 537 * @param string|int $group A group name or number. 538 * @param bool $recursive Optional. If set to true, changes file group recursively. 539 * Default false. 540 * @return bool True on success, false on failure. 535 541 */ 536 542 public function chgrp( $file, $group, $recursive = false ) { … … 539 545 540 546 /** 541 * Change filesystem permissions. 542 * 543 * @since 2.5.0 544 * @abstract 545 * 546 * @param string $file Path to the file. 547 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. 548 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. 549 * @return bool|string 547 * Changes filesystem permissions. 548 * 549 * @since 2.5.0 550 * @abstract 551 * 552 * @param string $file Path to the file. 553 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 554 * 0755 for directories. Default false. 555 * @param bool $recursive Optional. If set to true, changes file group recursively. 556 * Default false. 557 * @return bool True on success, false on failure. 550 558 */ 551 559 public function chmod( $file, $mode = false, $recursive = false ) { … … 554 562 555 563 /** 556 * Get the file owner.564 * Gets the file owner. 557 565 * 558 566 * @since 2.5.0 … … 560 568 * 561 569 * @param string $file Path to the file. 562 * @return string| bool Username of the user or false on error.570 * @return string|false Username of the owner on success, false on failure. 563 571 */ 564 572 public function owner( $file ) { … … 567 575 568 576 /** 569 * Get the file's group.577 * Gets the file's group. 570 578 * 571 579 * @since 2.5.0 … … 573 581 * 574 582 * @param string $file Path to the file. 575 * @return string| bool The group or false on error.583 * @return string|false The group on success, false on failure. 576 584 */ 577 585 public function group( $file ) { … … 580 588 581 589 /** 582 * Copy a file. 590 * Copies a file. 591 * 592 * @since 2.5.0 593 * @abstract 594 * 595 * @param string $source Path to the source file. 596 * @param string $destination Path to the destination file. 597 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 598 * Default false. 599 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 600 * 0755 for dirs. Default false. 601 * @return bool True on success, false on failure. 602 */ 603 public function copy( $source, $destination, $overwrite = false, $mode = false ) { 604 return false; 605 } 606 607 /** 608 * Moves a file. 583 609 * 584 610 * @since 2.5.0 … … 589 615 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 590 616 * Default false. 591 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. 592 * Default false. 593 * @return bool True if file copied successfully, False otherwise. 594 */ 595 public function copy( $source, $destination, $overwrite = false, $mode = false ) { 596 return false; 597 } 598 599 /** 600 * Move a file. 601 * 602 * @since 2.5.0 603 * @abstract 604 * 605 * @param string $source Path to the source file. 606 * @param string $destination Path to the destination file. 607 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 608 * Default false. 609 * @return bool True if file copied successfully, False otherwise. 617 * @return bool True on success, false on failure. 610 618 */ 611 619 public function move( $source, $destination, $overwrite = false ) { … … 614 622 615 623 /** 616 * Delete a file or directory.617 * 618 * @since 2.5.0 619 * @abstract 620 * 621 * @param string $file Path to the file.622 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.623 * Default false.624 * @param bool$type Type of resource. 'f' for file, 'd' for directory.625 * Default false.626 * @return bool True if the file or directory was deleted, false on failure.624 * Deletes a file or directory. 625 * 626 * @since 2.5.0 627 * @abstract 628 * 629 * @param string $file Path to the file or directory. 630 * @param bool $recursive Optional. If set to true, changes file group recursively. 631 * Default false. 632 * @param string|false $type Type of resource. 'f' for file, 'd' for directory. 633 * Default false. 634 * @return bool True on success, false on failure. 627 635 */ 628 636 public function delete( $file, $recursive = false, $type = false ) { … … 631 639 632 640 /** 633 * Check if a file or directory exists.634 * 635 * @since 2.5.0 636 * @abstract 637 * 638 * @param string $file Path to file /directory.641 * Checks if a file or directory exists. 642 * 643 * @since 2.5.0 644 * @abstract 645 * 646 * @param string $file Path to file or directory. 639 647 * @return bool Whether $file exists or not. 640 648 */ … … 644 652 645 653 /** 646 * Check if resource is a file.654 * Checks if resource is a file. 647 655 * 648 656 * @since 2.5.0 … … 657 665 658 666 /** 659 * Check if resource is a directory.667 * Checks if resource is a directory. 660 668 * 661 669 * @since 2.5.0 … … 670 678 671 679 /** 672 * Check if a file is readable.680 * Checks if a file is readable. 673 681 * 674 682 * @since 2.5.0 … … 683 691 684 692 /** 685 * Check if a file or directory is writable. 693 * Checks if a file or directory is writable. 694 * 695 * @since 2.5.0 696 * @abstract 697 * 698 * @param string $file Path to file or directory. 699 * @return bool Whether $file is writable. 700 */ 701 public function is_writable( $file ) { 702 return false; 703 } 704 705 /** 706 * Gets the file's last access time. 686 707 * 687 708 * @since 2.5.0 … … 689 710 * 690 711 * @param string $file Path to file. 691 * @return bool Whether $file is writable.692 */ 693 public function is_writable( $file ) {694 return false; 695 } 696 697 /** 698 * Gets the file 's last accesstime.712 * @return int|false Unix timestamp representing last access time, false on failure. 713 */ 714 public function atime( $file ) { 715 return false; 716 } 717 718 /** 719 * Gets the file modification time. 699 720 * 700 721 * @since 2.5.0 … … 702 723 * 703 724 * @param string $file Path to file. 704 * @return int| bool Unix timestamp representing last access time.705 */ 706 public function atime( $file ) {707 return false; 708 } 709 710 /** 711 * Gets the file modification time.725 * @return int|false Unix timestamp representing modification time, false on failure. 726 */ 727 public function mtime( $file ) { 728 return false; 729 } 730 731 /** 732 * Gets the file size (in bytes). 712 733 * 713 734 * @since 2.5.0 … … 715 736 * 716 737 * @param string $file Path to file. 717 * @return int|bool Unix timestamp representing modification time. 718 */ 719 public function mtime( $file ) { 720 return false; 721 } 722 723 /** 724 * Gets the file size (in bytes). 725 * 726 * @since 2.5.0 727 * @abstract 728 * 729 * @param string $file Path to file. 730 * @return int|bool Size of the file in bytes. 738 * @return int|false Size of the file in bytes on success, false on failure. 731 739 */ 732 740 public function size( $file ) { … … 735 743 736 744 /** 737 * Set the access and modification times of a file.745 * Sets the access and modification times of a file. 738 746 * 739 747 * Note: If $file doesn't exist, it will be created. … … 747 755 * @param int $atime Optional. Access time to set for file. 748 756 * Default 0. 749 * @return bool Whether operation was successful or not.757 * @return bool True on success, false on failure. 750 758 */ 751 759 public function touch( $file, $time = 0, $atime = 0 ) { … … 754 762 755 763 /** 756 * Create a directory.757 * 758 * @since 2.5.0 759 * @abstract 760 * 761 * @param string $path Path for new directory.762 * @param mixed $chmod Optional. The permissions as octal number, (or False to skip chmod)763 * Default false.764 * @param mixed $chown Optional. A user name or number (or False to skip chown)765 * Default false.766 * @param mixed $chgrp Optional. A group name or number (or False to skip chgrp).767 * Default false.768 * @return bool False if directory cannot be created, true otherwise.764 * Creates a directory. 765 * 766 * @since 2.5.0 767 * @abstract 768 * 769 * @param string $path Path for new directory. 770 * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). 771 * Default false. 772 * @param string|int $chown Optional. A user name or number (or false to skip chown). 773 * Default false. 774 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp). 775 * Default false. 776 * @return bool True on success, false on failure. 769 777 */ 770 778 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { … … 773 781 774 782 /** 775 * Delete a directory.783 * Deletes a directory. 776 784 * 777 785 * @since 2.5.0 … … 781 789 * @param bool $recursive Optional. Whether to recursively remove files/directories. 782 790 * Default false. 783 * @return bool Whether directory is deleted successfully or not.791 * @return bool True on success, false on failure. 784 792 */ 785 793 public function rmdir( $path, $recursive = false ) { … … 788 796 789 797 /** 790 * Get details for files in a directory or a specific file.798 * Gets details for files in a directory or a specific file. 791 799 * 792 800 * @since 2.5.0 … … 798 806 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. 799 807 * Default false. 800 * @return array| bool{808 * @return array|false { 801 809 * Array of files. False if unable to list directory contents. 802 810 * 803 * @type string $name Name of the file /directory.811 * @type string $name Name of the file or directory. 804 812 * @type string $perms *nix representation of permissions. 805 813 * @type int $permsn Octal representation of permissions. -
trunk/src/wp-admin/includes/class-wp-filesystem-direct.php
r42343 r45226 17 17 18 18 /** 19 * constructor 20 * 21 * @param mixed $arg ignored argument 19 * Constructor. 20 * 21 * @since 2.5.0 22 * 23 * @param mixed $arg Not used. 22 24 */ 23 25 public function __construct( $arg ) { … … 27 29 28 30 /** 29 * Reads entire file into a string 31 * Reads entire file into a string. 32 * 33 * @since 2.5.0 30 34 * 31 35 * @param string $file Name of the file to read. 32 * @return string| bool The function returns the read data orfalse on failure.36 * @return string|false Read data on success, false on failure. 33 37 */ 34 38 public function get_contents( $file ) { … … 37 41 38 42 /** 39 * Reads entire file into an array 43 * Reads entire file into an array. 44 * 45 * @since 2.5.0 40 46 * 41 47 * @param string $file Path to the file. 42 * @return array| bool the file contents in an array orfalse on failure.48 * @return array|false File contents in an array on success, false on failure. 43 49 */ 44 50 public function get_contents_array( $file ) { … … 47 53 48 54 /** 49 * Write a string to a file 50 * 51 * @param string $file Remote path to the file where to write the data. 52 * @param string $contents The data to write. 53 * @param int $mode Optional. The file permissions as octal number, usually 0644. 54 * Default false. 55 * @return bool False upon failure, true otherwise. 55 * Writes a string to a file. 56 * 57 * @since 2.5.0 58 * 59 * @param string $file Remote path to the file where to write the data. 60 * @param string $contents The data to write. 61 * @param int|false $mode Optional. The file permissions as octal number, usually 0644. 62 * Default false. 63 * @return bool True on success, false on failure. 56 64 */ 57 65 public function put_contents( $file, $contents, $mode = false ) { … … 81 89 82 90 /** 83 * Gets the current working directory 84 * 85 * @return string|bool the current working directory on success, or false on failure. 91 * Gets the current working directory. 92 * 93 * @since 2.5.0 94 * 95 * @return string|false The current working directory on success, false on failure. 86 96 */ 87 97 public function cwd() { … … 90 100 91 101 /** 92 * Change directory 102 * Changes current directory. 103 * 104 * @since 2.5.0 93 105 * 94 106 * @param string $dir The new current directory. 95 * @return bool Returns true on success orfalse on failure.107 * @return bool True on success, false on failure. 96 108 */ 97 109 public function chdir( $dir ) { … … 100 112 101 113 /** 102 * Changes file group 103 * 104 * @param string $file Path to the file. 105 * @param mixed $group A group name or number. 106 * @param bool $recursive Optional. If set True changes file group recursively. Default false. 107 * @return bool Returns true on success or false on failure. 114 * Changes the file group. 115 * 116 * @since 2.5.0 117 * 118 * @param string $file Path to the file. 119 * @param string|int $group A group name or number. 120 * @param bool $recursive Optional. If set to true, changes file group recursively. 121 * Default false. 122 * @return bool True on success, false on failure. 108 123 */ 109 124 public function chgrp( $file, $group, $recursive = false ) { … … 128 143 129 144 /** 130 * Changes filesystem permissions 131 * 132 * @param string $file Path to the file. 133 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 134 * 0755 for dirs. Default false. 135 * @param bool $recursive Optional. If set True changes file group recursively. Default false. 136 * @return bool Returns true on success or false on failure. 145 * Changes filesystem permissions. 146 * 147 * @since 2.5.0 148 * 149 * @param string $file Path to the file. 150 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 151 * 0755 for directories. Default false. 152 * @param bool $recursive Optional. If set to true, changes file group recursively. 153 * Default false. 154 * @return bool True on success, false on failure. 137 155 */ 138 156 public function chmod( $file, $mode = false, $recursive = false ) { … … 161 179 162 180 /** 163 * Changes file owner 164 * 165 * @param string $file Path to the file. 166 * @param mixed $owner A user name or number. 167 * @param bool $recursive Optional. If set True changes file owner recursively. 168 * Default false. 169 * @return bool Returns true on success or false on failure. 181 * Changes the owner of a file or directory. 182 * 183 * @since 2.5.0 184 * 185 * @param string $file Path to the file or directory. 186 * @param string|int $owner A user name or number. 187 * @param bool $recursive Optional. If set to true, changes file owner recursively. 188 * Default false. 189 * @return bool True on success, false on failure. 170 190 */ 171 191 public function chown( $file, $owner, $recursive = false ) { … … 188 208 189 209 /** 190 * Gets file owner 210 * Gets the file owner. 211 * 212 * @since 2.5.0 191 213 * 192 214 * @param string $file Path to the file. 193 * @return string| bool Username of the user or false on error.215 * @return string|false Username of the owner on success, false on failure. 194 216 */ 195 217 public function owner( $file ) { … … 206 228 207 229 /** 208 * Gets file permissions230 * Gets the permissions of the specified file or filepath in their octal format. 209 231 * 210 232 * FIXME does not handle errors in fileperms() 211 233 * 234 * @since 2.5.0 235 * 212 236 * @param string $file Path to the file. 213 * @return string Mode of the file ( last 3 digits).237 * @return string Mode of the file (the last 3 digits). 214 238 */ 215 239 public function getchmod( $file ) { … … 218 242 219 243 /** 220 * @param string $file 221 * @return string|false 244 * Gets the file's group. 245 * 246 * @since 2.5.0 247 * 248 * @param string $file Path to the file. 249 * @return string|false The group on success, false on failure. 222 250 */ 223 251 public function group( $file ) { … … 234 262 235 263 /** 236 * @param string $source 237 * @param string $destination 238 * @param bool $overwrite 239 * @param int $mode 240 * @return bool 264 * Copies a file. 265 * 266 * @since 2.5.0 267 * 268 * @param string $source Path to the source file. 269 * @param string $destination Path to the destination file. 270 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 271 * Default false. 272 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 273 * 0755 for dirs. Default false. 274 * @return bool True on success, false on failure. 241 275 */ 242 276 public function copy( $source, $destination, $overwrite = false, $mode = false ) { … … 253 287 254 288 /** 255 * @param string $source 256 * @param string $destination 257 * @param bool $overwrite 258 * @return bool 289 * Moves a file. 290 * 291 * @since 2.5.0 292 * 293 * @param string $source Path to the source file. 294 * @param string $destination Path to the destination file. 295 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 296 * Default false. 297 * @return bool True on success, false on failure. 259 298 */ 260 299 public function move( $source, $destination, $overwrite = false ) { … … 277 316 278 317 /** 279 * @param string $file 280 * @param bool $recursive 281 * @param string $type 282 * @return bool 318 * Deletes a file or directory. 319 * 320 * @since 2.5.0 321 * 322 * @param string $file Path to the file or directory. 323 * @param bool $recursive Optional. If set to true, changes file group recursively. 324 * Default false. 325 * @param string|false $type Type of resource. 'f' for file, 'd' for directory. 326 * Default false. 327 * @return bool True on success, false on failure. 283 328 */ 284 329 public function delete( $file, $recursive = false, $type = false ) { … … 314 359 return $retval; 315 360 } 316 /** 317 * @param string $file 318 * @return bool 361 362 /** 363 * Checks if a file or directory exists. 364 * 365 * @since 2.5.0 366 * 367 * @param string $file Path to file or directory. 368 * @return bool Whether $file exists or not. 319 369 */ 320 370 public function exists( $file ) { 321 371 return @file_exists( $file ); 322 372 } 323 /** 324 * @param string $file 325 * @return bool 373 374 /** 375 * Checks if resource is a file. 376 * 377 * @since 2.5.0 378 * 379 * @param string $file File path. 380 * @return bool Whether $file is a file. 326 381 */ 327 382 public function is_file( $file ) { 328 383 return @is_file( $file ); 329 384 } 330 /** 331 * @param string $path 332 * @return bool 385 386 /** 387 * Checks if resource is a directory. 388 * 389 * @since 2.5.0 390 * 391 * @param string $path Directory path. 392 * @return bool Whether $path is a directory. 333 393 */ 334 394 public function is_dir( $path ) { … … 337 397 338 398 /** 339 * @param string $file 340 * @return bool 399 * Checks if a file is readable. 400 * 401 * @since 2.5.0 402 * 403 * @param string $file Path to file. 404 * @return bool Whether $file is readable. 341 405 */ 342 406 public function is_readable( $file ) { … … 345 409 346 410 /** 347 * @param string $file 348 * @return bool 411 * Checks if a file or directory is writable. 412 * 413 * @since 2.5.0 414 * 415 * @param string $file Path to file or directory. 416 * @return bool Whether $file is writable. 349 417 */ 350 418 public function is_writable( $file ) { … … 353 421 354 422 /** 355 * @param string $file 356 * @return int 423 * Gets the file's last access time. 424 * 425 * @since 2.5.0 426 * 427 * @param string $file Path to file. 428 * @return int|false Unix timestamp representing last access time, false on failure. 357 429 */ 358 430 public function atime( $file ) { … … 361 433 362 434 /** 363 * @param string $file 364 * @return int 435 * Gets the file modification time. 436 * 437 * @since 2.5.0 438 * 439 * @param string $file Path to file. 440 * @return int|false Unix timestamp representing modification time, false on failure. 365 441 */ 366 442 public function mtime( $file ) { … … 369 445 370 446 /** 371 * @param string $file 372 * @return int 447 * Gets the file size (in bytes). 448 * 449 * @since 2.5.0 450 * 451 * @param string $file Path to file. 452 * @return int|false Size of the file in bytes on success, false on failure. 373 453 */ 374 454 public function size( $file ) { … … 377 457 378 458 /** 379 * @param string $file 380 * @param int $time 381 * @param int $atime 382 * @return bool 459 * Sets the access and modification times of a file. 460 * 461 * Note: If $file doesn't exist, it will be created. 462 * 463 * @since 2.5.0 464 * 465 * @param string $file Path to file. 466 * @param int $time Optional. Modified time to set for file. 467 * Default 0. 468 * @param int $atime Optional. Access time to set for file. 469 * Default 0. 470 * @return bool True on success, false on failure. 383 471 */ 384 472 public function touch( $file, $time = 0, $atime = 0 ) { … … 393 481 394 482 /** 395 * @param string $path 396 * @param mixed $chmod 397 * @param mixed $chown 398 * @param mixed $chgrp 399 * @return bool 483 * Creates a directory. 484 * 485 * @since 2.5.0 486 * 487 * @param string $path Path for new directory. 488 * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). 489 * Default false. 490 * @param string|int $chown Optional. A user name or number (or false to skip chown). 491 * Default false. 492 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp). 493 * Default false. 494 * @return bool True on success, false on failure. 400 495 */ 401 496 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { … … 424 519 425 520 /** 426 * @param string $path 427 * @param bool $recursive 428 * @return bool 521 * Deletes a directory. 522 * 523 * @since 2.5.0 524 * 525 * @param string $path Path to directory. 526 * @param bool $recursive Optional. Whether to recursively remove files/directories. 527 * Default false. 528 * @return bool True on success, false on failure. 429 529 */ 430 530 public function rmdir( $path, $recursive = false ) { … … 433 533 434 534 /** 435 * @param string $path 436 * @param bool $include_hidden 437 * @param bool $recursive 438 * @return bool|array 535 * Gets details for files in a directory or a specific file. 536 * 537 * @since 2.5.0 538 * 539 * @param string $path Path to directory or file. 540 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. 541 * Default true. 542 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. 543 * Default false. 544 * @return array|false { 545 * Array of files. False if unable to list directory contents. 546 * 547 * @type string $name Name of the file or directory. 548 * @type string $perms *nix representation of permissions. 549 * @type int $permsn Octal representation of permissions. 550 * @type string $owner Owner name or ID. 551 * @type int $size Size of file in bytes. 552 * @type int $lastmodunix Last modified unix timestamp. 553 * @type mixed $lastmod Last modified month (3 letter) and day (without leading 0). 554 * @type int $time Last modified time. 555 * @type string $type Type of resource. 'f' for file, 'd' for directory. 556 * @type mixed $files If a directory and $recursive is true, contains another array of files. 557 * } 439 558 */ 440 559 public function dirlist( $path, $include_hidden = true, $recursive = false ) { -
trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php
r42343 r45226 15 15 */ 16 16 class WP_Filesystem_FTPext extends WP_Filesystem_Base { 17 18 /** 19 * @since 2.5.0 20 * @var resource 21 */ 17 22 public $link; 18 23 19 24 /** 25 * Constructor. 26 * 27 * @since 2.5.0 28 * 20 29 * @param array $opt 21 30 */ … … 68 77 69 78 /** 70 * @return bool 79 * Connects filesystem. 80 * 81 * @since 2.5.0 82 * 83 * @return bool True on success, false on failure. 71 84 */ 72 85 public function connect() { … … 111 124 112 125 /** 113 * Re trieves the file contents.114 * 115 * @since 2.5.0 116 * 117 * @param string $file Filename.118 * @return string|false File contents on success, false if no tempfile could be opened,126 * Reads entire file into a string. 127 * 128 * @since 2.5.0 129 * 130 * @param string $file Name of the file to read. 131 * @return string|false Read data on success, false if no temporary file could be opened, 119 132 * or if the file couldn't be retrieved. 120 133 */ … … 138 151 139 152 while ( ! feof( $temp ) ) { 140 $contents .= fread( $temp, 8 192);153 $contents .= fread( $temp, 8 * KB_IN_BYTES ); 141 154 } 142 155 … … 147 160 148 161 /** 149 * @param string $file 150 * @return array 162 * Reads entire file into an array. 163 * 164 * @since 2.5.0 165 * 166 * @param string $file Path to the file. 167 * @return array|false File contents in an array on success, false on failure. 151 168 */ 152 169 public function get_contents_array( $file ) { … … 155 172 156 173 /** 157 * @param string $file 158 * @param string $contents 159 * @param bool|int $mode 160 * @return bool 174 * Writes a string to a file. 175 * 176 * @since 2.5.0 177 * 178 * @param string $file Remote path to the file where to write the data. 179 * @param string $contents The data to write. 180 * @param int|false $mode Optional. The file permissions as octal number, usually 0644. 181 * Default false. 182 * @return bool True on success, false on failure. 161 183 */ 162 184 public function put_contents( $file, $contents, $mode = false ) { … … 195 217 196 218 /** 197 * @return string 219 * Gets the current working directory. 220 * 221 * @since 2.5.0 222 * 223 * @return string|false The current working directory on success, false on failure. 198 224 */ 199 225 public function cwd() { … … 206 232 207 233 /** 208 * @param string $dir 209 * @return bool 234 * Changes current directory. 235 * 236 * @since 2.5.0 237 * 238 * @param string $dir The new current directory. 239 * @return bool True on success, false on failure. 210 240 */ 211 241 public function chdir( $dir ) { … … 214 244 215 245 /** 216 * @param string $file 217 * @param int $mode 218 * @param bool $recursive 219 * @return bool 246 * Changes filesystem permissions. 247 * 248 * @since 2.5.0 249 * 250 * @param string $file Path to the file. 251 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 252 * 0755 for directories. Default false. 253 * @param bool $recursive Optional. If set to true, changes file group recursively. 254 * Default false. 255 * @return bool True on success, false on failure. 220 256 */ 221 257 public function chmod( $file, $mode = false, $recursive = false ) { … … 246 282 247 283 /** 248 * @param string $file 249 * @return string 284 * Gets the file owner. 285 * 286 * @since 2.5.0 287 * 288 * @param string $file Path to the file. 289 * @return string|false Username of the owner on success, false on failure. 250 290 */ 251 291 public function owner( $file ) { … … 253 293 return $dir[ $file ]['owner']; 254 294 } 255 /** 256 * @param string $file 257 * @return string 295 296 /** 297 * Gets the permissions of the specified file or filepath in their octal format. 298 * 299 * @since 2.5.0 300 * 301 * @param string $file Path to the file. 302 * @return string Mode of the file (the last 3 digits). 258 303 */ 259 304 public function getchmod( $file ) { … … 263 308 264 309 /** 265 * @param string $file 266 * @return string 310 * Gets the file's group. 311 * 312 * @since 2.5.0 313 * 314 * @param string $file Path to the file. 315 * @return string|false The group on success, false on failure. 267 316 */ 268 317 public function group( $file ) { … … 272 321 273 322 /** 274 * @param string $source 275 * @param string $destination 276 * @param bool $overwrite 277 * @param string|bool $mode 278 * @return bool 323 * Copies a file. 324 * 325 * @since 2.5.0 326 * 327 * @param string $source Path to the source file. 328 * @param string $destination Path to the destination file. 329 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 330 * Default false. 331 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 332 * 0755 for dirs. Default false. 333 * @return bool True on success, false on failure. 279 334 */ 280 335 public function copy( $source, $destination, $overwrite = false, $mode = false ) { … … 290 345 291 346 /** 292 * @param string $source 293 * @param string $destination 294 * @param bool $overwrite 295 * @return bool 347 * Moves a file. 348 * 349 * @since 2.5.0 350 * 351 * @param string $source Path to the source file. 352 * @param string $destination Path to the destination file. 353 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 354 * Default false. 355 * @return bool True on success, false on failure. 296 356 */ 297 357 public function move( $source, $destination, $overwrite = false ) { … … 300 360 301 361 /** 302 * @param string $file 303 * @param bool $recursive 304 * @param string $type 305 * @return bool 362 * Deletes a file or directory. 363 * 364 * @since 2.5.0 365 * 366 * @param string $file Path to the file or directory. 367 * @param bool $recursive Optional. If set to true, changes file group recursively. 368 * Default false. 369 * @param string|false $type Type of resource. 'f' for file, 'd' for directory. 370 * Default false. 371 * @return bool True on success, false on failure. 306 372 */ 307 373 public function delete( $file, $recursive = false, $type = false ) { … … 326 392 327 393 /** 328 * @param string $file 329 * @return bool 394 * Checks if a file or directory exists. 395 * 396 * @since 2.5.0 397 * 398 * @param string $file Path to file or directory. 399 * @return bool Whether $file exists or not. 330 400 */ 331 401 public function exists( $file ) { … … 340 410 341 411 /** 342 * @param string $file 343 * @return bool 412 * Checks if resource is a file. 413 * 414 * @since 2.5.0 415 * 416 * @param string $file File path. 417 * @return bool Whether $file is a file. 344 418 */ 345 419 public function is_file( $file ) { … … 348 422 349 423 /** 350 * @param string $path 351 * @return bool 424 * Checks if resource is a directory. 425 * 426 * @since 2.5.0 427 * 428 * @param string $path Directory path. 429 * @return bool Whether $path is a directory. 352 430 */ 353 431 public function is_dir( $path ) { … … 362 440 363 441 /** 364 * @param string $file 365 * @return bool 442 * Checks if a file is readable. 443 * 444 * @since 2.5.0 445 * 446 * @param string $file Path to file. 447 * @return bool Whether $file is readable. 366 448 */ 367 449 public function is_readable( $file ) { … … 370 452 371 453 /** 372 * @param string $file 373 * @return bool 454 * Checks if a file or directory is writable. 455 * 456 * @since 2.5.0 457 * 458 * @param string $file Path to file or directory. 459 * @return bool Whether $file is writable. 374 460 */ 375 461 public function is_writable( $file ) { … … 378 464 379 465 /** 380 * @param string $file 381 * @return bool 466 * Gets the file's last access time. 467 * 468 * @since 2.5.0 469 * 470 * @param string $file Path to file. 471 * @return int|false Unix timestamp representing last access time, false on failure. 382 472 */ 383 473 public function atime( $file ) { … … 386 476 387 477 /** 388 * @param string $file 389 * @return int 478 * Gets the file modification time. 479 * 480 * @since 2.5.0 481 * 482 * @param string $file Path to file. 483 * @return int|false Unix timestamp representing modification time, false on failure. 390 484 */ 391 485 public function mtime( $file ) { … … 394 488 395 489 /** 396 * @param string $file 397 * @return int 490 * Gets the file size (in bytes). 491 * 492 * @since 2.5.0 493 * 494 * @param string $file Path to file. 495 * @return int|false Size of the file in bytes on success, false on failure. 398 496 */ 399 497 public function size( $file ) { … … 402 500 403 501 /** 404 * @param string $file 405 * @return bool 502 * Sets the access and modification times of a file. 503 * 504 * Note: If $file doesn't exist, it will be created. 505 * 506 * @since 2.5.0 507 * 508 * @param string $file Path to file. 509 * @param int $time Optional. Modified time to set for file. 510 * Default 0. 511 * @param int $atime Optional. Access time to set for file. 512 * Default 0. 513 * @return bool True on success, false on failure. 406 514 */ 407 515 public function touch( $file, $time = 0, $atime = 0 ) { … … 410 518 411 519 /** 412 * @param string $path 413 * @param mixed $chmod 414 * @param mixed $chown 415 * @param mixed $chgrp 416 * @return bool 520 * Creates a directory. 521 * 522 * @since 2.5.0 523 * 524 * @param string $path Path for new directory. 525 * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). 526 * Default false. 527 * @param string|int $chown Optional. A user name or number (or false to skip chown). 528 * Default false. 529 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp). 530 * Default false. 531 * @return bool True on success, false on failure. 417 532 */ 418 533 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { … … 430 545 431 546 /** 432 * @param string $path 433 * @param bool $recursive 434 * @return bool 547 * Deletes a directory. 548 * 549 * @since 2.5.0 550 * 551 * @param string $path Path to directory. 552 * @param bool $recursive Optional. Whether to recursively remove files/directories. 553 * Default false. 554 * @return bool True on success, false on failure. 435 555 */ 436 556 public function rmdir( $path, $recursive = false ) { … … 524 644 525 645 /** 526 * @param string $path 527 * @param bool $include_hidden 528 * @param bool $recursive 529 * @return bool|array 646 * Gets details for files in a directory or a specific file. 647 * 648 * @since 2.5.0 649 * 650 * @param string $path Path to directory or file. 651 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. 652 * Default true. 653 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. 654 * Default false. 655 * @return array|false { 656 * Array of files. False if unable to list directory contents. 657 * 658 * @type string $name Name of the file or directory. 659 * @type string $perms *nix representation of permissions. 660 * @type int $permsn Octal representation of permissions. 661 * @type string $owner Owner name or ID. 662 * @type int $size Size of file in bytes. 663 * @type int $lastmodunix Last modified unix timestamp. 664 * @type mixed $lastmod Last modified month (3 letter) and day (without leading 0). 665 * @type int $time Last modified time. 666 * @type string $type Type of resource. 'f' for file, 'd' for directory. 667 * @type mixed $files If a directory and $recursive is true, contains another array of files. 668 * } 530 669 */ 531 670 public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { … … 538 677 539 678 $pwd = @ftp_pwd( $this->link ); 540 if ( ! @ftp_chdir( $this->link, $path ) ) { // Can t change to folder = folder doesn't exist679 if ( ! @ftp_chdir( $this->link, $path ) ) { // Can't change to folder = folder doesn't exist. 541 680 return false; 542 681 } … … 544 683 @ftp_chdir( $this->link, $pwd ); 545 684 546 if ( empty( $list ) ) { // Empty array = non-existent folder (real folder will show . at least) 685 if ( empty( $list ) ) { // Empty array = non-existent folder (real folder will show . at least). 547 686 return false; 548 687 } … … 586 725 587 726 /** 727 * Destructor. 728 * 729 * @since 2.5.0 588 730 */ 589 731 public function __destruct() { -
trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r42343 r45226 15 15 */ 16 16 class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { 17 /** 17 18 /** 19 * @since 2.5.0 18 20 * @var ftp 19 21 */ … … 21 23 22 24 /** 25 * Constructor. 26 * 27 * @since 2.5.0 28 * 23 29 * @param array $opt 24 30 */ … … 60 66 61 67 /** 62 * @return bool 68 * Connects filesystem. 69 * 70 * @since 2.5.0 71 * 72 * @return bool True on success, false on failure. 63 73 */ 64 74 public function connect() { … … 112 122 113 123 /** 114 * Re trieves the file contents.115 * 116 * @since 2.5.0 117 * 118 * @param string $file Filename.119 * @return string|false File contents on success, false if no tempfile could be opened,120 * or if the file doesn't exist.124 * Reads entire file into a string. 125 * 126 * @since 2.5.0 127 * 128 * @param string $file Name of the file to read. 129 * @return string|false Read data on success, false if no temporary file could be opened, 130 * or if the file couldn't be retrieved. 121 131 */ 122 132 public function get_contents( $file ) { … … 149 159 150 160 while ( ! feof( $temphandle ) ) { 151 $contents .= fread( $temphandle, 8 192);161 $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); 152 162 } 153 163 … … 158 168 159 169 /** 160 * @param string $file 161 * @return array 170 * Reads entire file into an array. 171 * 172 * @since 2.5.0 173 * 174 * @param string $file Path to the file. 175 * @return array|false File contents in an array on success, false on failure. 162 176 */ 163 177 public function get_contents_array( $file ) { … … 166 180 167 181 /** 168 * @param string $file 169 * @param string $contents 170 * @param int|bool $mode 171 * @return bool 182 * Writes a string to a file. 183 * 184 * @since 2.5.0 185 * 186 * @param string $file Remote path to the file where to write the data. 187 * @param string $contents The data to write. 188 * @param int|false $mode Optional. The file permissions as octal number, usually 0644. 189 * Default false. 190 * @return bool True on success, false on failure. 172 191 */ 173 192 public function put_contents( $file, $contents, $mode = false ) { … … 206 225 207 226 /** 208 * @return string 227 * Gets the current working directory. 228 * 229 * @since 2.5.0 230 * 231 * @return string|false The current working directory on success, false on failure. 209 232 */ 210 233 public function cwd() { … … 217 240 218 241 /** 219 * @param string $file 220 * @return bool 221 */ 222 public function chdir( $file ) { 223 return $this->ftp->chdir( $file ); 224 } 225 226 /** 227 * @param string $file 228 * @param int|bool $mode 229 * @param bool $recursive 230 * @return bool 242 * Changes current directory. 243 * 244 * @since 2.5.0 245 * 246 * @param string $dir The new current directory. 247 * @return bool True on success, false on failure. 248 */ 249 public function chdir( $dir ) { 250 return $this->ftp->chdir( $dir ); 251 } 252 253 /** 254 * Changes filesystem permissions. 255 * 256 * @since 2.5.0 257 * 258 * @param string $file Path to the file. 259 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 260 * 0755 for directories. Default false. 261 * @param bool $recursive Optional. If set to true, changes file group recursively. 262 * Default false. 263 * @return bool True on success, false on failure. 231 264 */ 232 265 public function chmod( $file, $mode = false, $recursive = false ) { … … 254 287 255 288 /** 256 * @param string $file 257 * @return string 289 * Gets the file owner. 290 * 291 * @since 2.5.0 292 * 293 * @param string $file Path to the file. 294 * @return string|false Username of the owner on success, false on failure. 258 295 */ 259 296 public function owner( $file ) { … … 263 300 264 301 /** 265 * @param string $file 266 * @return string 302 * Gets the permissions of the specified file or filepath in their octal format. 303 * 304 * @since 2.5.0 305 * 306 * @param string $file Path to the file. 307 * @return string Mode of the file (the last 3 digits). 267 308 */ 268 309 public function getchmod( $file ) { … … 272 313 273 314 /** 274 * @param string $file 275 * @return string 315 * Gets the file's group. 316 * 317 * @since 2.5.0 318 * 319 * @param string $file Path to the file. 320 * @return string|false The group on success, false on failure. 276 321 */ 277 322 public function group( $file ) { … … 281 326 282 327 /** 283 * @param string $source 284 * @param string $destination 285 * @param bool $overwrite 286 * @param int|bool $mode 287 * @return bool 328 * Copies a file. 329 * 330 * @since 2.5.0 331 * 332 * @param string $source Path to the source file. 333 * @param string $destination Path to the destination file. 334 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 335 * Default false. 336 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 337 * 0755 for dirs. Default false. 338 * @return bool True on success, false on failure. 288 339 */ 289 340 public function copy( $source, $destination, $overwrite = false, $mode = false ) { … … 301 352 302 353 /** 303 * @param string $source 304 * @param string $destination 305 * @param bool $overwrite 306 * @return bool 354 * Moves a file. 355 * 356 * @since 2.5.0 357 * 358 * @param string $source Path to the source file. 359 * @param string $destination Path to the destination file. 360 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 361 * Default false. 362 * @return bool True on success, false on failure. 307 363 */ 308 364 public function move( $source, $destination, $overwrite = false ) { … … 311 367 312 368 /** 313 * @param string $file 314 * @param bool $recursive 315 * @param string $type 316 * @return bool 369 * Deletes a file or directory. 370 * 371 * @since 2.5.0 372 * 373 * @param string $file Path to the file or directory. 374 * @param bool $recursive Optional. If set to true, changes file group recursively. 375 * Default false. 376 * @param string|false $type Type of resource. 'f' for file, 'd' for directory. 377 * Default false. 378 * @return bool True on success, false on failure. 317 379 */ 318 380 public function delete( $file, $recursive = false, $type = false ) { … … 331 393 332 394 /** 333 * @param string $file 334 * @return bool 395 * Checks if a file or directory exists. 396 * 397 * @since 2.5.0 398 * 399 * @param string $file Path to file or directory. 400 * @return bool Whether $file exists or not. 335 401 */ 336 402 public function exists( $file ) { … … 346 412 347 413 /** 348 * @param string $file 349 * @return bool 414 * Checks if resource is a file. 415 * 416 * @since 2.5.0 417 * 418 * @param string $file File path. 419 * @return bool Whether $file is a file. 350 420 */ 351 421 public function is_file( $file ) { … … 360 430 361 431 /** 362 * @param string $path 363 * @return bool 432 * Checks if resource is a directory. 433 * 434 * @since 2.5.0 435 * 436 * @param string $path Directory path. 437 * @return bool Whether $path is a directory. 364 438 */ 365 439 public function is_dir( $path ) { … … 373 447 374 448 /** 375 * @param string $file 376 * @return bool 449 * Checks if a file is readable. 450 * 451 * @since 2.5.0 452 * 453 * @param string $file Path to file. 454 * @return bool Whether $file is readable. 377 455 */ 378 456 public function is_readable( $file ) { … … 381 459 382 460 /** 383 * @param string $file 384 * @return bool 461 * Checks if a file or directory is writable. 462 * 463 * @since 2.5.0 464 * 465 * @param string $file Path to file or directory. 466 * @return bool Whether $file is writable. 385 467 */ 386 468 public function is_writable( $file ) { … … 389 471 390 472 /** 391 * @param string $file 392 * @return bool 473 * Gets the file's last access time. 474 * 475 * @since 2.5.0 476 * 477 * @param string $file Path to file. 478 * @return int|false Unix timestamp representing last access time, false on failure. 393 479 */ 394 480 public function atime( $file ) { … … 397 483 398 484 /** 399 * @param string $file 400 * @return int 485 * Gets the file modification time. 486 * 487 * @since 2.5.0 488 * 489 * @param string $file Path to file. 490 * @return int|false Unix timestamp representing modification time, false on failure. 401 491 */ 402 492 public function mtime( $file ) { … … 405 495 406 496 /** 407 * @param string $file 408 * @return int 497 * Gets the file size (in bytes). 498 * 499 * @since 2.5.0 500 * 501 * @param string $file Path to file. 502 * @return int|false Size of the file in bytes on success, false on failure. 409 503 */ 410 504 public function size( $file ) { … … 413 507 414 508 /** 415 * @param string $file 416 * @param int $time 417 * @param int $atime 418 * @return bool 509 * Sets the access and modification times of a file. 510 * 511 * Note: If $file doesn't exist, it will be created. 512 * 513 * @since 2.5.0 514 * 515 * @param string $file Path to file. 516 * @param int $time Optional. Modified time to set for file. 517 * Default 0. 518 * @param int $atime Optional. Access time to set for file. 519 * Default 0. 520 * @return bool True on success, false on failure. 419 521 */ 420 522 public function touch( $file, $time = 0, $atime = 0 ) { … … 423 525 424 526 /** 425 * @param string $path 426 * @param mixed $chmod 427 * @param mixed $chown 428 * @param mixed $chgrp 429 * @return bool 527 * Creates a directory. 528 * 529 * @since 2.5.0 530 * 531 * @param string $path Path for new directory. 532 * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). 533 * Default false. 534 * @param string|int $chown Optional. A user name or number (or false to skip chown). 535 * Default false. 536 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp). 537 * Default false. 538 * @return bool True on success, false on failure. 430 539 */ 431 540 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { … … 446 555 447 556 /** 448 * @param string $path 449 * @param bool $recursive 450 * @return bool 557 * Deletes a directory. 558 * 559 * @since 2.5.0 560 * 561 * @param string $path Path to directory. 562 * @param bool $recursive Optional. Whether to recursively remove files/directories. 563 * Default false. 564 * @return bool True on success, false on failure. 451 565 */ 452 566 public function rmdir( $path, $recursive = false ) { … … 455 569 456 570 /** 457 * @param string $path 458 * @param bool $include_hidden 459 * @param bool $recursive 460 * @return bool|array 571 * Gets details for files in a directory or a specific file. 572 * 573 * @since 2.5.0 574 * 575 * @param string $path Path to directory or file. 576 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. 577 * Default true. 578 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. 579 * Default false. 580 * @return array|false { 581 * Array of files. False if unable to list directory contents. 582 * 583 * @type string $name Name of the file or directory. 584 * @type string $perms *nix representation of permissions. 585 * @type int $permsn Octal representation of permissions. 586 * @type string $owner Owner name or ID. 587 * @type int $size Size of file in bytes. 588 * @type int $lastmodunix Last modified unix timestamp. 589 * @type mixed $lastmod Last modified month (3 letter) and day (without leading 0). 590 * @type int $time Last modified time. 591 * @type string $type Type of resource. 'f' for file, 'd' for directory. 592 * @type mixed $files If a directory and $recursive is true, contains another array of files. 593 * } 461 594 */ 462 595 public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { … … 518 651 519 652 /** 653 * Destructor. 654 * 655 * @since 2.5.0 520 656 */ 521 657 public function __destruct() { -
trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php
r42343 r45226 37 37 38 38 /** 39 * @since 2.7.0 40 * @var resource 39 41 */ 40 42 public $link = false; 41 43 42 44 /** 45 * @since 2.7.0 43 46 * @var resource 44 47 */ 45 48 public $sftp_link; 49 50 /** 51 * @since 2.7.0 52 * @var bool 53 */ 46 54 public $keys = false; 47 55 48 56 /** 57 * Constructor. 58 * 59 * @since 2.7.0 60 * 49 61 * @param array $opt 50 62 */ … … 110 122 111 123 /** 112 * @return bool 124 * Connects filesystem. 125 * 126 * @since 2.7.0 127 * 128 * @return bool True on success, false on failure. 113 129 */ 114 130 public function connect() { … … 194 210 195 211 /** 212 * @since 2.7.0 213 * 196 214 * @param string $command 197 215 * @param bool $returnbool … … 229 247 230 248 /** 231 * @param string $file 232 * @return string|false 249 * Reads entire file into a string. 250 * 251 * @since 2.7.0 252 * 253 * @param string $file Name of the file to read. 254 * @return string|false Read data on success, false if no temporary file could be opened, 255 * or if the file couldn't be retrieved. 233 256 */ 234 257 public function get_contents( $file ) { … … 237 260 238 261 /** 239 * @param string $file 240 * @return array 262 * Reads entire file into an array. 263 * 264 * @since 2.7.0 265 * 266 * @param string $file Path to the file. 267 * @return array|false File contents in an array on success, false on failure. 241 268 */ 242 269 public function get_contents_array( $file ) { … … 245 272 246 273 /** 247 * @param string $file 248 * @param string $contents 249 * @param bool|int $mode 250 * @return bool 274 * Writes a string to a file. 275 * 276 * @since 2.7.0 277 * 278 * @param string $file Remote path to the file where to write the data. 279 * @param string $contents The data to write. 280 * @param int|false $mode Optional. The file permissions as octal number, usually 0644. 281 * Default false. 282 * @return bool True on success, false on failure. 251 283 */ 252 284 public function put_contents( $file, $contents, $mode = false ) { … … 263 295 264 296 /** 265 * @return bool 297 * Gets the current working directory. 298 * 299 * @since 2.7.0 300 * 301 * @return string|false The current working directory on success, false on failure. 266 302 */ 267 303 public function cwd() { … … 274 310 275 311 /** 276 * @param string $dir 277 * @return bool|string 312 * Changes current directory. 313 * 314 * @since 2.7.0 315 * 316 * @param string $dir The new current directory. 317 * @return bool True on success, false on failure. 278 318 */ 279 319 public function chdir( $dir ) { … … 282 322 283 323 /** 284 * @param string $file 285 * @param string $group 286 * @param bool $recursive 287 * 288 * @return bool 324 * Changes the file group. 325 * 326 * @since 2.7.0 327 * 328 * @param string $file Path to the file. 329 * @param string|int $group A group name or number. 330 * @param bool $recursive Optional. If set to true, changes file group recursively. 331 * Default false. 332 * @return bool True on success, false on failure. 289 333 */ 290 334 public function chgrp( $file, $group, $recursive = false ) { … … 299 343 300 344 /** 301 * @param string $file 302 * @param int $mode 303 * @param bool $recursive 304 * @return bool|string 345 * Changes filesystem permissions. 346 * 347 * @since 2.7.0 348 * 349 * @param string $file Path to the file. 350 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 351 * 0755 for directories. Default false. 352 * @param bool $recursive Optional. If set to true, changes file group recursively. 353 * Default false. 354 * @return bool True on success, false on failure. 305 355 */ 306 356 public function chmod( $file, $mode = false, $recursive = false ) { … … 326 376 327 377 /** 328 * Change the ownership of a file / folder. 329 * 330 * @param string $file Path to the file. 378 * Changes the owner of a file or directory. 379 * 380 * @since 2.7.0 381 * 382 * @param string $file Path to the file or directory. 331 383 * @param string|int $owner A user name or number. 332 * @param bool $recursive Optional. If set True changes file owner recursivly. Default False. 333 * @return bool True on success or false on failure. 384 * @param bool $recursive Optional. If set to true, changes file owner recursively. 385 * Default false. 386 * @return bool True on success, false on failure. 334 387 */ 335 388 public function chown( $file, $owner, $recursive = false ) { … … 344 397 345 398 /** 346 * @param string $file 347 * @return string|false 399 * Gets the file owner. 400 * 401 * @since 2.7.0 402 * 403 * @param string $file Path to the file. 404 * @return string|false Username of the owner on success, false on failure. 348 405 */ 349 406 public function owner( $file ) { … … 360 417 361 418 /** 362 * @param string $file 363 * @return string 419 * Gets the permissions of the specified file or filepath in their octal format. 420 * 421 * @since 2.7.0 422 * 423 * @param string $file Path to the file. 424 * @return string Mode of the file (the last 3 digits). 364 425 */ 365 426 public function getchmod( $file ) { … … 368 429 369 430 /** 370 * @param string $file 371 * @return string|false 431 * Gets the file's group. 432 * 433 * @since 2.7.0 434 * 435 * @param string $file Path to the file. 436 * @return string|false The group on success, false on failure. 372 437 */ 373 438 public function group( $file ) { … … 384 449 385 450 /** 386 * @param string $source 387 * @param string $destination 388 * @param bool $overwrite 389 * @param int|bool $mode 390 * @return bool 451 * Copies a file. 452 * 453 * @since 2.7.0 454 * 455 * @param string $source Path to the source file. 456 * @param string $destination Path to the destination file. 457 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 458 * Default false. 459 * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, 460 * 0755 for dirs. Default false. 461 * @return bool True on success, false on failure. 391 462 */ 392 463 public function copy( $source, $destination, $overwrite = false, $mode = false ) { … … 402 473 403 474 /** 404 * @param string $source 405 * @param string $destination 406 * @param bool $overwrite 407 * @return bool 475 * Moves a file. 476 * 477 * @since 2.7.0 478 * 479 * @param string $source Path to the source file. 480 * @param string $destination Path to the destination file. 481 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. 482 * Default false. 483 * @return bool True on success, false on failure. 408 484 */ 409 485 public function move( $source, $destination, $overwrite = false ) { … … 412 488 413 489 /** 414 * @param string $file 415 * @param bool $recursive 416 * @param string|bool $type 417 * @return bool 490 * Deletes a file or directory. 491 * 492 * @since 2.7.0 493 * 494 * @param string $file Path to the file or directory. 495 * @param bool $recursive Optional. If set to true, changes file group recursively. 496 * Default false. 497 * @param string|false $type Type of resource. 'f' for file, 'd' for directory. 498 * Default false. 499 * @return bool True on success, false on failure. 418 500 */ 419 501 public function delete( $file, $recursive = false, $type = false ) { … … 434 516 435 517 /** 436 * @param string $file 437 * @return bool 518 * Checks if a file or directory exists. 519 * 520 * @since 2.7.0 521 * 522 * @param string $file Path to file or directory. 523 * @return bool Whether $file exists or not. 438 524 */ 439 525 public function exists( $file ) { … … 442 528 443 529 /** 444 * @param string $file 445 * @return bool 530 * Checks if resource is a file. 531 * 532 * @since 2.7.0 533 * 534 * @param string $file File path. 535 * @return bool Whether $file is a file. 446 536 */ 447 537 public function is_file( $file ) { … … 450 540 451 541 /** 452 * @param string $path 453 * @return bool 542 * Checks if resource is a directory. 543 * 544 * @since 2.7.0 545 * 546 * @param string $path Directory path. 547 * @return bool Whether $path is a directory. 454 548 */ 455 549 public function is_dir( $path ) { … … 458 552 459 553 /** 460 * @param string $file 461 * @return bool 554 * Checks if a file is readable. 555 * 556 * @since 2.7.0 557 * 558 * @param string $file Path to file. 559 * @return bool Whether $file is readable. 462 560 */ 463 561 public function is_readable( $file ) { … … 466 564 467 565 /** 468 * @param string $file 469 * @return bool 566 * Checks if a file or directory is writable. 567 * 568 * @since 2.7.0 569 * 570 * @param string $file Path to file or directory. 571 * @return bool Whether $file is writable. 470 572 */ 471 573 public function is_writable( $file ) { … … 475 577 476 578 /** 477 * @param string $file 478 * @return int 579 * Gets the file's last access time. 580 * 581 * @since 2.7.0 582 * 583 * @param string $file Path to file. 584 * @return int|false Unix timestamp representing last access time, false on failure. 479 585 */ 480 586 public function atime( $file ) { … … 483 589 484 590 /** 485 * @param string $file 486 * @return int 591 * Gets the file modification time. 592 * 593 * @since 2.7.0 594 * 595 * @param string $file Path to file. 596 * @return int|false Unix timestamp representing modification time, false on failure. 487 597 */ 488 598 public function mtime( $file ) { … … 491 601 492 602 /** 493 * @param string $file 494 * @return int 603 * Gets the file size (in bytes). 604 * 605 * @since 2.7.0 606 * 607 * @param string $file Path to file. 608 * @return int|false Size of the file in bytes on success, false on failure. 495 609 */ 496 610 public function size( $file ) { … … 499 613 500 614 /** 501 * @param string $file 502 * @param int $time 503 * @param int $atime 615 * Sets the access and modification times of a file. 616 * 617 * Note: Not implemented. 618 * 619 * @since 2.7.0 620 * 621 * @param string $file Path to file. 622 * @param int $time Optional. Modified time to set for file. 623 * Default 0. 624 * @param int $atime Optional. Access time to set for file. 625 * Default 0. 504 626 */ 505 627 public function touch( $file, $time = 0, $atime = 0 ) { 506 //Not implemented. 507 } 508 509 /** 510 * @param string $path 511 * @param mixed $chmod 512 * @param mixed $chown 513 * @param mixed $chgrp 514 * @return bool 628 // Not implemented. 629 } 630 631 /** 632 * Creates a directory. 633 * 634 * @since 2.7.0 635 * 636 * @param string $path Path for new directory. 637 * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). 638 * Default false. 639 * @param string|int $chown Optional. A user name or number (or false to skip chown). 640 * Default false. 641 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp). 642 * Default false. 643 * @return bool True on success, false on failure. 515 644 */ 516 645 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { … … 536 665 537 666 /** 538 * @param string $path 539 * @param bool $recursive 540 * @return bool 667 * Deletes a directory. 668 * 669 * @since 2.7.0 670 * 671 * @param string $path Path to directory. 672 * @param bool $recursive Optional. Whether to recursively remove files/directories. 673 * Default false. 674 * @return bool True on success, false on failure. 541 675 */ 542 676 public function rmdir( $path, $recursive = false ) { … … 545 679 546 680 /** 547 * @param string $path 548 * @param bool $include_hidden 549 * @param bool $recursive 550 * @return bool|array 681 * Gets details for files in a directory or a specific file. 682 * 683 * @since 2.7.0 684 * 685 * @param string $path Path to directory or file. 686 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. 687 * Default true. 688 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. 689 * Default false. 690 * @return array|false { 691 * Array of files. False if unable to list directory contents. 692 * 693 * @type string $name Name of the file or directory. 694 * @type string $perms *nix representation of permissions. 695 * @type int $permsn Octal representation of permissions. 696 * @type string $owner Owner name or ID. 697 * @type int $size Size of file in bytes. 698 * @type int $lastmodunix Last modified unix timestamp. 699 * @type mixed $lastmod Last modified month (3 letter) and day (without leading 0). 700 * @type int $time Last modified time. 701 * @type string $type Type of resource. 'f' for file, 'd' for directory. 702 * @type mixed $files If a directory and $recursive is true, contains another array of files. 703 * } 551 704 */ 552 705 public function dirlist( $path, $include_hidden = true, $recursive = false ) {
Note: See TracChangeset
for help on using the changeset viewer.