<!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>[25305] trunk/src/wp-admin/includes: WP_Filesystem: Let the code breathe, add some additional whitespace between method definitions and comments.</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/25305">25305</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2013-09-09 02:54:50 +0000 (Mon, 09 Sep 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>WP_Filesystem: Let the code breathe, add some additional whitespace between method definitions and comments.</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>
</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 (25304 => 25305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-base.php 2013-09-09 02:42:52 UTC (rev 25304)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-base.php 2013-09-09 02:54:50 UTC (rev 25305)
</span><span class="lines">@@ -20,6 +20,7 @@
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><span class="cx"> var $verbose = false;
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Cached list of local filepaths to mapped remote filepaths.
</span><span class="cx"> *
</span><span class="lines">@@ -47,11 +48,12 @@
</span><span class="cx"> */
</span><span class="cx"> function abspath() {
</span><span class="cx"> $folder = $this->find_folder(ABSPATH);
</span><del>- //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
</del><ins>+ // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
</ins><span class="cx"> if ( ! $folder && $this->is_dir('/wp-includes') )
</span><span class="cx"> $folder = '/';
</span><span class="cx"> return $folder;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Returns the path on the remote filesystem of WP_CONTENT_DIR
</span><span class="cx"> *
</span><span class="lines">@@ -62,6 +64,7 @@
</span><span class="cx"> function wp_content_dir() {
</span><span class="cx"> return $this->find_folder(WP_CONTENT_DIR);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Returns the path on the remote filesystem of WP_PLUGIN_DIR
</span><span class="cx"> *
</span><span class="lines">@@ -73,6 +76,7 @@
</span><span class="cx"> function wp_plugins_dir() {
</span><span class="cx"> return $this->find_folder(WP_PLUGIN_DIR);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Returns the path on the remote filesystem of the Themes Directory
</span><span class="cx"> *
</span><span class="lines">@@ -91,6 +95,7 @@
</span><span class="cx">
</span><span class="cx"> return $this->find_folder( $theme_root );
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Returns the path on the remote filesystem of WP_LANG_DIR
</span><span class="cx"> *
</span><span class="lines">@@ -121,6 +126,7 @@
</span><span class="cx"> $this->verbose = $echo;
</span><span class="cx"> return $this->abspath();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Locates a folder on the remote filesystem.
</span><span class="cx"> *
</span><span class="lines">@@ -188,17 +194,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> } elseif ( 'direct' == $this->method ) {
</span><del>- $folder = str_replace('\\', '/', $folder); //Windows path sanitisation
</del><ins>+ $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
</ins><span class="cx"> return trailingslashit($folder);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows drive letter if it's there.
- $folder = str_replace('\\', '/', $folder); //Windows path sanitisation
</del><ins>+ $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.
+ $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
</ins><span class="cx">
</span><span class="cx"> if ( isset($this->cache[ $folder ] ) )
</span><span class="cx"> return $this->cache[ $folder ];
</span><span class="cx">
</span><del>- if ( $this->exists($folder) ) { //Folder exists at that absolute path.
</del><ins>+ if ( $this->exists($folder) ) { // Folder exists at that absolute path.
</ins><span class="cx"> $folder = trailingslashit($folder);
</span><span class="cx"> $this->cache[ $folder ] = $folder;
</span><span class="cx"> return $folder;
</span><span class="lines">@@ -239,14 +245,14 @@
</span><span class="cx">
</span><span class="cx"> foreach ( $folder_parts as $index => $key ) {
</span><span class="cx"> if ( $index == $last_index )
</span><del>- continue; //We want this to be caught by the next code block.
</del><ins>+ continue; // We want this to be caught by the next code block.
</ins><span class="cx">
</span><del>- //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
</del><ins>+ // Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
</ins><span class="cx"> // If it's found, change into it and follow through looking for it.
</span><span class="cx"> // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
</span><span class="cx"> // If it reaches the end, and still cant find it, it'll return false for the entire function.
</span><span class="cx"> if ( isset($files[ $key ]) ){
</span><del>- //Lets try that folder:
</del><ins>+ // Lets try that folder:
</ins><span class="cx"> $newdir = trailingslashit(path_join($base, $key));
</span><span class="cx"> if ( $this->verbose )
</span><span class="cx"> printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
</span><span class="lines">@@ -257,7 +263,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- //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.
</del><ins>+ // 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.
</ins><span class="cx"> if (isset( $files[ $last_path ] ) ) {
</span><span class="cx"> if ( $this->verbose )
</span><span class="cx"> printf( "\n" . __('Found %s') . "<br/>\n", $base . $last_path );
</span><span class="lines">@@ -372,6 +378,6 @@
</span><span class="cx"> * @return bool true if string is binary, false otherwise
</span><span class="cx"> */
</span><span class="cx"> function is_binary( $text ) {
</span><del>- return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
</del><ins>+ return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
</ins><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemdirectphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-direct.php (25304 => 25305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-direct.php 2013-09-09 02:42:52 UTC (rev 25304)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-direct.php 2013-09-09 02:54:50 UTC (rev 25305)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> $this->method = 'direct';
</span><span class="cx"> $this->errors = new WP_Error();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * connect filesystem.
</span><span class="cx"> *
</span><span class="lines">@@ -33,6 +34,7 @@
</span><span class="cx"> function connect() {
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Reads entire file into a string
</span><span class="cx"> *
</span><span class="lines">@@ -42,6 +44,7 @@
</span><span class="cx"> function get_contents($file) {
</span><span class="cx"> return @file_get_contents($file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Reads entire file into an array
</span><span class="cx"> *
</span><span class="lines">@@ -51,6 +54,7 @@
</span><span class="cx"> function get_contents_array($file) {
</span><span class="cx"> return @file($file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Write a string to a file
</span><span class="cx"> *
</span><span class="lines">@@ -75,6 +79,7 @@
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Gets the current working directory
</span><span class="cx"> *
</span><span class="lines">@@ -83,6 +88,7 @@
</span><span class="cx"> function cwd() {
</span><span class="cx"> return @getcwd();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Change directory
</span><span class="cx"> *
</span><span class="lines">@@ -92,6 +98,7 @@
</span><span class="cx"> function chdir($dir) {
</span><span class="cx"> return @chdir($dir);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Changes file group
</span><span class="cx"> *
</span><span class="lines">@@ -107,7 +114,7 @@
</span><span class="cx"> return @chgrp($file, $group);
</span><span class="cx"> if ( ! $this->is_dir($file) )
</span><span class="cx"> return @chgrp($file, $group);
</span><del>- //Is a directory, and we want recursive
</del><ins>+ // Is a directory, and we want recursive
</ins><span class="cx"> $file = trailingslashit($file);
</span><span class="cx"> $filelist = $this->dirlist($file);
</span><span class="cx"> foreach ($filelist as $filename)
</span><span class="lines">@@ -115,6 +122,7 @@
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Changes filesystem permissions
</span><span class="cx"> *
</span><span class="lines">@@ -135,7 +143,7 @@
</span><span class="cx">
</span><span class="cx"> if ( ! $recursive || ! $this->is_dir($file) )
</span><span class="cx"> return @chmod($file, $mode);
</span><del>- //Is a directory, and we want recursive
</del><ins>+ // Is a directory, and we want recursive
</ins><span class="cx"> $file = trailingslashit($file);
</span><span class="cx"> $filelist = $this->dirlist($file);
</span><span class="cx"> foreach ( (array)$filelist as $filename => $filemeta)
</span><span class="lines">@@ -143,6 +151,7 @@
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Changes file owner
</span><span class="cx"> *
</span><span class="lines">@@ -158,13 +167,14 @@
</span><span class="cx"> return @chown($file, $owner);
</span><span class="cx"> if ( ! $this->is_dir($file) )
</span><span class="cx"> return @chown($file, $owner);
</span><del>- //Is a directory, and we want recursive
</del><ins>+ // Is a directory, and we want recursive
</ins><span class="cx"> $filelist = $this->dirlist($file);
</span><span class="cx"> foreach ($filelist as $filename) {
</span><span class="cx"> $this->chown($file . '/' . $filename, $owner, $recursive);
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Gets file owner
</span><span class="cx"> *
</span><span class="lines">@@ -180,6 +190,7 @@
</span><span class="cx"> $ownerarray = posix_getpwuid($owneruid);
</span><span class="cx"> return $ownerarray['name'];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx"> * Gets file permissions
</span><span class="cx"> *
</span><span class="lines">@@ -191,6 +202,7 @@
</span><span class="cx"> function getchmod($file) {
</span><span class="cx"> return substr(decoct(@fileperms($file)),3);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function group($file) {
</span><span class="cx"> $gid = @filegroup($file);
</span><span class="cx"> if ( ! $gid )
</span><span class="lines">@@ -228,27 +240,30 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function delete($file, $recursive = false, $type = false) {
</span><del>- if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
</del><ins>+ if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
</ins><span class="cx"> return false;
</span><del>- $file = str_replace('\\', '/', $file); //for win32, occasional problems deleting files otherwise
</del><ins>+ $file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
</ins><span class="cx">
</span><span class="cx"> if ( 'f' == $type || $this->is_file($file) )
</span><span class="cx"> return @unlink($file);
</span><span class="cx"> if ( ! $recursive && $this->is_dir($file) )
</span><span class="cx"> return @rmdir($file);
</span><span class="cx">
</span><del>- //At this point it's a folder, and we're in recursive mode
</del><ins>+ // At this point it's a folder, and we're in recursive mode
</ins><span class="cx"> $file = trailingslashit($file);
</span><span class="cx"> $filelist = $this->dirlist($file, true);
</span><span class="cx">
</span><span class="cx"> $retval = true;
</span><del>- if ( is_array($filelist) ) //false if no files, So check first.
- foreach ($filelist as $filename => $fileinfo)
</del><ins>+ if ( is_array( $filelist ) ) {
+ foreach ( $filelist as $filename => $fileinfo ) {
</ins><span class="cx"> if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
</span><span class="cx"> $retval = false;
</span><ins>+ }
+ }
</ins><span class="cx">
</span><span class="cx"> if ( file_exists($file) && ! @rmdir($file) )
</span><span class="cx"> $retval = false;
</span><ins>+
</ins><span class="cx"> return $retval;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -279,6 +294,7 @@
</span><span class="cx"> function mtime($file) {
</span><span class="cx"> return @filemtime($file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function size($file) {
</span><span class="cx"> return @filesize($file);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemftpextphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php (25304 => 25305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php 2013-09-09 02:42:52 UTC (rev 25304)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php 2013-09-09 02:54:50 UTC (rev 25305)
</span><span class="lines">@@ -23,14 +23,13 @@
</span><span class="cx"> $this->method = 'ftpext';
</span><span class="cx"> $this->errors = new WP_Error();
</span><span class="cx">
</span><del>- //Check if possible to use ftp functions.
</del><ins>+ // Check if possible to use ftp functions.
</ins><span class="cx"> if ( ! extension_loaded('ftp') ) {
</span><span class="cx"> $this->errors->add('no_ftp_ext', __('The ftp PHP extension is not available'));
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Set defaults:
- //This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
</del><ins>+ // This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
</ins><span class="cx">
</span><span class="cx"> if ( ! defined('FS_TIMEOUT') )
</span><span class="cx"> define('FS_TIMEOUT', 240);
</span><span class="lines">@@ -80,7 +79,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- //Set the Connection to use Passive FTP
</del><ins>+ // Set the Connection to use Passive FTP
</ins><span class="cx"> @ftp_pasv( $this->link, true );
</span><span class="cx"> if ( @ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT )
</span><span class="cx"> @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT);
</span><span class="lines">@@ -98,7 +97,7 @@
</span><span class="cx"> if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- fseek($temp, 0); //Skip back to the start of the file being written to
</del><ins>+ fseek( $temp, 0 ); // Skip back to the start of the file being written to
</ins><span class="cx"> $contents = '';
</span><span class="cx">
</span><span class="cx"> while ( ! feof($temp) )
</span><span class="lines">@@ -108,6 +107,7 @@
</span><span class="cx"> unlink($tempfile);
</span><span class="cx"> return $contents;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function get_contents_array($file) {
</span><span class="cx"> return explode("\n", $this->get_contents($file));
</span><span class="cx"> }
</span><span class="lines">@@ -136,18 +136,22 @@
</span><span class="cx">
</span><span class="cx"> return $ret;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function cwd() {
</span><span class="cx"> $cwd = @ftp_pwd($this->link);
</span><span class="cx"> if ( $cwd )
</span><span class="cx"> $cwd = trailingslashit($cwd);
</span><span class="cx"> return $cwd;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function chdir($dir) {
</span><span class="cx"> return @ftp_chdir($this->link, $dir);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function chgrp($file, $group, $recursive = false ) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function chmod($file, $mode = false, $recursive = false) {
</span><span class="cx"> if ( ! $mode ) {
</span><span class="cx"> if ( $this->is_file($file) )
</span><span class="lines">@@ -170,21 +174,26 @@
</span><span class="cx"> return (bool)@ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
</span><span class="cx"> return (bool)@ftp_chmod($this->link, $mode, $file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function chown($file, $owner, $recursive = false ) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function owner($file) {
</span><span class="cx"> $dir = $this->dirlist($file);
</span><span class="cx"> return $dir[$file]['owner'];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function getchmod($file) {
</span><span class="cx"> $dir = $this->dirlist($file);
</span><span class="cx"> return $dir[$file]['permsn'];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function group($file) {
</span><span class="cx"> $dir = $this->dirlist($file);
</span><span class="cx"> return $dir[$file]['group'];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function copy($source, $destination, $overwrite = false, $mode = false) {
</span><span class="cx"> if ( ! $overwrite && $this->exists($destination) )
</span><span class="cx"> return false;
</span><span class="lines">@@ -193,6 +202,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> return $this->put_contents($destination, $content, $mode);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function move($source, $destination, $overwrite = false) {
</span><span class="cx"> return ftp_rename($this->link, $source, $destination);
</span><span class="cx"> }
</span><span class="lines">@@ -216,9 +226,11 @@
</span><span class="cx"> $list = @ftp_nlist($this->link, $file);
</span><span class="cx"> return !empty($list); //empty list = no file, so invert.
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function is_file($file) {
</span><span class="cx"> return $this->exists($file) && !$this->is_dir($file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function is_dir($path) {
</span><span class="cx"> $cwd = $this->cwd();
</span><span class="cx"> $result = @ftp_chdir($this->link, trailingslashit($path) );
</span><span class="lines">@@ -228,26 +240,31 @@
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function is_readable($file) {
</span><del>- //Get dir list, Check if the file is readable by the current user??
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function is_writable($file) {
</span><del>- //Get dir list, Check if the file is writable by the current user??
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function atime($file) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function mtime($file) {
</span><span class="cx"> return ftp_mdtm($this->link, $file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function size($file) {
</span><span class="cx"> return ftp_size($this->link, $file);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function touch($file, $time = 0, $atime = 0) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
</span><span class="cx"> $path = untrailingslashit($path);
</span><span class="cx"> if ( empty($path) )
</span><span class="lines">@@ -262,6 +279,7 @@
</span><span class="cx"> $this->chgrp($path, $chgrp);
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function rmdir($path, $recursive = false) {
</span><span class="cx"> return $this->delete($path, $recursive);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpfilesystemftpsocketsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php (25304 => 25305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php 2013-09-09 02:42:52 UTC (rev 25304)
+++ trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php 2013-09-09 02:54:50 UTC (rev 25305)
</span><span class="lines">@@ -23,12 +23,11 @@
</span><span class="cx"> $this->method = 'ftpsockets';
</span><span class="cx"> $this->errors = new WP_Error();
</span><span class="cx">
</span><del>- //Check if possible to use ftp functions.
</del><ins>+ // Check if possible to use ftp functions.
</ins><span class="cx"> if ( ! @include_once ABSPATH . 'wp-admin/includes/class-ftp.php' )
</span><span class="cx"> return false;
</span><span class="cx"> $this->ftp = new ftp();
</span><span class="cx">
</span><del>- //Set defaults:
</del><span class="cx"> if ( empty($opt['port']) )
</span><span class="cx"> $this->options['port'] = 21;
</span><span class="cx"> else
</span><span class="lines">@@ -93,10 +92,10 @@
</span><span class="cx"> if ( ! $this->ftp->fget($temphandle, $file) ) {
</span><span class="cx"> fclose($temphandle);
</span><span class="cx"> unlink($temp);
</span><del>- return ''; //Blank document, File does exist, It's just blank.
</del><ins>+ return ''; // Blank document, File does exist, It's just blank.
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- fseek($temphandle, 0); //Skip back to the start of the file being written to
</del><ins>+ fseek( $temphandle, 0 ); // Skip back to the start of the file being written to
</ins><span class="cx"> $contents = '';
</span><span class="cx">
</span><span class="cx"> while ( ! feof($temphandle) )
</span><span class="lines">@@ -242,12 +241,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function is_readable($file) {
</span><del>- //Get dir list, Check if the file is writable by the current user??
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function is_writable($file) {
</span><del>- //Get dir list, Check if the file is writable by the current user??
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>