407 * @param string $file Path to the file. |
410 * @param string $file Path to the file. |
408 * @param mixed $owner A user name or number. |
411 * @param mixed $owner A user name or number. |
409 * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. |
412 * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. |
410 * @return bool Returns true on success or false on failure. |
413 * @return bool Returns true on success or false on failure. |
411 */ |
414 */ |
412 function chown( $file, $owner, $recursive = false ) { |
415 public function chown( $file, $owner, $recursive = false ) { |
413 return false; |
416 return false; |
414 } |
417 } |
415 |
418 |
416 /** |
419 /** |
417 * Connect filesystem. |
420 * Connect filesystem. |
418 * |
421 * |
419 * @since 2.5.0 |
422 * @since 2.5.0 |
420 * |
423 * @abstract |
421 * @return bool True on success or false on failure (always true for WP_Filesystem_Direct). |
424 * @return bool True on success or false on failure (always true for WP_Filesystem_Direct). |
422 */ |
425 */ |
423 function connect() { |
426 public function connect() { |
424 return true; |
427 return true; |
425 } |
428 } |
426 |
429 |
427 /** |
430 /** |
428 * Read entire file into a string. |
431 * Read entire file into a string. |
429 * |
432 * |
430 * @since 2.5.0 |
433 * @since 2.5.0 |
431 * |
434 * @abstract |
432 * @param string $file Name of the file to read. |
435 * @param string $file Name of the file to read. |
433 * @return string|bool Returns the read data or false on failure. |
436 * @return mixed|bool Returns the read data or false on failure. |
434 */ |
437 */ |
435 function get_contents( $file ) { |
438 public function get_contents( $file ) { |
436 return false; |
439 return false; |
437 } |
440 } |
438 |
441 |
439 /** |
442 /** |
440 * Read entire file into an array. |
443 * Read entire file into an array. |
441 * |
444 * |
442 * @since 2.5.0 |
445 * @since 2.5.0 |
443 * |
446 * @abstract |
444 * @param string $file Path to the file. |
447 * @param string $file Path to the file. |
445 * @return array|bool the file contents in an array or false on failure. |
448 * @return array|bool the file contents in an array or false on failure. |
446 */ |
449 */ |
447 function get_contents_array( $file ) { |
450 public function get_contents_array( $file ) { |
448 return false; |
451 return false; |
449 } |
452 } |
450 |
453 |
451 /** |
454 /** |
452 * Write a string to a file. |
455 * Write a string to a file. |
453 * |
456 * |
454 * @since 2.5.0 |
457 * @since 2.5.0 |
455 * |
458 * @abstract |
456 * @param string $file Remote path to the file where to write the data. |
459 * @param string $file Remote path to the file where to write the data. |
457 * @param string $contents The data to write. |
460 * @param string $contents The data to write. |
458 * @param int $mode Optional. The file permissions as octal number, usually 0644. |
461 * @param int $mode Optional. The file permissions as octal number, usually 0644. |
459 * @return bool False on failure. |
462 * @return bool False on failure. |
460 */ |
463 */ |
461 function put_contents( $file, $contents, $mode = false ) { |
464 public function put_contents( $file, $contents, $mode = false ) { |
462 return false; |
465 return false; |
463 } |
466 } |
464 |
467 |
465 /** |
468 /** |
466 * Get the current working directory. |
469 * Get the current working directory. |
467 * |
470 * |
468 * @since 2.5.0 |
471 * @since 2.5.0 |
469 * |
472 * @abstract |
470 * @return string|bool The current working directory on success, or false on failure. |
473 * @return string|bool The current working directory on success, or false on failure. |
471 */ |
474 */ |
472 function cwd() { |
475 public function cwd() { |
473 return false; |
476 return false; |
474 } |
477 } |
475 |
478 |
476 /** |
479 /** |
477 * Change current directory. |
480 * Change current directory. |
478 * |
481 * |
479 * @since 2.5.0 |
482 * @since 2.5.0 |
480 * |
483 * @abstract |
481 * @param string $dir The new current directory. |
484 * @param string $dir The new current directory. |
482 * @return bool Returns true on success or false on failure. |
485 * @return bool Returns true on success or false on failure. |
483 */ |
486 */ |
484 function chdir( $dir ) { |
487 public function chdir( $dir ) { |
485 return false; |
488 return false; |
486 } |
489 } |
487 |
490 |
488 /** |
491 /** |
489 * Change the file group. |
492 * Change the file group. |
490 * |
493 * |
491 * @since 2.5.0 |
494 * @since 2.5.0 |
492 * |
495 * @abstract |
493 * @param string $file Path to the file. |
496 * @param string $file Path to the file. |
494 * @param mixed $group A group name or number. |
497 * @param mixed $group A group name or number. |
495 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
498 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
496 * @return bool Returns true on success or false on failure. |
499 * @return bool Returns true on success or false on failure. |
497 */ |
500 */ |
498 function chgrp( $file, $group, $recursive = false ) { |
501 public function chgrp( $file, $group, $recursive = false ) { |
499 return false; |
502 return false; |
500 } |
503 } |
501 |
504 |
502 /** |
505 /** |
503 * Change filesystem permissions. |
506 * Change filesystem permissions. |
504 * |
507 * |
505 * @since 2.5.0 |
508 * @since 2.5.0 |
506 * |
509 * @abstract |
507 * @param string $file Path to the file. |
510 * @param string $file Path to the file. |
508 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. |
511 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. |
509 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
512 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
510 * @return bool Returns true on success or false on failure. |
513 * @return bool Returns true on success or false on failure. |
511 */ |
514 */ |
512 function chmod( $file, $mode = false, $recursive = false ) { |
515 public function chmod( $file, $mode = false, $recursive = false ) { |
513 return false; |
516 return false; |
514 } |
517 } |
515 |
518 |
516 /** |
519 /** |
517 * Get the file owner. |
520 * Get the file owner. |
518 * |
521 * |
519 * @since 2.5.0 |
522 * @since 2.5.0 |
520 * |
523 * @abstract |
521 * @param string $file Path to the file. |
524 * @param string $file Path to the file. |
522 * @return string|bool Username of the user or false on error. |
525 * @return string|bool Username of the user or false on error. |
523 */ |
526 */ |
524 function owner( $file ) { |
527 public function owner( $file ) { |
525 return false; |
528 return false; |
526 } |
529 } |
527 |
530 |
528 /** |
531 /** |
529 * Get the file's group. |
532 * Get the file's group. |
530 * |
533 * |
531 * @since 2.5.0 |
534 * @since 2.5.0 |
532 * |
535 * @abstract |
533 * @param string $file Path to the file. |
536 * @param string $file Path to the file. |
534 * @return string|bool The group or false on error. |
537 * @return string|bool The group or false on error. |
535 */ |
538 */ |
536 function group( $file ) { |
539 public function group( $file ) { |
537 return false; |
540 return false; |
538 } |
541 } |
539 |
542 |
540 /** |
543 /** |
541 * Copy a file. |
544 * Copy a file. |
542 * |
545 * |
543 * @since 2.5.0 |
546 * @since 2.5.0 |
544 * |
547 * @abstract |
545 * @param string $source Path to the source file. |
548 * @param string $source Path to the source file. |
546 * @param string $destination Path to the destination file. |
549 * @param string $destination Path to the destination file. |
547 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
550 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
548 * Default false. |
551 * Default false. |
549 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. |
552 * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs. |
550 * Default false. |
553 * Default false. |
551 * @return bool True if file copied successfully, False otherwise. |
554 * @return bool True if file copied successfully, False otherwise. |
552 */ |
555 */ |
553 function copy( $source, $destination, $overwrite = false, $mode = false ) { |
556 public function copy( $source, $destination, $overwrite = false, $mode = false ) { |
554 return false; |
557 return false; |
555 } |
558 } |
556 |
559 |
557 /** |
560 /** |
558 * Move a file. |
561 * Move a file. |
559 * |
562 * |
560 * @since 2.5.0 |
563 * @since 2.5.0 |
561 * |
564 * @abstract |
562 * @param string $source Path to the source file. |
565 * @param string $source Path to the source file. |
563 * @param string $destination Path to the destination file. |
566 * @param string $destination Path to the destination file. |
564 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
567 * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
565 * Default false. |
568 * Default false. |
566 * @return bool True if file copied successfully, False otherwise. |
569 * @return bool True if file copied successfully, False otherwise. |
567 */ |
570 */ |
568 function move( $source, $destination, $overwrite = false ) { |
571 public function move( $source, $destination, $overwrite = false ) { |
569 return false; |
572 return false; |
570 } |
573 } |
571 |
574 |
572 /** |
575 /** |
573 * Delete a file or directory. |
576 * Delete a file or directory. |
574 * |
577 * |
575 * @since 2.5.0 |
578 * @since 2.5.0 |
576 * |
579 * @abstract |
577 * @param string $file Path to the file. |
580 * @param string $file Path to the file. |
578 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
581 * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False. |
579 * Default false. |
582 * Default false. |
580 * @param bool $type Type of resource. 'f' for file, 'd' for directory. |
583 * @param bool $type Type of resource. 'f' for file, 'd' for directory. |
581 * Default false. |
584 * Default false. |
582 * @return bool True if the file or directory was deleted, false on failure. |
585 * @return bool True if the file or directory was deleted, false on failure. |
583 */ |
586 */ |
584 function delete( $file, $recursive = false, $type = false ) { |
587 public function delete( $file, $recursive = false, $type = false ) { |
585 return false; |
588 return false; |
586 } |
589 } |
587 |
590 |
588 /** |
591 /** |
589 * Check if a file or directory exists. |
592 * Check if a file or directory exists. |
590 * |
593 * |
591 * @since 2.5.0 |
594 * @since 2.5.0 |
592 * |
595 * @abstract |
593 * @param string $file Path to file/directory. |
596 * @param string $file Path to file/directory. |
594 * @return bool Whether $file exists or not. |
597 * @return bool Whether $file exists or not. |
595 */ |
598 */ |
596 function exists( $file ) { |
599 public function exists( $file ) { |
597 return false; |
600 return false; |
598 } |
601 } |
599 |
602 |
600 /** |
603 /** |
601 * Check if resource is a file. |
604 * Check if resource is a file. |
602 * |
605 * |
603 * @since 2.5.0 |
606 * @since 2.5.0 |
604 * |
607 * @abstract |
605 * @param string $file File path. |
608 * @param string $file File path. |
606 * @return bool Whether $file is a file. |
609 * @return bool Whether $file is a file. |
607 */ |
610 */ |
608 function is_file( $file ) { |
611 public function is_file( $file ) { |
609 return false; |
612 return false; |
610 } |
613 } |
611 |
614 |
612 /** |
615 /** |
613 * Check if resource is a directory. |
616 * Check if resource is a directory. |
614 * |
617 * |
615 * @since 2.5.0 |
618 * @since 2.5.0 |
616 * |
619 * @abstract |
617 * @param string $path Directory path. |
620 * @param string $path Directory path. |
618 * @return bool Whether $path is a directory. |
621 * @return bool Whether $path is a directory. |
619 */ |
622 */ |
620 function is_dir( $path ) { |
623 public function is_dir( $path ) { |
621 return false; |
624 return false; |
622 } |
625 } |
623 |
626 |
624 /** |
627 /** |
625 * Check if a file is readable. |
628 * Check if a file is readable. |
626 * |
629 * |
627 * @since 2.5.0 |
630 * @since 2.5.0 |
628 * |
631 * @abstract |
629 * @param string $file Path to file. |
632 * @param string $file Path to file. |
630 * @return bool Whether $file is readable. |
633 * @return bool Whether $file is readable. |
631 */ |
634 */ |
632 function is_readable( $file ) { |
635 public function is_readable( $file ) { |
633 return false; |
636 return false; |
634 } |
637 } |
635 |
638 |
636 /** |
639 /** |
637 * Check if a file or directory is writable. |
640 * Check if a file or directory is writable. |
638 * |
641 * |
639 * @since 2.5.0 |
642 * @since 2.5.0 |
640 * |
643 * @abstract |
641 * @param string $path Path to file/directory. |
|
642 * @return bool Whether $file is writable. |
644 * @return bool Whether $file is writable. |
643 */ |
645 */ |
644 function is_writable( $file ) { |
646 public function is_writable( $file ) { |
645 return false; |
647 return false; |
646 } |
648 } |
647 |
649 |
648 /** |
650 /** |
649 * Gets the file's last access time. |
651 * Gets the file's last access time. |
650 * |
652 * |
651 * @since 2.5.0 |
653 * @since 2.5.0 |
652 * |
654 * @abstract |
653 * @param string $file Path to file. |
655 * @param string $file Path to file. |
654 * @return int Unix timestamp representing last access time. |
656 * @return int|bool Unix timestamp representing last access time. |
655 */ |
657 */ |
656 function atime( $file ) { |
658 public function atime( $file ) { |
657 return false; |
659 return false; |
658 } |
660 } |
659 |
661 |
660 /** |
662 /** |
661 * Gets the file modification time. |
663 * Gets the file modification time. |
662 * |
664 * |
663 * @since 2.5.0 |
665 * @since 2.5.0 |
664 * |
666 * @abstract |
665 * @param string $file Path to file. |
667 * @param string $file Path to file. |
666 * @return int Unix timestamp representing modification time. |
668 * @return int|bool Unix timestamp representing modification time. |
667 */ |
669 */ |
668 function mtime( $file ) { |
670 public function mtime( $file ) { |
669 return false; |
671 return false; |
670 } |
672 } |
671 |
673 |
672 /** |
674 /** |
673 * Gets the file size (in bytes). |
675 * Gets the file size (in bytes). |
674 * |
676 * |
675 * @since 2.5.0 |
677 * @since 2.5.0 |
676 * |
678 * @abstract |
677 * @param string $file Path to file. |
679 * @param string $file Path to file. |
678 * @return int Size of the file in bytes. |
680 * @return int|bool Size of the file in bytes. |
679 */ |
681 */ |
680 function size( $file ) { |
682 public function size( $file ) { |
681 return false; |
683 return false; |
682 } |
684 } |
683 |
685 |
684 /** |
686 /** |
685 * Set the access and modification times of a file. |
687 * Set the access and modification times of a file. |
686 * |
688 * |
687 * Note: If $file doesn't exist, it will be created. |
689 * Note: If $file doesn't exist, it will be created. |
688 * |
690 * |
689 * @since 2.5.0 |
691 * @since 2.5.0 |
690 * |
692 * @abstract |
691 * @param string $file Path to file. |
693 * @param string $file Path to file. |
692 * @param int $time Optional. Modified time to set for file. |
694 * @param int $time Optional. Modified time to set for file. |
693 * Default 0. |
695 * Default 0. |
694 * @param int $atime Optional. Access time to set for file. |
696 * @param int $atime Optional. Access time to set for file. |
695 * Default 0. |
697 * Default 0. |
696 * @return bool Whether operation was successful or not. |
698 * @return bool Whether operation was successful or not. |
697 */ |
699 */ |
698 function touch( $file, $time = 0, $atime = 0 ) { |
700 public function touch( $file, $time = 0, $atime = 0 ) { |
699 return false; |
701 return false; |
700 } |
702 } |
701 |
703 |
702 /** |
704 /** |
703 * Create a directory. |
705 * Create a directory. |
704 * |
706 * |
705 * @since 2.5.0 |
707 * @since 2.5.0 |
706 * |
708 * @abstract |
707 * @param string $path Path for new directory. |
709 * @param string $path Path for new directory. |
708 * @param mixed $chmod Optional. The permissions as octal number, (or False to skip chmod) |
710 * @param mixed $chmod Optional. The permissions as octal number, (or False to skip chmod) |
709 * Default false. |
711 * Default false. |
710 * @param mixed $chown Optional. A user name or number (or False to skip chown) |
712 * @param mixed $chown Optional. A user name or number (or False to skip chown) |
711 * Default false. |
713 * Default false. |
712 * @param mixed $chgrp Optional. A group name or number (or False to skip chgrp). |
714 * @param mixed $chgrp Optional. A group name or number (or False to skip chgrp). |
713 * Default false. |
715 * Default false. |
714 * @return bool False if directory cannot be created, true otherwise. |
716 * @return bool False if directory cannot be created, true otherwise. |
715 */ |
717 */ |
716 function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { |
718 public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { |
717 return false; |
719 return false; |
718 } |
720 } |
719 |
721 |
720 /** |
722 /** |
721 * Delete a directory. |
723 * Delete a directory. |
722 * |
724 * |
723 * @since 2.5.0 |
725 * @since 2.5.0 |
724 * |
726 * @abstract |
725 * @param string $path Path to directory. |
727 * @param string $path Path to directory. |
726 * @param bool $recursive Optional. Whether to recursively remove files/directories. |
728 * @param bool $recursive Optional. Whether to recursively remove files/directories. |
727 * Default false. |
729 * Default false. |
728 * @return bool Whether directory is deleted successfully or not. |
730 * @return bool Whether directory is deleted successfully or not. |
729 */ |
731 */ |
730 function rmdir( $path, $recursive = false ) { |
732 public function rmdir( $path, $recursive = false ) { |
731 return false; |
733 return false; |
732 } |
734 } |
733 |
735 |
734 /** |
736 /** |
735 * Get details for files in a directory or a specific file. |
737 * Get details for files in a directory or a specific file. |
736 * |
738 * |
737 * @since 2.5.0 |
739 * @since 2.5.0 |
|
740 * @abstract |
738 * |
741 * |
739 * @param string $path Path to directory or file. |
742 * @param string $path Path to directory or file. |
740 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. |
743 * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. |
741 * Default true. |
744 * Default true. |
742 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. |
745 * @param bool $recursive Optional. Whether to recursively include file details in nested directories. |
743 * Default false. |
746 * Default false. |
744 * @return array|bool { |
747 * @return array|bool { |
745 * Array of files. False if unable to list directory contents. |
748 * Array of files. False if unable to list directory contents. |
746 * |
749 * |
747 * @type string 'name' Name of the file/directory. |
750 * @type string $name Name of the file/directory. |
748 * @type string 'perms' *nix representation of permissions. |
751 * @type string $perms *nix representation of permissions. |
749 * @type int 'permsn' Octal representation of permissions. |
752 * @type int $permsn Octal representation of permissions. |
750 * @type string 'owner' Owner name or ID. |
753 * @type string $owner Owner name or ID. |
751 * @type int 'size' Size of file in bytes. |
754 * @type int $size Size of file in bytes. |
752 * @type int 'lastmodunix' Last modified unix timestamp. |
755 * @type int $lastmodunix Last modified unix timestamp. |
753 * @type mixed 'lastmod' Last modified month (3 letter) and day (without leading 0). |
756 * @type mixed $lastmod Last modified month (3 letter) and day (without leading 0). |
754 * @type int 'time' Last modified time. |
757 * @type int $time Last modified time. |
755 * @type string 'type' Type of resource. 'f' for file, 'd' for directory. |
758 * @type string $type Type of resource. 'f' for file, 'd' for directory. |
756 * @type mixed 'files' If a directory and $recursive is true, contains another array of files. |
759 * @type mixed $files If a directory and $recursive is true, contains another array of files. |
757 * } |
760 * } |
758 */ |
761 */ |
759 function dirlist( $path, $include_hidden = true, $recursive = false ) { |
762 public function dirlist( $path, $include_hidden = true, $recursive = false ) { |
760 return false; |
763 return false; |
761 } |
764 } |
762 |
765 |
763 } // WP_Filesystem_Base |
766 } // WP_Filesystem_Base |