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