]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/class-wp-filesystem-base.php
WordPress 4.1
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-base.php
1 <?php
2 /**
3  * Base WordPress Filesystem
4  *
5  * @package WordPress
6  * @subpackage Filesystem
7  */
8
9 /**
10  * Base WordPress Filesystem class for which Filesystem implementations extend
11  *
12  * @since 2.5.0
13  */
14 class WP_Filesystem_Base {
15         /**
16          * Whether to display debug data for the connection.
17          *
18          * @access public
19          * @since 2.5.0
20          * @var bool
21          */
22         public $verbose = false;
23
24         /**
25          * Cached list of local filepaths to mapped remote filepaths.
26          *
27          * @access private
28          * @since 2.7.0
29          * @var array
30          */
31         private $cache = array();
32
33         /**
34          * The Access method of the current connection, Set automatically.
35          *
36          * @access public
37          * @since 2.5.0
38          * @var string
39          */
40         public $method = '';
41
42         /**
43          * Make private properties readable for backwards compatibility.
44          *
45          * @since 4.0.0
46          * @access public
47          *
48          * @param string $name Property to get.
49          * @return mixed Property.
50          */
51         public function __get( $name ) {
52                 return $this->$name;
53         }
54
55         /**
56          * Make private properties settable for backwards compatibility.
57          *
58          * @since 4.0.0
59          * @access public
60          *
61          * @param string $name  Property to set.
62          * @param mixed  $value Property value.
63          * @return mixed Newly-set property.
64          */
65         public function __set( $name, $value ) {
66                 return $this->$name = $value;
67         }
68
69         /**
70          * Make private properties checkable for backwards compatibility.
71          *
72          * @since 4.0.0
73          * @access public
74          *
75          * @param string $name Property to check if set.
76          * @return bool Whether the property is set.
77          */
78         public function __isset( $name ) {
79                 return isset( $this->$name );
80         }
81
82         /**
83          * Make private properties un-settable for backwards compatibility.
84          *
85          * @since 4.0.0
86          * @access public
87          *
88          * @param string $name Property to unset.
89          */
90         public function __unset( $name ) {
91                 unset( $this->$name );
92         }
93
94         /**
95          * Return the path on the remote filesystem of ABSPATH.
96          *
97          * @access public
98          * @since 2.7.0
99          *
100          * @return string The location of the remote path.
101          */
102         public function abspath() {
103                 $folder = $this->find_folder(ABSPATH);
104                 // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
105                 if ( ! $folder && $this->is_dir( '/' . WPINC ) )
106                         $folder = '/';
107                 return $folder;
108         }
109
110         /**
111          * Return the path on the remote filesystem of WP_CONTENT_DIR.
112          *
113          * @access public
114          * @since 2.7.0
115          *
116          * @return string The location of the remote path.
117          */
118         public function wp_content_dir() {
119                 return $this->find_folder(WP_CONTENT_DIR);
120         }
121
122         /**
123          * Return the path on the remote filesystem of WP_PLUGIN_DIR.
124          *
125          * @access public
126          * @since 2.7.0
127          *
128          * @return string The location of the remote path.
129          */
130         public function wp_plugins_dir() {
131                 return $this->find_folder(WP_PLUGIN_DIR);
132         }
133
134         /**
135          * Return the path on the remote filesystem of the Themes Directory.
136          *
137          * @access public
138          * @since 2.7.0
139          *
140          * @param string $theme The Theme stylesheet or template for the directory.
141          * @return string The location of the remote path.
142          */
143         public function wp_themes_dir( $theme = false ) {
144                 $theme_root = get_theme_root( $theme );
145
146                 // Account for relative theme roots
147                 if ( '/themes' == $theme_root || ! is_dir( $theme_root ) )
148                         $theme_root = WP_CONTENT_DIR . $theme_root;
149
150                 return $this->find_folder( $theme_root );
151         }
152
153         /**
154          * Return the path on the remote filesystem of WP_LANG_DIR.
155          *
156          * @access public
157          * @since 3.2.0
158          *
159          * @return string The location of the remote path.
160          */
161         public function wp_lang_dir() {
162                 return $this->find_folder(WP_LANG_DIR);
163         }
164
165         /**
166          * Locate a folder on the remote filesystem.
167          *
168          * @access public
169          * @since 2.5.0
170          * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
171          * @see WP_Filesystem::abspath()
172          * @see WP_Filesystem::wp_content_dir()
173          * @see WP_Filesystem::wp_plugins_dir()
174          * @see WP_Filesystem::wp_themes_dir()
175          * @see WP_Filesystem::wp_lang_dir()
176          *
177          * @param string $base The folder to start searching from.
178          * @param bool   $echo True to display debug information.
179          *                     Default false.
180          * @return string The location of the remote path.
181          */
182         public function find_base_dir( $base = '.', $echo = false ) {
183                 _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
184                 $this->verbose = $echo;
185                 return $this->abspath();
186         }
187
188         /**
189          * Locate a folder on the remote filesystem.
190          *
191          * @access public
192          * @since 2.5.0
193          * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
194          * @see WP_Filesystem::abspath()
195          * @see WP_Filesystem::wp_content_dir()
196          * @see WP_Filesystem::wp_plugins_dir()
197          * @see WP_Filesystem::wp_themes_dir()
198          * @see WP_Filesystem::wp_lang_dir()
199          *
200          * @param string $base The folder to start searching from.
201          * @param bool   $echo True to display debug information.
202          * @return string The location of the remote path.
203          */
204         public function get_base_dir( $base = '.', $echo = false ) {
205                 _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
206                 $this->verbose = $echo;
207                 return $this->abspath();
208         }
209
210         /**
211          * Locate a folder on the remote filesystem.
212          *
213          * Assumes that on Windows systems, Stripping off the Drive
214          * letter is OK Sanitizes \\ to / in windows filepaths.
215          *
216          * @access public
217          * @since 2.7.0
218          *
219          * @param string $folder the folder to locate.
220          * @return string The location of the remote path.
221          */
222         public function find_folder( $folder ) {
223
224                 if ( isset( $this->cache[ $folder ] ) )
225                         return $this->cache[ $folder ];
226
227                 if ( stripos($this->method, 'ftp') !== false ) {
228                         $constant_overrides = array(
229                                 'FTP_BASE' => ABSPATH,
230                                 'FTP_CONTENT_DIR' => WP_CONTENT_DIR,
231                                 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR,
232                                 'FTP_LANG_DIR' => WP_LANG_DIR
233                         );
234
235                         // Direct matches ( folder = CONSTANT/ )
236                         foreach ( $constant_overrides as $constant => $dir ) {
237                                 if ( ! defined( $constant ) )
238                                         continue;
239                                 if ( $folder === $dir )
240                                         return trailingslashit( constant( $constant ) );
241                         }
242
243                         // Prefix Matches ( folder = CONSTANT/subdir )
244                         foreach ( $constant_overrides as $constant => $dir ) {
245                                 if ( ! defined( $constant ) )
246                                         continue;
247                                 if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
248                                         $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
249                                         $potential_folder = trailingslashit( $potential_folder );
250
251                                         if ( $this->is_dir( $potential_folder ) ) {
252                                                 $this->cache[ $folder ] = $potential_folder;
253                                                 return $potential_folder;
254                                         }
255                                 }
256                         }
257                 } elseif ( 'direct' == $this->method ) {
258                         $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
259                         return trailingslashit($folder);
260                 }
261
262                 $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.
263                 $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
264
265                 if ( isset($this->cache[ $folder ] ) )
266                         return $this->cache[ $folder ];
267
268                 if ( $this->exists($folder) ) { // Folder exists at that absolute path.
269                         $folder = trailingslashit($folder);
270                         $this->cache[ $folder ] = $folder;
271                         return $folder;
272                 }
273                 if ( $return = $this->search_for_folder($folder) )
274                         $this->cache[ $folder ] = $return;
275                 return $return;
276         }
277
278         /**
279          * Locate a folder on the remote filesystem.
280          *
281          * Expects Windows sanitized path.
282          *
283          * @access private
284          * @since 2.7.0
285          *
286          * @param string $folder The folder to locate.
287          * @param string $base   The folder to start searching from.
288          * @param bool   $loop   If the function has recursed, Internal use only.
289          * @return string The location of the remote path.
290          */
291         public function search_for_folder( $folder, $base = '.', $loop = false ) {
292                 if ( empty( $base ) || '.' == $base )
293                         $base = trailingslashit($this->cwd());
294
295                 $folder = untrailingslashit($folder);
296
297                 if ( $this->verbose )
298                         printf( "\n" . __('Looking for %1$s in %2$s') . "<br/>\n", $folder, $base );
299
300                 $folder_parts = explode('/', $folder);
301                 $folder_part_keys = array_keys( $folder_parts );
302                 $last_index = array_pop( $folder_part_keys );
303                 $last_path = $folder_parts[ $last_index ];
304
305                 $files = $this->dirlist( $base );
306
307                 foreach ( $folder_parts as $index => $key ) {
308                         if ( $index == $last_index )
309                                 continue; // We want this to be caught by the next code block.
310
311                         /*
312                          * Working from /home/ to /user/ to /wordpress/ see if that file exists within
313                          * the current folder, If it's found, change into it and follow through looking
314                          * for it. If it cant find WordPress down that route, it'll continue onto the next
315                          * folder level, and see if that matches, and so on. If it reaches the end, and still
316                          * cant find it, it'll return false for the entire function.
317                          */
318                         if ( isset($files[ $key ]) ){
319
320                                 // Let's try that folder:
321                                 $newdir = trailingslashit(path_join($base, $key));
322                                 if ( $this->verbose )
323                                         printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
324
325                                 // Only search for the remaining path tokens in the directory, not the full path again.
326                                 $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
327                                 if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
328                                         return $ret;
329                         }
330                 }
331
332                 // Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take.
333                 if (isset( $files[ $last_path ] ) ) {
334                         if ( $this->verbose )
335                                 printf( "\n" . __('Found %s') . "<br/>\n",  $base . $last_path );
336                         return trailingslashit($base . $last_path);
337                 }
338
339                 // Prevent this function from looping again.
340                 // No need to proceed if we've just searched in /
341                 if ( $loop || '/' == $base )
342                         return false;
343
344                 // As an extra last resort, Change back to / if the folder wasn't found.
345                 // This comes into effect when the CWD is /home/user/ but WP is at /var/www/....
346                 return $this->search_for_folder( $folder, '/', true );
347
348         }
349
350         /**
351          * Return the *nix-style file permissions for a file.
352          *
353          * From the PHP documentation page for fileperms().
354          *
355          * @link http://docs.php.net/fileperms
356          *
357          * @access public
358          * @since 2.5.0
359          *
360          * @param string $file String filename.
361          * @return string The *nix-style representation of permissions.
362          */
363         public function gethchmod( $file ){
364                 $perms = $this->getchmod($file);
365                 if (($perms & 0xC000) == 0xC000) // Socket
366                         $info = 's';
367                 elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
368                         $info = 'l';
369                 elseif (($perms & 0x8000) == 0x8000) // Regular
370                         $info = '-';
371                 elseif (($perms & 0x6000) == 0x6000) // Block special
372                         $info = 'b';
373                 elseif (($perms & 0x4000) == 0x4000) // Directory
374                         $info = 'd';
375                 elseif (($perms & 0x2000) == 0x2000) // Character special
376                         $info = 'c';
377                 elseif (($perms & 0x1000) == 0x1000) // FIFO pipe
378                         $info = 'p';
379                 else // Unknown
380                         $info = 'u';
381
382                 // Owner
383                 $info .= (($perms & 0x0100) ? 'r' : '-');
384                 $info .= (($perms & 0x0080) ? 'w' : '-');
385                 $info .= (($perms & 0x0040) ?
386                                         (($perms & 0x0800) ? 's' : 'x' ) :
387                                         (($perms & 0x0800) ? 'S' : '-'));
388
389                 // Group
390                 $info .= (($perms & 0x0020) ? 'r' : '-');
391                 $info .= (($perms & 0x0010) ? 'w' : '-');
392                 $info .= (($perms & 0x0008) ?
393                                         (($perms & 0x0400) ? 's' : 'x' ) :
394                                         (($perms & 0x0400) ? 'S' : '-'));
395
396                 // World
397                 $info .= (($perms & 0x0004) ? 'r' : '-');
398                 $info .= (($perms & 0x0002) ? 'w' : '-');
399                 $info .= (($perms & 0x0001) ?
400                                         (($perms & 0x0200) ? 't' : 'x' ) :
401                                         (($perms & 0x0200) ? 'T' : '-'));
402                 return $info;
403         }
404
405         /**
406          * Convert *nix-style file permissions to a octal number.
407          *
408          * Converts '-rw-r--r--' to 0644
409          * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
410          *
411          * @link http://docs.php.net/manual/en/function.chmod.php#49614
412          *
413          * @access public
414          * @since 2.5.0
415          *
416          * @param string $mode string The *nix-style file permission.
417          * @return int octal representation
418          */
419         public function getnumchmodfromh( $mode ) {
420                 $realmode = '';
421                 $legal =  array('', 'w', 'r', 'x', '-');
422                 $attarray = preg_split('//', $mode);
423
424                 for ($i=0; $i < count($attarray); $i++)
425                    if ($key = array_search($attarray[$i], $legal))
426                            $realmode .= $legal[$key];
427
428                 $mode = str_pad($realmode, 10, '-', STR_PAD_LEFT);
429                 $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
430                 $mode = strtr($mode,$trans);
431
432                 $newmode = $mode[0];
433                 $newmode .= $mode[1] + $mode[2] + $mode[3];
434                 $newmode .= $mode[4] + $mode[5] + $mode[6];
435                 $newmode .= $mode[7] + $mode[8] + $mode[9];
436                 return $newmode;
437         }
438
439         /**
440          * Determine if the string provided contains binary characters.
441          *
442          * @access private
443          * @since 2.7.0
444          *
445          * @param string $text String to test against.
446          * @return bool true if string is binary, false otherwise.
447          */
448         public function is_binary( $text ) {
449                 return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
450         }
451
452         /**
453          * Change the ownership of a file / folder.
454          *
455          * Default behavior is to do nothing, override this in your subclass, if desired.
456          *
457          * @since 2.5.0
458          *
459          * @param string $file      Path to the file.
460          * @param mixed  $owner     A user name or number.
461          * @param bool   $recursive Optional. If set True changes file owner recursivly. Defaults to False.
462          * @return bool Returns true on success or false on failure.
463          */
464         public function chown( $file, $owner, $recursive = false ) {
465                 return false;
466         }
467
468         /**
469          * Connect filesystem.
470          *
471          * @since 2.5.0
472          * @abstract
473          * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
474          */
475         public function connect() {
476                 return true;
477         }
478
479         /**
480          * Read entire file into a string.
481          *
482          * @since 2.5.0
483          * @abstract
484          * @param string $file Name of the file to read.
485          * @return mixed|bool Returns the read data or false on failure.
486          */
487         public function get_contents( $file ) {
488                 return false;
489         }
490
491         /**
492          * Read entire file into an array.
493          *
494          * @since 2.5.0
495          * @abstract
496          * @param string $file Path to the file.
497          * @return array|bool the file contents in an array or false on failure.
498          */
499         public function get_contents_array( $file ) {
500                 return false;
501         }
502
503         /**
504          * Write a string to a file.
505          *
506          * @since 2.5.0
507          * @abstract
508          * @param string $file     Remote path to the file where to write the data.
509          * @param string $contents The data to write.
510          * @param int    $mode     Optional. The file permissions as octal number, usually 0644.
511          * @return bool False on failure.
512          */
513         public function put_contents( $file, $contents, $mode = false ) {
514                 return false;
515         }
516
517         /**
518          * Get the current working directory.
519          *
520          * @since 2.5.0
521          * @abstract
522          * @return string|bool The current working directory on success, or false on failure.
523          */
524         public function cwd() {
525                 return false;
526         }
527
528         /**
529          * Change current directory.
530          *
531          * @since 2.5.0
532          * @abstract
533          * @param string $dir The new current directory.
534          * @return bool Returns true on success or false on failure.
535          */
536         public function chdir( $dir ) {
537                 return false;
538         }
539
540         /**
541          * Change the file group.
542          *
543          * @since 2.5.0
544          * @abstract
545          * @param string $file      Path to the file.
546          * @param mixed  $group     A group name or number.
547          * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
548          * @return bool Returns true on success or false on failure.
549          */
550         public function chgrp( $file, $group, $recursive = false ) {
551                 return false;
552         }
553
554         /**
555          * Change filesystem permissions.
556          *
557          * @since 2.5.0
558          * @abstract
559          * @param string $file      Path to the file.
560          * @param int    $mode      Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
561          * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
562          * @return bool Returns true on success or false on failure.
563          */
564         public function chmod( $file, $mode = false, $recursive = false ) {
565                 return false;
566         }
567
568         /**
569          * Get the file owner.
570          *
571          * @since 2.5.0
572          * @abstract
573          * @param string $file Path to the file.
574          * @return string|bool Username of the user or false on error.
575          */
576         public function owner( $file ) {
577                 return false;
578         }
579
580         /**
581          * Get the file's group.
582          *
583          * @since 2.5.0
584          * @abstract
585          * @param string $file Path to the file.
586          * @return string|bool The group or false on error.
587          */
588         public function group( $file ) {
589                 return false;
590         }
591
592         /**
593          * Copy a file.
594          *
595          * @since 2.5.0
596          * @abstract
597          * @param string $source      Path to the source file.
598          * @param string $destination Path to the destination file.
599          * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
600          *                            Default false.
601          * @param int    $mode        Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
602          *                            Default false.
603          * @return bool True if file copied successfully, False otherwise.
604          */
605         public function copy( $source, $destination, $overwrite = false, $mode = false ) {
606                 return false;
607         }
608
609         /**
610          * Move a file.
611          *
612          * @since 2.5.0
613          * @abstract
614          * @param string $source      Path to the source file.
615          * @param string $destination Path to the destination file.
616          * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
617          *                            Default false.
618          * @return bool True if file copied successfully, False otherwise.
619          */
620         public function move( $source, $destination, $overwrite = false ) {
621                 return false;
622         }
623
624         /**
625          * Delete a file or directory.
626          *
627          * @since 2.5.0
628          * @abstract
629          * @param string $file      Path to the file.
630          * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
631          *                          Default false.
632          * @param bool   $type      Type of resource. 'f' for file, 'd' for directory.
633          *                          Default false.
634          * @return bool True if the file or directory was deleted, false on failure.
635          */
636         public function delete( $file, $recursive = false, $type = false ) {
637                 return false;
638         }
639
640         /**
641          * Check if a file or directory exists.
642          *
643          * @since 2.5.0
644          * @abstract
645          * @param string $file Path to file/directory.
646          * @return bool Whether $file exists or not.
647          */
648         public function exists( $file ) {
649                 return false;
650         }
651
652         /**
653          * Check if resource is a file.
654          *
655          * @since 2.5.0
656          * @abstract
657          * @param string $file File path.
658          * @return bool Whether $file is a file.
659          */
660         public function is_file( $file ) {
661                 return false;
662         }
663
664         /**
665          * Check if resource is a directory.
666          *
667          * @since 2.5.0
668          * @abstract
669          * @param string $path Directory path.
670          * @return bool Whether $path is a directory.
671          */
672         public function is_dir( $path ) {
673                 return false;
674         }
675
676         /**
677          * Check if a file is readable.
678          *
679          * @since 2.5.0
680          * @abstract
681          * @param string $file Path to file.
682          * @return bool Whether $file is readable.
683          */
684         public function is_readable( $file ) {
685                 return false;
686         }
687
688         /**
689          * Check if a file or directory is writable.
690          *
691          * @since 2.5.0
692          * @abstract
693          * @return bool Whether $file is writable.
694          */
695         public function is_writable( $file ) {
696                 return false;
697         }
698
699         /**
700          * Gets the file's last access time.
701          *
702          * @since 2.5.0
703          * @abstract
704          * @param string $file Path to file.
705          * @return int|bool Unix timestamp representing last access time.
706          */
707         public function atime( $file ) {
708                 return false;
709         }
710
711         /**
712          * Gets the file modification time.
713          *
714          * @since 2.5.0
715          * @abstract
716          * @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          * @param string $file Path to file.
729          * @return int|bool Size of the file in bytes.
730          */
731         public function size( $file ) {
732                 return false;
733         }
734
735         /**
736          * Set the access and modification times of a file.
737          *
738          * Note: If $file doesn't exist, it will be created.
739          *
740          * @since 2.5.0
741          * @abstract
742          * @param string $file  Path to file.
743          * @param int    $time  Optional. Modified time to set for file.
744          *                      Default 0.
745          * @param int    $atime Optional. Access time to set for file.
746          *                      Default 0.
747          * @return bool Whether operation was successful or not.
748          */
749         public function touch( $file, $time = 0, $atime = 0 ) {
750                 return false;
751         }
752
753         /**
754          * Create a directory.
755          *
756          * @since 2.5.0
757          * @abstract
758          * @param string $path  Path for new directory.
759          * @param mixed  $chmod Optional. The permissions as octal number, (or False to skip chmod)
760          *                      Default false.
761          * @param mixed  $chown Optional. A user name or number (or False to skip chown)
762          *                      Default false.
763          * @param mixed  $chgrp Optional. A group name or number (or False to skip chgrp).
764          *                      Default false.
765          * @return bool False if directory cannot be created, true otherwise.
766          */
767         public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
768                 return false;
769         }
770
771         /**
772          * Delete a directory.
773          *
774          * @since 2.5.0
775          * @abstract
776          * @param string $path      Path to directory.
777          * @param bool   $recursive Optional. Whether to recursively remove files/directories.
778          *                          Default false.
779          * @return bool Whether directory is deleted successfully or not.
780          */
781         public function rmdir( $path, $recursive = false ) {
782                 return false;
783         }
784
785         /**
786          * Get details for files in a directory or a specific file.
787          *
788          * @since 2.5.0
789          * @abstract
790          *
791          * @param string $path           Path to directory or file.
792          * @param bool   $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
793          *                               Default true.
794          * @param bool   $recursive      Optional. Whether to recursively include file details in nested directories.
795          *                               Default false.
796          * @return array|bool {
797          *     Array of files. False if unable to list directory contents.
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.
809          * }
810          */
811         public function dirlist( $path, $include_hidden = true, $recursive = false ) {
812                 return false;
813         }
814
815 } // WP_Filesystem_Base