<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25560] trunk/src/wp-admin/includes: First pass at documenting the WP_Filesystem methods.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25560">25560</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2013-09-22 04:43:29 +0000 (Sun, 22 Sep 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>First pass at documenting the WP_Filesystem methods. This also introduces stubs of the methods into the base class which are documented, which subclasses can override, some methods were cleaned up at the same time.
See <a href="http://core.trac.wordpress.org/ticket/18476">#18476</a> See <a href="http://core.trac.wordpress.org/ticket/23122">#23122</a>. Props kurtpayne, bananastalktome, and, DrewAPicture </pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpfilesystembasephp">trunk/src/wp-admin/includes/class-wp-filesystem-base.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpfilesystemdirectphp">trunk/src/wp-admin/includes/class-wp-filesystem-direct.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpfilesystemftpextphp">trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpfilesystemftpsocketsphp">trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpfilesystemssh2php">trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpfilesystembasephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-base.php (25559 => 25560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-base.php 2013-09-22 04:25:14 UTC (rev 25559)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-base.php 2013-09-22 04:43:29 UTC (rev 25560)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx"> /**
</span><del>- * Base WordPress Filesystem.
</del><ins>+ * Base WordPress Filesystem
</ins><span class="cx"> *
</span><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Filesystem
</span><span class="lines">@@ -9,14 +9,14 @@
</span><span class="cx"> /**
</span><span class="cx"> * Base WordPress Filesystem class for which Filesystem implementations extend
</span><span class="cx"> *
</span><del>- * @since 2.5
</del><ins>+ * @since 2.5.0
</ins><span class="cx"> */
</span><span class="cx"> class WP_Filesystem_Base {
</span><span class="cx"> /**
</span><span class="cx"> * Whether to display debug data for the connection.
</span><span class="cx"> *
</span><del>- * @since 2.5
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
</ins><span class="cx"> * @var bool
</span><span class="cx"> */
</span><span class="cx"> var $verbose = false;
</span><span class="lines">@@ -24,8 +24,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Cached list of local filepaths to mapped remote filepaths.
</span><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access private
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> * @var array
</span><span class="cx"> */
</span><span class="cx"> var $cache = array();
</span><span class="lines">@@ -33,17 +33,23 @@
</span><span class="cx"> /**
</span><span class="cx"> * The Access method of the current connection, Set automatically.
</span><span class="cx"> *
</span><del>- * @since 2.5
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
</ins><span class="cx"> * @var string
</span><span class="cx"> */
</span><span class="cx"> var $method = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the path on the remote filesystem of ABSPATH
</del><ins>+ * Constructor (empty).
+ */
+ function __construct() {}
+
+ /**
+ * Return the path on the remote filesystem of ABSPATH.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.7.0
+ *
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><span class="cx"> function abspath() {
</span><span class="lines">@@ -55,10 +61,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the path on the remote filesystem of WP_CONTENT_DIR
</del><ins>+ * Return the path on the remote filesystem of WP_CONTENT_DIR.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.7.0
+ *
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><span class="cx"> function wp_content_dir() {
</span><span class="lines">@@ -66,10 +73,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the path on the remote filesystem of WP_PLUGIN_DIR
</del><ins>+ * Return the path on the remote filesystem of WP_PLUGIN_DIR.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><span class="lines">@@ -78,12 +85,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the path on the remote filesystem of the Themes Directory
</del><ins>+ * Return the path on the remote filesystem of the Themes Directory.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><del>- * @param string $theme The Theme stylesheet or template for the directory
</del><ins>+ * @param string $theme The Theme stylesheet or template for the directory.
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><span class="cx"> function wp_themes_dir( $theme = false ) {
</span><span class="lines">@@ -97,10 +104,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the path on the remote filesystem of WP_LANG_DIR
</del><ins>+ * Return the path on the remote filesystem of WP_LANG_DIR.
</ins><span class="cx"> *
</span><ins>+ * @access public
</ins><span class="cx"> * @since 3.2.0
</span><del>- * @access public
</del><span class="cx"> *
</span><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><span class="lines">@@ -109,56 +116,63 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Locates a folder on the remote filesystem.
</del><ins>+ * Locate a folder on the remote filesystem.
</ins><span class="cx"> *
</span><del>- * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
- *
- * @since 2.5
- * @deprecated 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
+ * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
+ * @see WP_Filesystem::abspath()
+ * @see WP_Filesystem::wp_content_dir()
+ * @see WP_Filesystem::wp_plugins_dir()
+ * @see WP_Filesystem::wp_themes_dir()
+ * @see WP_Filesystem::wp_lang_dir()
</ins><span class="cx"> *
</span><del>- * @param string $base The folder to start searching from
- * @param bool $echo True to display debug information
</del><ins>+ * @param string $base The folder to start searching from.
+ * @param bool $echo True to display debug information.
+ * Default false.
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><del>- function find_base_dir($base = '.', $echo = false) {
</del><ins>+ function find_base_dir( $base = '.', $echo = false ) {
</ins><span class="cx"> _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
</span><span class="cx"> $this->verbose = $echo;
</span><span class="cx"> return $this->abspath();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Locates a folder on the remote filesystem.
</del><ins>+ * Locate a folder on the remote filesystem.
</ins><span class="cx"> *
</span><del>- * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
- *
- * @since 2.5
- * @deprecated 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
+ * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
+ * @see WP_Filesystem::abspath()
+ * @see WP_Filesystem::wp_content_dir()
+ * @see WP_Filesystem::wp_plugins_dir()
+ * @see WP_Filesystem::wp_themes_dir()
+ * @see WP_Filesystem::wp_lang_dir()
</ins><span class="cx"> *
</span><del>- * @param string $base The folder to start searching from
- * @param bool $echo True to display debug information
</del><ins>+ * @param string $base The folder to start searching from.
+ * @param bool $echo True to display debug information.
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><del>- function get_base_dir($base = '.', $echo = false) {
</del><ins>+ function get_base_dir( $base = '.', $echo = false ) {
</ins><span class="cx"> _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
</span><span class="cx"> $this->verbose = $echo;
</span><span class="cx"> return $this->abspath();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Locates a folder on the remote filesystem.
</del><ins>+ * Locate a folder on the remote filesystem.
</ins><span class="cx"> *
</span><del>- * Assumes that on Windows systems, Stripping off the Drive letter is OK
- * Sanitizes \\ to / in windows filepaths.
</del><ins>+ * Assumes that on Windows systems, Stripping off the Drive
+ * letter is OK Sanitizes \\ to / in windows filepaths.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access public
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><del>- * @param string $folder the folder to locate
</del><ins>+ * @param string $folder the folder to locate.
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><del>- function find_folder($folder) {
</del><ins>+ function find_folder( $folder ) {
</ins><span class="cx">
</span><span class="cx"> if ( isset( $this->cache[ $folder ] ) )
</span><span class="cx"> return $this->cache[ $folder ];
</span><span class="lines">@@ -215,19 +229,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Locates a folder on the remote filesystem.
</del><ins>+ * Locate a folder on the remote filesystem.
</ins><span class="cx"> *
</span><del>- * Expects Windows sanitized path
</del><ins>+ * Expects Windows sanitized path.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access private
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><del>- * @param string $folder the folder to locate
- * @param string $base the folder to start searching from
- * @param bool $loop if the function has recursed, Internal use only
</del><ins>+ * @param string $folder The folder to locate.
+ * @param string $base The folder to start searching from.
+ * @param bool $loop If the function has recursed, Internal use only.
</ins><span class="cx"> * @return string The location of the remote path.
</span><span class="cx"> */
</span><del>- function search_for_folder($folder, $base = '.', $loop = false ) {
</del><ins>+ function search_for_folder( $folder, $base = '.', $loop = false ) {
</ins><span class="cx"> if ( empty( $base ) || '.' == $base )
</span><span class="cx"> $base = trailingslashit($this->cwd());
</span><span class="cx">
</span><span class="lines">@@ -282,18 +296,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the *nix style file permissions for a file
</del><ins>+ * Return the *nix-style file permissions for a file.
</ins><span class="cx"> *
</span><del>- * From the PHP documentation page for fileperms()
</del><ins>+ * From the PHP documentation page for fileperms().
</ins><span class="cx"> *
</span><span class="cx"> * @link http://docs.php.net/fileperms
</span><del>- * @since 2.5
</del><ins>+ *
</ins><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
</ins><span class="cx"> *
</span><del>- * @param string $file string filename
- * @return string *nix style representation of permissions
</del><ins>+ * @param string $file String filename.
+ * @return string The *nix-style representation of permissions.
</ins><span class="cx"> */
</span><del>- function gethchmod($file){
</del><ins>+ function gethchmod( $file ){
</ins><span class="cx"> $perms = $this->getchmod($file);
</span><span class="cx"> if (($perms & 0xC000) == 0xC000) // Socket
</span><span class="cx"> $info = 's';
</span><span class="lines">@@ -336,19 +351,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Converts *nix style file permissions to a octal number.
</del><ins>+ * Convert *nix-style file permissions to a octal number.
</ins><span class="cx"> *
</span><span class="cx"> * Converts '-rw-r--r--' to 0644
</span><span class="cx"> * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
</span><span class="cx"> *
</span><span class="cx"> * @link http://docs.php.net/manual/en/function.chmod.php#49614
</span><del>- * @since 2.5
</del><ins>+ *
</ins><span class="cx"> * @access public
</span><ins>+ * @since 2.5.0
</ins><span class="cx"> *
</span><del>- * @param string $mode string *nix style file permission
</del><ins>+ * @param string $mode string The *nix-style file permission.
</ins><span class="cx"> * @return int octal representation
</span><span class="cx"> */
</span><del>- function getnumchmodfromh($mode) {
</del><ins>+ function getnumchmodfromh( $mode ) {
</ins><span class="cx"> $realmode = '';
</span><span class="cx"> $legal = array('', 'w', 'r', 'x', '-');
</span><span class="cx"> $attarray = preg_split('//', $mode);
</span><span class="lines">@@ -369,15 +385,379 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Determines if the string provided contains binary characters.
</del><ins>+ * Determine if the string provided contains binary characters.
</ins><span class="cx"> *
</span><del>- * @since 2.7
</del><span class="cx"> * @access private
</span><ins>+ * @since 2.7.0
</ins><span class="cx"> *
</span><del>- * @param string $text String to test against
- * @return bool true if string is binary, false otherwise
</del><ins>+ * @param string $text String to test against.
+ * @return bool true if string is binary, false otherwise.
</ins><span class="cx"> */
</span><span class="cx"> function is_binary( $text ) {
</span><span class="cx"> return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
</span><span class="cx"> }
</span><del>-}
</del><ins>+
+ /**
+ * Change the ownership of a file / folder.
+ *
+ * Default behavior is to do nothing, override this in your subclass, if desired.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @param mixed $owner A user name or number.
+ * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False.
+ * @return bool Returns true on success or false on failure.
+ */
+ function chown( $file, $owner, $recursive = false ) {
+ return false;
+ }
+
+ /**
+ * Connect filesystem.
+ *
+ * @since 2.5.0
+ *
+ * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
+ */
+ function connect() {
+ return true;
+ }
+
+ /**
+ * Read entire file into a string.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Name of the file to read.
+ * @return string|bool Returns the read data or false on failure.
+ */
+ function get_contents( $file ) {
+ return false;
+ }
+
+ /**
+ * Read entire file into an array.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @return array|bool the file contents in an array or false on failure.
+ */
+ function get_contents_array( $file ) {
+ return false;
+ }
+
+ /**
+ * Write a string to a file.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Remote path to the file where to write the data.
+ * @param string $contents The data to write.
+ * @param int $mode Optional. The file permissions as octal number, usually 0644.
+ * @return bool False on failure.
+ */
+ function put_contents( $file, $contents, $mode = false ) {
+ return false;
+ }
+
+ /**
+ * Get the current working directory.
+ *
+ * @since 2.5.0
+ *
+ * @return string|bool The current working directory on success, or false on failure.
+ */
+ function cwd() {
+ return false;
+ }
+
+ /**
+ * Change current directory.
+ *
+ * @since 2.5.0
+ *
+ * @param string $dir The new current directory.
+ * @return bool Returns true on success or false on failure.
+ */
+ function chdir( $dir ) {
+ return false;
+ }
+
+ /**
+ * Change the file group.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @param mixed $group A group name or number.
+ * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
+ * @return bool Returns true on success or false on failure.
+ */
+ function chgrp( $file, $group, $recursive = false ) {
+ return false;
+ }
+
+ /**
+ * Change filesystem permissions.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
+ * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
+ * @return bool Returns true on success or false on failure.
+ */
+ function chmod( $file, $mode = false, $recursive = false ) {
+ return false;
+ }
+
+ /**
+ * Get the file owner.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @return string|bool Username of the user or false on error.
+ */
+ function owner( $file ) {
+ return false;
+ }
+
+ /**
+ * Get the file's group.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @return string|bool The group or false on error.
+ */
+ function group( $file ) {
+ return false;
+ }
+
+ /**
+ * Copy a file.
+ *
+ * @since 2.5.0
+ *
+ * @param string $source Path to the source file.
+ * @param string $destination Path to the destination file.
+ * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
+ * Default false.
+ * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
+ * Default false.
+ * @return bool True if file copied successfully, False otherwise.
+ */
+ function copy( $source, $destination, $overwrite = false, $mode = false ) {
+ return false;
+ }
+
+ /**
+ * Move a file.
+ *
+ * @since 2.5.0
+ *
+ * @param string $source Path to the source file.
+ * @param string $destination Path to the destination file.
+ * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
+ * Default false.
+ * @return bool True if file copied successfully, False otherwise.
+ */
+ function move( $source, $destination, $overwrite = false ) {
+ return false;
+ }
+
+ /**
+ * Delete a file or directory.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to the file.
+ * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
+ * Default false.
+ * @param bool $type Type of resource. 'f' for file, 'd' for directory.
+ * Default false.
+ * @return bool True if the file or directory was deleted, false on failure.
+ */
+ function delete( $file, $recursive = false, $type = false ) {
+ return false;
+ }
+
+ /**
+ * Check if a file or directory exists.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file/directory.
+ * @return bool Whether $file exists or not.
+ */
+ function exists( $file ) {
+ return false;
+ }
+
+ /**
+ * Check if resource is a file.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file File path.
+ * @return bool Whether $file is a file.
+ */
+ function is_file( $file ) {
+ return false;
+ }
+
+ /**
+ * Check if resource is a directory.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path Directory path.
+ * @return bool Whether $path is a directory.
+ */
+ function is_dir( $path ) {
+ return false;
+ }
+
+ /**
+ * Check if a file is readable.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file.
+ * @return bool Whether $file is readable.
+ */
+ function is_readable( $file ) {
+ return false;
+ }
+
+ /**
+ * Check if a file or directory is writable.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path Path to file/directory.
+ * @return bool Whether $file is writable.
+ */
+ function is_writable( $file ) {
+ return false;
+ }
+
+ /**
+ * Gets the file's last access time.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file.
+ * @return int Unix timestamp representing last access time.
+ */
+ function atime( $file ) {
+ return false;
+ }
+
+ /**
+ * Gets the file modification time.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file.
+ * @return int Unix timestamp representing modification time.
+ */
+ function mtime( $file ) {
+ return false;
+ }
+
+ /**
+ * Gets the file size (in bytes).
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file.
+ * @return int Size of the file in bytes.
+ */
+ function size( $file ) {
+ return false;
+ }
+
+ /**
+ * Set the access and modification times of a file.
+ *
+ * Note: If $file doesn't exist, it will be created.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Path to file.
+ * @param int $time Optional. Modified time to set for file.
+ * Default 0.
+ * @param int $atime Optional. Access time to set for file.
+ * Default 0.
+ * @return bool Whether operation was successful or not.
+ */
+ function touch( $file, $time = 0, $atime = 0 ) {
+ return false;
+ }
+
+ /**
+ * Create a directory.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path Path for new directory.
+ * @param mixed $chmod Optional. The permissions as octal number, (or False to skip chmod)
+ * Default false.
+ * @param mixed $chown Optional. A user name or number (or False to skip chown)
+ * Default false.
+ * @param mixed $chgrp Optional. A group name or number (or False to skip chgrp).
+ * Default false.
+ * @return bool False if directory cannot be created, true otherwise.
+ */
+ function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
+ return false;
+ }
+
+ /**
+ * Delete a directory.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path Path to directory.
+ * @param bool $recursive Optional. Whether to recursively remove files/directories.
+ * Default false.
+ * @return bool Whether directory is deleted successfully or not.
+ */
+ function rmdir( $path, $recursive = false ) {
+ return false;
+ }
+
+ /**
+ * Get details for files in a directory or a specific file.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path Path to directory or file.
+ * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
+ * Default true.
+ * @param bool $recursive Optional. Whether to recursively include file details in nested directories.
+ * Default false.
+ * @return array|bool {
+ * Array of files. False if unable to list directory contents.
+ *
+ * @type string 'name' Name of the file/directory.
+ * @type string 'perms' *nix representation of permissions.
+ * @type int 'permsn' Octal representation of permissions.
+ * @type string 'owner' Owner name or ID.
+ * @type int 'size' Size of file in bytes.
+ * @type int 'lastmodunix' Last modified unix timestamp.
+ * @type mixed 'lastmod' Last modified month (3 letter) and day (without leading 0).
+ * @type int 'time' Last modified time.
+ * @type string 'type' Type of resource. 'f' for file, 'd' for directory.
+ * @type mixed 'files' If a directory and $recursive is true, contains another array of files.
+ * }
+ */
+ function dirlist( $path, $include_hidden = true, $recursive = false ) {
+ return false;
+ }
+
+} // WP_Filesystem_Base
</ins></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemdirectphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-direct.php (25559 => 25560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-direct.php 2013-09-22 04:25:14 UTC (rev 25559)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-direct.php 2013-09-22 04:43:29 UTC (rev 25560)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> * @uses WP_Filesystem_Base Extends class
</span><span class="cx"> */
</span><span class="cx"> class WP_Filesystem_Direct extends WP_Filesystem_Base {
</span><del>- var $errors = null;
</del><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * constructor
</span><span class="cx"> *
</span><span class="lines">@@ -27,15 +27,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * connect filesystem.
- *
- * @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct).
- */
- function connect() {
- return true;
- }
-
- /**
</del><span class="cx"> * Reads entire file into a string
</span><span class="cx"> *
</span><span class="cx"> * @param string $file Name of the file to read.
</span><span class="lines">@@ -185,7 +176,7 @@
</span><span class="cx"> * Gets file owner
</span><span class="cx"> *
</span><span class="cx"> * @param string $file Path to the file.
</span><del>- * @return string Username of the user.
</del><ins>+ * @return string|bool Username of the user or false on error.
</ins><span class="cx"> */
</span><span class="cx"> function owner($file) {
</span><span class="cx"> $owneruid = @fileowner($file);
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemftpextphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php (25559 => 25560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php 2013-09-22 04:25:14 UTC (rev 25559)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php 2013-09-22 04:43:29 UTC (rev 25560)
</span><span class="lines">@@ -181,10 +181,6 @@
</span><span class="cx"> return (bool)@ftp_chmod($this->link, $mode, $file);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function chown($file, $owner, $recursive = false ) {
- return false;
- }
-
</del><span class="cx"> function owner($file) {
</span><span class="cx"> $dir = $this->dirlist($file);
</span><span class="cx"> return $dir[$file]['owner'];
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemftpsocketsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php (25559 => 25560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php 2013-09-22 04:25:14 UTC (rev 25559)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php 2013-09-22 04:43:29 UTC (rev 25560)
</span><span class="lines">@@ -187,10 +187,6 @@
</span><span class="cx"> return $this->ftp->chmod($file, $mode);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function chown($file, $owner, $recursive = false ) {
- return false;
- }
-
</del><span class="cx"> function owner($file) {
</span><span class="cx"> $dir = $this->dirlist($file);
</span><span class="cx"> return $dir[$file]['owner'];
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemssh2php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php (25559 => 25560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php 2013-09-22 04:25:14 UTC (rev 25559)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php 2013-09-22 04:43:29 UTC (rev 25560)
</span><span class="lines">@@ -1,14 +1,7 @@
</span><span class="cx"> <?php
</span><span class="cx"> /**
</span><del>- * WordPress SSH2 Filesystem.
</del><ins>+ * WordPress Filesystem Class for implementing SSH2
</ins><span class="cx"> *
</span><del>- * @package WordPress
- * @subpackage Filesystem
- */
-
-/**
- * WordPress Filesystem Class for implementing SSH2.
- *
</del><span class="cx"> * To use this class you must follow these steps for PHP 5.2.6+
</span><span class="cx"> *
</span><span class="cx"> * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
</span><span class="lines">@@ -35,10 +28,10 @@
</span><span class="cx"> *
</span><span class="cx"> * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
</span><span class="cx"> *
</span><del>- * @since 2.7
</del><ins>+ * @since 2.7.0
+ *
</ins><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Filesystem
</span><del>- * @uses WP_Filesystem_Base Extends class
</del><span class="cx"> */
</span><span class="cx"> class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
</span><span class="cx">
</span><span class="lines">@@ -208,7 +201,17 @@
</span><span class="cx"> return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function chown($file, $owner, $recursive = false ) {
</del><ins>+ /**
+ * Change the ownership of a file / folder.
+ *
+ * @since Unknown
+ *
+ * @param string $file Path to the file.
+ * @param mixed $owner A user name or number.
+ * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False.
+ * @return bool Returns true on success or false on failure.
+ */
+ function chown( $file, $owner, $recursive = false ) {
</ins><span class="cx"> if ( ! $this->exists($file) )
</span><span class="cx"> return false;
</span><span class="cx"> if ( ! $recursive || ! $this->is_dir($file) )
</span></span></pre>
</div>
</div>
</body>
</html>