~canonical-sysadmins/wordpress/4.7

« back to all changes in this revision

Viewing changes to wp-admin/includes/class-wp-filesystem-base.php

  • Committer: Nick Moffitt
  • Date: 2015-01-15 11:04:26 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: nick.moffitt@canonical.com-20150115110426-5stm1p14cfnxrtme
New Upstream Version 4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
                         */
318
318
                        if ( isset($files[ $key ]) ){
319
319
 
320
 
                                // Lets try that folder:
 
320
                                // Let's try that folder:
321
321
                                $newdir = trailingslashit(path_join($base, $key));
322
322
                                if ( $this->verbose )
323
323
                                        printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
469
469
         * Connect filesystem.
470
470
         *
471
471
         * @since 2.5.0
472
 
         *
 
472
         * @abstract
473
473
         * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
474
474
         */
475
475
        public function connect() {
480
480
         * Read entire file into a string.
481
481
         *
482
482
         * @since 2.5.0
483
 
         *
 
483
         * @abstract
484
484
         * @param string $file Name of the file to read.
485
 
         * @return string|bool Returns the read data or false on failure.
 
485
         * @return mixed|bool Returns the read data or false on failure.
486
486
         */
487
487
        public function get_contents( $file ) {
488
488
                return false;
492
492
         * Read entire file into an array.
493
493
         *
494
494
         * @since 2.5.0
495
 
         *
 
495
         * @abstract
496
496
         * @param string $file Path to the file.
497
497
         * @return array|bool the file contents in an array or false on failure.
498
498
         */
504
504
         * Write a string to a file.
505
505
         *
506
506
         * @since 2.5.0
507
 
         *
 
507
         * @abstract
508
508
         * @param string $file     Remote path to the file where to write the data.
509
509
         * @param string $contents The data to write.
510
510
         * @param int    $mode     Optional. The file permissions as octal number, usually 0644.
518
518
         * Get the current working directory.
519
519
         *
520
520
         * @since 2.5.0
521
 
         *
 
521
         * @abstract
522
522
         * @return string|bool The current working directory on success, or false on failure.
523
523
         */
524
524
        public function cwd() {
529
529
         * Change current directory.
530
530
         *
531
531
         * @since 2.5.0
532
 
         *
 
532
         * @abstract
533
533
         * @param string $dir The new current directory.
534
534
         * @return bool Returns true on success or false on failure.
535
535
         */
541
541
         * Change the file group.
542
542
         *
543
543
         * @since 2.5.0
544
 
         *
 
544
         * @abstract
545
545
         * @param string $file      Path to the file.
546
546
         * @param mixed  $group     A group name or number.
547
547
         * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
555
555
         * Change filesystem permissions.
556
556
         *
557
557
         * @since 2.5.0
558
 
         *
 
558
         * @abstract
559
559
         * @param string $file      Path to the file.
560
560
         * @param int    $mode      Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
561
561
         * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
569
569
         * Get the file owner.
570
570
         *
571
571
         * @since 2.5.0
572
 
         *
 
572
         * @abstract
573
573
         * @param string $file Path to the file.
574
574
         * @return string|bool Username of the user or false on error.
575
575
         */
581
581
         * Get the file's group.
582
582
         *
583
583
         * @since 2.5.0
584
 
         *
 
584
         * @abstract
585
585
         * @param string $file Path to the file.
586
586
         * @return string|bool The group or false on error.
587
587
         */
593
593
         * Copy a file.
594
594
         *
595
595
         * @since 2.5.0
596
 
         *
 
596
         * @abstract
597
597
         * @param string $source      Path to the source file.
598
598
         * @param string $destination Path to the destination file.
599
599
         * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
610
610
         * Move a file.
611
611
         *
612
612
         * @since 2.5.0
613
 
         *
 
613
         * @abstract
614
614
         * @param string $source      Path to the source file.
615
615
         * @param string $destination Path to the destination file.
616
616
         * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
625
625
         * Delete a file or directory.
626
626
         *
627
627
         * @since 2.5.0
628
 
         *
 
628
         * @abstract
629
629
         * @param string $file      Path to the file.
630
630
         * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
631
631
         *                          Default false.
641
641
         * Check if a file or directory exists.
642
642
         *
643
643
         * @since 2.5.0
644
 
         *
 
644
         * @abstract
645
645
         * @param string $file Path to file/directory.
646
646
         * @return bool Whether $file exists or not.
647
647
         */
653
653
         * Check if resource is a file.
654
654
         *
655
655
         * @since 2.5.0
656
 
         *
 
656
         * @abstract
657
657
         * @param string $file File path.
658
658
         * @return bool Whether $file is a file.
659
659
         */
665
665
         * Check if resource is a directory.
666
666
         *
667
667
         * @since 2.5.0
668
 
         *
 
668
         * @abstract
669
669
         * @param string $path Directory path.
670
670
         * @return bool Whether $path is a directory.
671
671
         */
677
677
         * Check if a file is readable.
678
678
         *
679
679
         * @since 2.5.0
680
 
         *
 
680
         * @abstract
681
681
         * @param string $file Path to file.
682
682
         * @return bool Whether $file is readable.
683
683
         */
689
689
         * Check if a file or directory is writable.
690
690
         *
691
691
         * @since 2.5.0
692
 
         *
693
 
         * @param string $path Path to file/directory.
 
692
         * @abstract
694
693
         * @return bool Whether $file is writable.
695
694
         */
696
695
        public function is_writable( $file ) {
701
700
         * Gets the file's last access time.
702
701
         *
703
702
         * @since 2.5.0
704
 
         *
 
703
         * @abstract
705
704
         * @param string $file Path to file.
706
 
         * @return int Unix timestamp representing last access time.
 
705
         * @return int|bool Unix timestamp representing last access time.
707
706
         */
708
707
        public function atime( $file ) {
709
708
                return false;
713
712
         * Gets the file modification time.
714
713
         *
715
714
         * @since 2.5.0
716
 
         *
 
715
         * @abstract
717
716
         * @param string $file Path to file.
718
 
         * @return int Unix timestamp representing modification time.
 
717
         * @return int|bool Unix timestamp representing modification time.
719
718
         */
720
719
        public function mtime( $file ) {
721
720
                return false;
725
724
         * Gets the file size (in bytes).
726
725
         *
727
726
         * @since 2.5.0
728
 
         *
 
727
         * @abstract
729
728
         * @param string $file Path to file.
730
 
         * @return int Size of the file in bytes.
 
729
         * @return int|bool Size of the file in bytes.
731
730
         */
732
731
        public function size( $file ) {
733
732
                return false;
739
738
         * Note: If $file doesn't exist, it will be created.
740
739
         *
741
740
         * @since 2.5.0
742
 
         *
 
741
         * @abstract
743
742
         * @param string $file  Path to file.
744
743
         * @param int    $time  Optional. Modified time to set for file.
745
744
         *                      Default 0.
755
754
         * Create a directory.
756
755
         *
757
756
         * @since 2.5.0
758
 
         *
 
757
         * @abstract
759
758
         * @param string $path  Path for new directory.
760
759
         * @param mixed  $chmod Optional. The permissions as octal number, (or False to skip chmod)
761
760
         *                      Default false.
773
772
         * Delete a directory.
774
773
         *
775
774
         * @since 2.5.0
776
 
         *
 
775
         * @abstract
777
776
         * @param string $path      Path to directory.
778
777
         * @param bool   $recursive Optional. Whether to recursively remove files/directories.
779
778
         *                          Default false.
787
786
         * Get details for files in a directory or a specific file.
788
787
         *
789
788
         * @since 2.5.0
 
789
         * @abstract
790
790
         *
791
791
         * @param string $path           Path to directory or file.
792
792
         * @param bool   $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
796
796
         * @return array|bool {
797
797
         *     Array of files. False if unable to list directory contents.
798
798
         *
799
 
         *     @type string 'name'        Name of the file/directory.
800
 
         *     @type string 'perms'       *nix representation of permissions.
801
 
         *     @type int    'permsn'      Octal representation of permissions.
802
 
         *     @type string 'owner'       Owner name or ID.
803
 
         *     @type int    'size'        Size of file in bytes.
804
 
         *     @type int    'lastmodunix' Last modified unix timestamp.
805
 
         *     @type mixed  'lastmod'     Last modified month (3 letter) and day (without leading 0).
806
 
         *     @type int    'time'        Last modified time.
807
 
         *     @type string 'type'        Type of resource. 'f' for file, 'd' for directory.
808
 
         *     @type mixed  'files'       If a directory and $recursive is true, contains another array of files.
 
799
         *     @type string $name        Name of the file/directory.
 
800
         *     @type string $perms       *nix representation of permissions.
 
801
         *     @type int    $permsn      Octal representation of permissions.
 
802
         *     @type string $owner       Owner name or ID.
 
803
         *     @type int    $size        Size of file in bytes.
 
804
         *     @type int    $lastmodunix Last modified unix timestamp.
 
805
         *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
 
806
         *     @type int    $time        Last modified time.
 
807
         *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
 
808
         *     @type mixed  $files       If a directory and $recursive is true, contains another array of files.
809
809
         * }
810
810
         */
811
811
        public function dirlist( $path, $include_hidden = true, $recursive = false ) {