wp/wp-admin/includes/class-wp-filesystem-base.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    13  */
    13  */
    14 class WP_Filesystem_Base {
    14 class WP_Filesystem_Base {
    15 	/**
    15 	/**
    16 	 * Whether to display debug data for the connection.
    16 	 * Whether to display debug data for the connection.
    17 	 *
    17 	 *
    18 	 * @access public
       
    19 	 * @since 2.5.0
    18 	 * @since 2.5.0
    20 	 * @var bool
    19 	 * @var bool
    21 	 */
    20 	 */
    22 	public $verbose = false;
    21 	public $verbose = false;
    23 
    22 
    30 	public $cache = array();
    29 	public $cache = array();
    31 
    30 
    32 	/**
    31 	/**
    33 	 * The Access method of the current connection, Set automatically.
    32 	 * The Access method of the current connection, Set automatically.
    34 	 *
    33 	 *
    35 	 * @access public
       
    36 	 * @since 2.5.0
    34 	 * @since 2.5.0
    37 	 * @var string
    35 	 * @var string
    38 	 */
    36 	 */
    39 	public $method = '';
    37 	public $method = '';
    40 
    38 
       
    39 	/**
       
    40 	 * @var WP_Error
       
    41 	 */
    41 	public $errors = null;
    42 	public $errors = null;
    42 
    43 
       
    44 	/**
       
    45 	 */
    43 	public $options = array();
    46 	public $options = array();
    44 
    47 
    45 	/**
    48 	/**
    46 	 * Return the path on the remote filesystem of ABSPATH.
    49 	 * Return the path on the remote filesystem of ABSPATH.
    47 	 *
    50 	 *
    48 	 * @access public
       
    49 	 * @since 2.7.0
    51 	 * @since 2.7.0
    50 	 *
    52 	 *
    51 	 * @return string The location of the remote path.
    53 	 * @return string The location of the remote path.
    52 	 */
    54 	 */
    53 	public function abspath() {
    55 	public function abspath() {
    59 	}
    61 	}
    60 
    62 
    61 	/**
    63 	/**
    62 	 * Return the path on the remote filesystem of WP_CONTENT_DIR.
    64 	 * Return the path on the remote filesystem of WP_CONTENT_DIR.
    63 	 *
    65 	 *
    64 	 * @access public
       
    65 	 * @since 2.7.0
    66 	 * @since 2.7.0
    66 	 *
    67 	 *
    67 	 * @return string The location of the remote path.
    68 	 * @return string The location of the remote path.
    68 	 */
    69 	 */
    69 	public function wp_content_dir() {
    70 	public function wp_content_dir() {
    71 	}
    72 	}
    72 
    73 
    73 	/**
    74 	/**
    74 	 * Return the path on the remote filesystem of WP_PLUGIN_DIR.
    75 	 * Return the path on the remote filesystem of WP_PLUGIN_DIR.
    75 	 *
    76 	 *
    76 	 * @access public
       
    77 	 * @since 2.7.0
    77 	 * @since 2.7.0
    78 	 *
    78 	 *
    79 	 * @return string The location of the remote path.
    79 	 * @return string The location of the remote path.
    80 	 */
    80 	 */
    81 	public function wp_plugins_dir() {
    81 	public function wp_plugins_dir() {
    83 	}
    83 	}
    84 
    84 
    85 	/**
    85 	/**
    86 	 * Return the path on the remote filesystem of the Themes Directory.
    86 	 * Return the path on the remote filesystem of the Themes Directory.
    87 	 *
    87 	 *
    88 	 * @access public
       
    89 	 * @since 2.7.0
    88 	 * @since 2.7.0
    90 	 *
    89 	 *
    91 	 * @param string $theme The Theme stylesheet or template for the directory.
    90 	 * @param string $theme The Theme stylesheet or template for the directory.
    92 	 * @return string The location of the remote path.
    91 	 * @return string The location of the remote path.
    93 	 */
    92 	 */
   102 	}
   101 	}
   103 
   102 
   104 	/**
   103 	/**
   105 	 * Return the path on the remote filesystem of WP_LANG_DIR.
   104 	 * Return the path on the remote filesystem of WP_LANG_DIR.
   106 	 *
   105 	 *
   107 	 * @access public
       
   108 	 * @since 3.2.0
   106 	 * @since 3.2.0
   109 	 *
   107 	 *
   110 	 * @return string The location of the remote path.
   108 	 * @return string The location of the remote path.
   111 	 */
   109 	 */
   112 	public function wp_lang_dir() {
   110 	public function wp_lang_dir() {
   114 	}
   112 	}
   115 
   113 
   116 	/**
   114 	/**
   117 	 * Locate a folder on the remote filesystem.
   115 	 * Locate a folder on the remote filesystem.
   118 	 *
   116 	 *
   119 	 * @access public
       
   120 	 * @since 2.5.0
   117 	 * @since 2.5.0
   121 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
   118 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
   122 	 * @see WP_Filesystem::abspath()
   119 	 * @see WP_Filesystem::abspath()
   123 	 * @see WP_Filesystem::wp_content_dir()
   120 	 * @see WP_Filesystem::wp_content_dir()
   124 	 * @see WP_Filesystem::wp_plugins_dir()
   121 	 * @see WP_Filesystem::wp_plugins_dir()
   129 	 * @param bool   $echo True to display debug information.
   126 	 * @param bool   $echo True to display debug information.
   130 	 *                     Default false.
   127 	 *                     Default false.
   131 	 * @return string The location of the remote path.
   128 	 * @return string The location of the remote path.
   132 	 */
   129 	 */
   133 	public function find_base_dir( $base = '.', $echo = false ) {
   130 	public function find_base_dir( $base = '.', $echo = false ) {
   134 		_deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   131 		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   135 		$this->verbose = $echo;
   132 		$this->verbose = $echo;
   136 		return $this->abspath();
   133 		return $this->abspath();
   137 	}
   134 	}
   138 
   135 
   139 	/**
   136 	/**
   140 	 * Locate a folder on the remote filesystem.
   137 	 * Locate a folder on the remote filesystem.
   141 	 *
   138 	 *
   142 	 * @access public
       
   143 	 * @since 2.5.0
   139 	 * @since 2.5.0
   144 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
   140 	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
   145 	 * @see WP_Filesystem::abspath()
   141 	 * @see WP_Filesystem::abspath()
   146 	 * @see WP_Filesystem::wp_content_dir()
   142 	 * @see WP_Filesystem::wp_content_dir()
   147 	 * @see WP_Filesystem::wp_plugins_dir()
   143 	 * @see WP_Filesystem::wp_plugins_dir()
   151 	 * @param string $base The folder to start searching from.
   147 	 * @param string $base The folder to start searching from.
   152 	 * @param bool   $echo True to display debug information.
   148 	 * @param bool   $echo True to display debug information.
   153 	 * @return string The location of the remote path.
   149 	 * @return string The location of the remote path.
   154 	 */
   150 	 */
   155 	public function get_base_dir( $base = '.', $echo = false ) {
   151 	public function get_base_dir( $base = '.', $echo = false ) {
   156 		_deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   152 		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
   157 		$this->verbose = $echo;
   153 		$this->verbose = $echo;
   158 		return $this->abspath();
   154 		return $this->abspath();
   159 	}
   155 	}
   160 
   156 
   161 	/**
   157 	/**
   162 	 * Locate a folder on the remote filesystem.
   158 	 * Locate a folder on the remote filesystem.
   163 	 *
   159 	 *
   164 	 * Assumes that on Windows systems, Stripping off the Drive
   160 	 * Assumes that on Windows systems, Stripping off the Drive
   165 	 * letter is OK Sanitizes \\ to / in windows filepaths.
   161 	 * letter is OK Sanitizes \\ to / in windows filepaths.
   166 	 *
   162 	 *
   167 	 * @access public
       
   168 	 * @since 2.7.0
   163 	 * @since 2.7.0
   169 	 *
   164 	 *
   170 	 * @param string $folder the folder to locate.
   165 	 * @param string $folder the folder to locate.
   171 	 * @return string|false The location of the remote path, false on failure.
   166 	 * @return string|false The location of the remote path, false on failure.
   172 	 */
   167 	 */
   173 	public function find_folder( $folder ) {
   168 	public function find_folder( $folder ) {
   174 
       
   175 		if ( isset( $this->cache[ $folder ] ) )
   169 		if ( isset( $this->cache[ $folder ] ) )
   176 			return $this->cache[ $folder ];
   170 			return $this->cache[ $folder ];
   177 
   171 
   178 		if ( stripos($this->method, 'ftp') !== false ) {
   172 		if ( stripos($this->method, 'ftp') !== false ) {
   179 			$constant_overrides = array(
   173 			$constant_overrides = array(
   242 		if ( empty( $base ) || '.' == $base )
   236 		if ( empty( $base ) || '.' == $base )
   243 			$base = trailingslashit($this->cwd());
   237 			$base = trailingslashit($this->cwd());
   244 
   238 
   245 		$folder = untrailingslashit($folder);
   239 		$folder = untrailingslashit($folder);
   246 
   240 
   247 		if ( $this->verbose )
   241 		if ( $this->verbose ) {
   248 			printf( "\n" . __('Looking for %1$s in %2$s') . "<br/>\n", $folder, $base );
   242 			/* translators: 1: folder to locate, 2: folder to start searching from */
       
   243 			printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "<br/>\n", $folder, $base );
       
   244 		}
   249 
   245 
   250 		$folder_parts = explode('/', $folder);
   246 		$folder_parts = explode('/', $folder);
   251 		$folder_part_keys = array_keys( $folder_parts );
   247 		$folder_part_keys = array_keys( $folder_parts );
   252 		$last_index = array_pop( $folder_part_keys );
   248 		$last_index = array_pop( $folder_part_keys );
   253 		$last_path = $folder_parts[ $last_index ];
   249 		$last_path = $folder_parts[ $last_index ];
   267 			 */
   263 			 */
   268 			if ( isset($files[ $key ]) ){
   264 			if ( isset($files[ $key ]) ){
   269 
   265 
   270 				// Let's try that folder:
   266 				// Let's try that folder:
   271 				$newdir = trailingslashit(path_join($base, $key));
   267 				$newdir = trailingslashit(path_join($base, $key));
   272 				if ( $this->verbose )
   268 				if ( $this->verbose ) {
   273 					printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
   269 					/* translators: %s: directory name */
       
   270 					printf( "\n" . __( 'Changing to %s' ) . "<br/>\n", $newdir );
       
   271 				}
   274 
   272 
   275 				// Only search for the remaining path tokens in the directory, not the full path again.
   273 				// Only search for the remaining path tokens in the directory, not the full path again.
   276 				$newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
   274 				$newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
   277 				if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
   275 				if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
   278 					return $ret;
   276 					return $ret;
   279 			}
   277 			}
   280 		}
   278 		}
   281 
   279 
   282 		// 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.
   280 		// Only check this as a last resort, to prevent locating the incorrect install.
       
   281 		// All above procedures will fail quickly if this is the right branch to take.
   283 		if (isset( $files[ $last_path ] ) ) {
   282 		if (isset( $files[ $last_path ] ) ) {
   284 			if ( $this->verbose )
   283 			if ( $this->verbose ) {
   285 				printf( "\n" . __('Found %s') . "<br/>\n",  $base . $last_path );
   284 				/* translators: %s: directory name */
       
   285 				printf( "\n" . __( 'Found %s' ) . "<br/>\n",  $base . $last_path );
       
   286 			}
   286 			return trailingslashit($base . $last_path);
   287 			return trailingslashit($base . $last_path);
   287 		}
   288 		}
   288 
   289 
   289 		// Prevent this function from looping again.
   290 		// Prevent this function from looping again.
   290 		// No need to proceed if we've just searched in /
   291 		// No need to proceed if we've just searched in /
   300 	/**
   301 	/**
   301 	 * Return the *nix-style file permissions for a file.
   302 	 * Return the *nix-style file permissions for a file.
   302 	 *
   303 	 *
   303 	 * From the PHP documentation page for fileperms().
   304 	 * From the PHP documentation page for fileperms().
   304 	 *
   305 	 *
   305 	 * @link http://docs.php.net/fileperms
   306 	 * @link https://secure.php.net/manual/en/function.fileperms.php
   306 	 *
   307 	 *
   307 	 * @access public
       
   308 	 * @since 2.5.0
   308 	 * @since 2.5.0
   309 	 *
   309 	 *
   310 	 * @param string $file String filename.
   310 	 * @param string $file String filename.
   311 	 * @return string The *nix-style representation of permissions.
   311 	 * @return string The *nix-style representation of permissions.
   312 	 */
   312 	 */
   313 	public function gethchmod( $file ){
   313 	public function gethchmod( $file ){
   314 		$perms = $this->getchmod($file);
   314 		$perms = intval( $this->getchmod( $file ), 8 );
   315 		if (($perms & 0xC000) == 0xC000) // Socket
   315 		if (($perms & 0xC000) == 0xC000) // Socket
   316 			$info = 's';
   316 			$info = 's';
   317 		elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
   317 		elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
   318 			$info = 'l';
   318 			$info = 'l';
   319 		elseif (($perms & 0x8000) == 0x8000) // Regular
   319 		elseif (($perms & 0x8000) == 0x8000) // Regular
   351 					(($perms & 0x0200) ? 'T' : '-'));
   351 					(($perms & 0x0200) ? 'T' : '-'));
   352 		return $info;
   352 		return $info;
   353 	}
   353 	}
   354 
   354 
   355 	/**
   355 	/**
       
   356 	 * Gets the permissions of the specified file or filepath in their octal format
       
   357 	 *
       
   358 	 * @since 2.5.0
       
   359 	 * @param string $file
       
   360 	 * @return string the last 3 characters of the octal number
       
   361 	 */
       
   362 	public function getchmod( $file ) {
       
   363 		return '777';
       
   364 	}
       
   365 
       
   366 	/**
   356 	 * Convert *nix-style file permissions to a octal number.
   367 	 * Convert *nix-style file permissions to a octal number.
   357 	 *
   368 	 *
   358 	 * Converts '-rw-r--r--' to 0644
   369 	 * Converts '-rw-r--r--' to 0644
   359 	 * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
   370 	 * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
   360  	 *
   371  	 *
   361 	 * @link http://docs.php.net/manual/en/function.chmod.php#49614
   372 	 * @link https://secure.php.net/manual/en/function.chmod.php#49614
   362 	 *
   373 	 *
   363 	 * @access public
       
   364 	 * @since 2.5.0
   374 	 * @since 2.5.0
   365 	 *
   375 	 *
   366 	 * @param string $mode string The *nix-style file permission.
   376 	 * @param string $mode string The *nix-style file permission.
   367 	 * @return int octal representation
   377 	 * @return int octal representation
   368 	 */
   378 	 */
   419 	/**
   429 	/**
   420 	 * Connect filesystem.
   430 	 * Connect filesystem.
   421 	 *
   431 	 *
   422 	 * @since 2.5.0
   432 	 * @since 2.5.0
   423 	 * @abstract
   433 	 * @abstract
       
   434 	 *
   424 	 * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
   435 	 * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
   425 	 */
   436 	 */
   426 	public function connect() {
   437 	public function connect() {
   427 		return true;
   438 		return true;
   428 	}
   439 	}
   430 	/**
   441 	/**
   431 	 * Read entire file into a string.
   442 	 * Read entire file into a string.
   432 	 *
   443 	 *
   433 	 * @since 2.5.0
   444 	 * @since 2.5.0
   434 	 * @abstract
   445 	 * @abstract
       
   446 	 *
   435 	 * @param string $file Name of the file to read.
   447 	 * @param string $file Name of the file to read.
   436 	 * @return mixed|bool Returns the read data or false on failure.
   448 	 * @return mixed|bool Returns the read data or false on failure.
   437 	 */
   449 	 */
   438 	public function get_contents( $file ) {
   450 	public function get_contents( $file ) {
   439 		return false;
   451 		return false;
   442 	/**
   454 	/**
   443 	 * Read entire file into an array.
   455 	 * Read entire file into an array.
   444 	 *
   456 	 *
   445 	 * @since 2.5.0
   457 	 * @since 2.5.0
   446 	 * @abstract
   458 	 * @abstract
       
   459 	 *
   447 	 * @param string $file Path to the file.
   460 	 * @param string $file Path to the file.
   448 	 * @return array|bool the file contents in an array or false on failure.
   461 	 * @return array|bool the file contents in an array or false on failure.
   449 	 */
   462 	 */
   450 	public function get_contents_array( $file ) {
   463 	public function get_contents_array( $file ) {
   451 		return false;
   464 		return false;
   454 	/**
   467 	/**
   455 	 * Write a string to a file.
   468 	 * Write a string to a file.
   456 	 *
   469 	 *
   457 	 * @since 2.5.0
   470 	 * @since 2.5.0
   458 	 * @abstract
   471 	 * @abstract
       
   472 	 *
   459 	 * @param string $file     Remote path to the file where to write the data.
   473 	 * @param string $file     Remote path to the file where to write the data.
   460 	 * @param string $contents The data to write.
   474 	 * @param string $contents The data to write.
   461 	 * @param int    $mode     Optional. The file permissions as octal number, usually 0644.
   475 	 * @param int    $mode     Optional. The file permissions as octal number, usually 0644.
   462 	 * @return bool False on failure.
   476 	 * @return bool False on failure.
   463 	 */
   477 	 */
   468 	/**
   482 	/**
   469 	 * Get the current working directory.
   483 	 * Get the current working directory.
   470 	 *
   484 	 *
   471 	 * @since 2.5.0
   485 	 * @since 2.5.0
   472 	 * @abstract
   486 	 * @abstract
       
   487 	 *
   473 	 * @return string|bool The current working directory on success, or false on failure.
   488 	 * @return string|bool The current working directory on success, or false on failure.
   474 	 */
   489 	 */
   475 	public function cwd() {
   490 	public function cwd() {
   476 		return false;
   491 		return false;
   477 	}
   492 	}
   479 	/**
   494 	/**
   480 	 * Change current directory.
   495 	 * Change current directory.
   481 	 *
   496 	 *
   482 	 * @since 2.5.0
   497 	 * @since 2.5.0
   483 	 * @abstract
   498 	 * @abstract
       
   499 	 *
   484 	 * @param string $dir The new current directory.
   500 	 * @param string $dir The new current directory.
   485 	 * @return bool Returns true on success or false on failure.
   501 	 * @return bool|string
   486 	 */
   502 	 */
   487 	public function chdir( $dir ) {
   503 	public function chdir( $dir ) {
   488 		return false;
   504 		return false;
   489 	}
   505 	}
   490 
   506 
   491 	/**
   507 	/**
   492 	 * Change the file group.
   508 	 * Change the file group.
   493 	 *
   509 	 *
   494 	 * @since 2.5.0
   510 	 * @since 2.5.0
   495 	 * @abstract
   511 	 * @abstract
       
   512 	 *
   496 	 * @param string $file      Path to the file.
   513 	 * @param string $file      Path to the file.
   497 	 * @param mixed  $group     A group name or number.
   514 	 * @param mixed  $group     A group name or number.
   498 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   515 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   499 	 * @return bool Returns true on success or false on failure.
   516 	 * @return bool|string
   500 	 */
   517 	 */
   501 	public function chgrp( $file, $group, $recursive = false ) {
   518 	public function chgrp( $file, $group, $recursive = false ) {
   502 		return false;
   519 		return false;
   503 	}
   520 	}
   504 
   521 
   505 	/**
   522 	/**
   506 	 * Change filesystem permissions.
   523 	 * Change filesystem permissions.
   507 	 *
   524 	 *
   508 	 * @since 2.5.0
   525 	 * @since 2.5.0
   509 	 * @abstract
   526 	 * @abstract
       
   527 	 *
   510 	 * @param string $file      Path to the file.
   528 	 * @param string $file      Path to the file.
   511 	 * @param int    $mode      Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
   529 	 * @param int    $mode      Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
   512 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   530 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   513 	 * @return bool Returns true on success or false on failure.
   531 	 * @return bool|string
   514 	 */
   532 	 */
   515 	public function chmod( $file, $mode = false, $recursive = false ) {
   533 	public function chmod( $file, $mode = false, $recursive = false ) {
   516 		return false;
   534 		return false;
   517 	}
   535 	}
   518 
   536 
   519 	/**
   537 	/**
   520 	 * Get the file owner.
   538 	 * Get the file owner.
   521 	 *
   539 	 *
   522 	 * @since 2.5.0
   540 	 * @since 2.5.0
   523 	 * @abstract
   541 	 * @abstract
       
   542 	 * 
   524 	 * @param string $file Path to the file.
   543 	 * @param string $file Path to the file.
   525 	 * @return string|bool Username of the user or false on error.
   544 	 * @return string|bool Username of the user or false on error.
   526 	 */
   545 	 */
   527 	public function owner( $file ) {
   546 	public function owner( $file ) {
   528 		return false;
   547 		return false;
   531 	/**
   550 	/**
   532 	 * Get the file's group.
   551 	 * Get the file's group.
   533 	 *
   552 	 *
   534 	 * @since 2.5.0
   553 	 * @since 2.5.0
   535 	 * @abstract
   554 	 * @abstract
       
   555 	 *
   536 	 * @param string $file Path to the file.
   556 	 * @param string $file Path to the file.
   537 	 * @return string|bool The group or false on error.
   557 	 * @return string|bool The group or false on error.
   538 	 */
   558 	 */
   539 	public function group( $file ) {
   559 	public function group( $file ) {
   540 		return false;
   560 		return false;
   543 	/**
   563 	/**
   544 	 * Copy a file.
   564 	 * Copy a file.
   545 	 *
   565 	 *
   546 	 * @since 2.5.0
   566 	 * @since 2.5.0
   547 	 * @abstract
   567 	 * @abstract
       
   568 	 *
   548 	 * @param string $source      Path to the source file.
   569 	 * @param string $source      Path to the source file.
   549 	 * @param string $destination Path to the destination file.
   570 	 * @param string $destination Path to the destination file.
   550 	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
   571 	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
   551 	 *                            Default false.
   572 	 *                            Default false.
   552 	 * @param int    $mode        Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
   573 	 * @param int    $mode        Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
   560 	/**
   581 	/**
   561 	 * Move a file.
   582 	 * Move a file.
   562 	 *
   583 	 *
   563 	 * @since 2.5.0
   584 	 * @since 2.5.0
   564 	 * @abstract
   585 	 * @abstract
       
   586 	 *
   565 	 * @param string $source      Path to the source file.
   587 	 * @param string $source      Path to the source file.
   566 	 * @param string $destination Path to the destination file.
   588 	 * @param string $destination Path to the destination file.
   567 	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
   589 	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
   568 	 *                            Default false.
   590 	 *                            Default false.
   569 	 * @return bool True if file copied successfully, False otherwise.
   591 	 * @return bool True if file copied successfully, False otherwise.
   575 	/**
   597 	/**
   576 	 * Delete a file or directory.
   598 	 * Delete a file or directory.
   577 	 *
   599 	 *
   578 	 * @since 2.5.0
   600 	 * @since 2.5.0
   579 	 * @abstract
   601 	 * @abstract
       
   602 	 *
   580 	 * @param string $file      Path to the file.
   603 	 * @param string $file      Path to the file.
   581 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   604 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
   582 	 *                          Default false.
   605 	 *                          Default false.
   583 	 * @param bool   $type      Type of resource. 'f' for file, 'd' for directory.
   606 	 * @param bool   $type      Type of resource. 'f' for file, 'd' for directory.
   584 	 *                          Default false.
   607 	 *                          Default false.
   591 	/**
   614 	/**
   592 	 * Check if a file or directory exists.
   615 	 * Check if a file or directory exists.
   593 	 *
   616 	 *
   594 	 * @since 2.5.0
   617 	 * @since 2.5.0
   595 	 * @abstract
   618 	 * @abstract
       
   619 	 *
   596 	 * @param string $file Path to file/directory.
   620 	 * @param string $file Path to file/directory.
   597 	 * @return bool Whether $file exists or not.
   621 	 * @return bool Whether $file exists or not.
   598 	 */
   622 	 */
   599 	public function exists( $file ) {
   623 	public function exists( $file ) {
   600 		return false;
   624 		return false;
   603 	/**
   627 	/**
   604 	 * Check if resource is a file.
   628 	 * Check if resource is a file.
   605 	 *
   629 	 *
   606 	 * @since 2.5.0
   630 	 * @since 2.5.0
   607 	 * @abstract
   631 	 * @abstract
       
   632 	 *
   608 	 * @param string $file File path.
   633 	 * @param string $file File path.
   609 	 * @return bool Whether $file is a file.
   634 	 * @return bool Whether $file is a file.
   610 	 */
   635 	 */
   611 	public function is_file( $file ) {
   636 	public function is_file( $file ) {
   612 		return false;
   637 		return false;
   615 	/**
   640 	/**
   616 	 * Check if resource is a directory.
   641 	 * Check if resource is a directory.
   617 	 *
   642 	 *
   618 	 * @since 2.5.0
   643 	 * @since 2.5.0
   619 	 * @abstract
   644 	 * @abstract
       
   645 	 *
   620 	 * @param string $path Directory path.
   646 	 * @param string $path Directory path.
   621 	 * @return bool Whether $path is a directory.
   647 	 * @return bool Whether $path is a directory.
   622 	 */
   648 	 */
   623 	public function is_dir( $path ) {
   649 	public function is_dir( $path ) {
   624 		return false;
   650 		return false;
   627 	/**
   653 	/**
   628 	 * Check if a file is readable.
   654 	 * Check if a file is readable.
   629 	 *
   655 	 *
   630 	 * @since 2.5.0
   656 	 * @since 2.5.0
   631 	 * @abstract
   657 	 * @abstract
       
   658 	 *
   632 	 * @param string $file Path to file.
   659 	 * @param string $file Path to file.
   633 	 * @return bool Whether $file is readable.
   660 	 * @return bool Whether $file is readable.
   634 	 */
   661 	 */
   635 	public function is_readable( $file ) {
   662 	public function is_readable( $file ) {
   636 		return false;
   663 		return false;
   639 	/**
   666 	/**
   640 	 * Check if a file or directory is writable.
   667 	 * Check if a file or directory is writable.
   641 	 *
   668 	 *
   642 	 * @since 2.5.0
   669 	 * @since 2.5.0
   643 	 * @abstract
   670 	 * @abstract
       
   671 	 *
       
   672 	 * @param string $file Path to file.
   644 	 * @return bool Whether $file is writable.
   673 	 * @return bool Whether $file is writable.
   645 	 */
   674 	 */
   646 	public function is_writable( $file ) {
   675 	public function is_writable( $file ) {
   647 		return false;
   676 		return false;
   648 	}
   677 	}
   650 	/**
   679 	/**
   651 	 * Gets the file's last access time.
   680 	 * Gets the file's last access time.
   652 	 *
   681 	 *
   653 	 * @since 2.5.0
   682 	 * @since 2.5.0
   654 	 * @abstract
   683 	 * @abstract
       
   684 	 *
   655 	 * @param string $file Path to file.
   685 	 * @param string $file Path to file.
   656 	 * @return int|bool Unix timestamp representing last access time.
   686 	 * @return int|bool Unix timestamp representing last access time.
   657 	 */
   687 	 */
   658 	public function atime( $file ) {
   688 	public function atime( $file ) {
   659 		return false;
   689 		return false;
   662 	/**
   692 	/**
   663 	 * Gets the file modification time.
   693 	 * Gets the file modification time.
   664 	 *
   694 	 *
   665 	 * @since 2.5.0
   695 	 * @since 2.5.0
   666 	 * @abstract
   696 	 * @abstract
       
   697 	 *
   667 	 * @param string $file Path to file.
   698 	 * @param string $file Path to file.
   668 	 * @return int|bool Unix timestamp representing modification time.
   699 	 * @return int|bool Unix timestamp representing modification time.
   669 	 */
   700 	 */
   670 	public function mtime( $file ) {
   701 	public function mtime( $file ) {
   671 		return false;
   702 		return false;
   674 	/**
   705 	/**
   675 	 * Gets the file size (in bytes).
   706 	 * Gets the file size (in bytes).
   676 	 *
   707 	 *
   677 	 * @since 2.5.0
   708 	 * @since 2.5.0
   678 	 * @abstract
   709 	 * @abstract
       
   710 	 *
   679 	 * @param string $file Path to file.
   711 	 * @param string $file Path to file.
   680 	 * @return int|bool Size of the file in bytes.
   712 	 * @return int|bool Size of the file in bytes.
   681 	 */
   713 	 */
   682 	public function size( $file ) {
   714 	public function size( $file ) {
   683 		return false;
   715 		return false;
   688 	 *
   720 	 *
   689 	 * Note: If $file doesn't exist, it will be created.
   721 	 * Note: If $file doesn't exist, it will be created.
   690 	 *
   722 	 *
   691 	 * @since 2.5.0
   723 	 * @since 2.5.0
   692 	 * @abstract
   724 	 * @abstract
       
   725 	 *
   693 	 * @param string $file  Path to file.
   726 	 * @param string $file  Path to file.
   694 	 * @param int    $time  Optional. Modified time to set for file.
   727 	 * @param int    $time  Optional. Modified time to set for file.
   695 	 *                      Default 0.
   728 	 *                      Default 0.
   696 	 * @param int    $atime Optional. Access time to set for file.
   729 	 * @param int    $atime Optional. Access time to set for file.
   697 	 *                      Default 0.
   730 	 *                      Default 0.
   704 	/**
   737 	/**
   705 	 * Create a directory.
   738 	 * Create a directory.
   706 	 *
   739 	 *
   707 	 * @since 2.5.0
   740 	 * @since 2.5.0
   708 	 * @abstract
   741 	 * @abstract
       
   742 	 *
   709 	 * @param string $path  Path for new directory.
   743 	 * @param string $path  Path for new directory.
   710 	 * @param mixed  $chmod Optional. The permissions as octal number, (or False to skip chmod)
   744 	 * @param mixed  $chmod Optional. The permissions as octal number, (or False to skip chmod)
   711 	 *                      Default false.
   745 	 *                      Default false.
   712 	 * @param mixed  $chown Optional. A user name or number (or False to skip chown)
   746 	 * @param mixed  $chown Optional. A user name or number (or False to skip chown)
   713 	 *                      Default false.
   747 	 *                      Default false.
   722 	/**
   756 	/**
   723 	 * Delete a directory.
   757 	 * Delete a directory.
   724 	 *
   758 	 *
   725 	 * @since 2.5.0
   759 	 * @since 2.5.0
   726 	 * @abstract
   760 	 * @abstract
       
   761 	 *
   727 	 * @param string $path      Path to directory.
   762 	 * @param string $path      Path to directory.
   728 	 * @param bool   $recursive Optional. Whether to recursively remove files/directories.
   763 	 * @param bool   $recursive Optional. Whether to recursively remove files/directories.
   729 	 *                          Default false.
   764 	 *                          Default false.
   730 	 * @return bool Whether directory is deleted successfully or not.
   765 	 * @return bool Whether directory is deleted successfully or not.
   731 	 */
   766 	 */