Add access modifier (`public`) to methods in `WP_Filesystem_Direct`.
See #27881, #22234. Built from https://develop.svn.wordpress.org/trunk@28488 git-svn-id: http://core.svn.wordpress.org/trunk@28314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7a378bc48f
commit
eb750d0bd1
|
@ -21,7 +21,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
*
|
*
|
||||||
* @param mixed $arg ignored argument
|
* @param mixed $arg ignored argument
|
||||||
*/
|
*/
|
||||||
function __construct($arg) {
|
public function __construct($arg) {
|
||||||
$this->method = 'direct';
|
$this->method = 'direct';
|
||||||
$this->errors = new WP_Error();
|
$this->errors = new WP_Error();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param string $file Name of the file to read.
|
* @param string $file Name of the file to read.
|
||||||
* @return string|bool The function returns the read data or false on failure.
|
* @return string|bool The function returns the read data or false on failure.
|
||||||
*/
|
*/
|
||||||
function get_contents($file) {
|
public function get_contents($file) {
|
||||||
return @file_get_contents($file);
|
return @file_get_contents($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param string $file Path to the file.
|
* @param string $file Path to the file.
|
||||||
* @return array|bool the file contents in an array or false on failure.
|
* @return array|bool the file contents in an array or false on failure.
|
||||||
*/
|
*/
|
||||||
function get_contents_array($file) {
|
public function get_contents_array($file) {
|
||||||
return @file($file);
|
return @file($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param int $mode (optional) The file permissions as octal number, usually 0644.
|
* @param int $mode (optional) The file permissions as octal number, usually 0644.
|
||||||
* @return bool False upon failure.
|
* @return bool False upon failure.
|
||||||
*/
|
*/
|
||||||
function put_contents( $file, $contents, $mode = false ) {
|
public function put_contents( $file, $contents, $mode = false ) {
|
||||||
$fp = @fopen( $file, 'wb' );
|
$fp = @fopen( $file, 'wb' );
|
||||||
if ( ! $fp )
|
if ( ! $fp )
|
||||||
return false;
|
return false;
|
||||||
|
@ -82,7 +82,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
*
|
*
|
||||||
* @return string|bool the current working directory on success, or false on failure.
|
* @return string|bool the current working directory on success, or false on failure.
|
||||||
*/
|
*/
|
||||||
function cwd() {
|
public function cwd() {
|
||||||
return @getcwd();
|
return @getcwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param string $dir The new current directory.
|
* @param string $dir The new current directory.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chdir($dir) {
|
public function chdir($dir) {
|
||||||
return @chdir($dir);
|
return @chdir($dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param bool $recursive (optional) If set True changes file group recursively. Defaults to False.
|
* @param bool $recursive (optional) If set True changes file group recursively. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chgrp($file, $group, $recursive = false) {
|
public function chgrp($file, $group, $recursive = false) {
|
||||||
if ( ! $this->exists($file) )
|
if ( ! $this->exists($file) )
|
||||||
return false;
|
return false;
|
||||||
if ( ! $recursive )
|
if ( ! $recursive )
|
||||||
|
@ -128,7 +128,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param bool $recursive (optional) If set True changes file group recursively. Defaults to False.
|
* @param bool $recursive (optional) If set True changes file group recursively. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chmod($file, $mode = false, $recursive = false) {
|
public function chmod($file, $mode = false, $recursive = false) {
|
||||||
if ( ! $mode ) {
|
if ( ! $mode ) {
|
||||||
if ( $this->is_file($file) )
|
if ( $this->is_file($file) )
|
||||||
$mode = FS_CHMOD_FILE;
|
$mode = FS_CHMOD_FILE;
|
||||||
|
@ -157,7 +157,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param bool $recursive (optional) If set True changes file owner recursively. Defaults to False.
|
* @param bool $recursive (optional) If set True changes file owner recursively. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chown($file, $owner, $recursive = false) {
|
public function chown($file, $owner, $recursive = false) {
|
||||||
if ( ! $this->exists($file) )
|
if ( ! $this->exists($file) )
|
||||||
return false;
|
return false;
|
||||||
if ( ! $recursive )
|
if ( ! $recursive )
|
||||||
|
@ -178,7 +178,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param string $file Path to the file.
|
* @param string $file Path to the file.
|
||||||
* @return string|bool Username of the user or false on error.
|
* @return string|bool Username of the user or false on error.
|
||||||
*/
|
*/
|
||||||
function owner($file) {
|
public function owner($file) {
|
||||||
$owneruid = @fileowner($file);
|
$owneruid = @fileowner($file);
|
||||||
if ( ! $owneruid )
|
if ( ! $owneruid )
|
||||||
return false;
|
return false;
|
||||||
|
@ -196,11 +196,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
* @param string $file Path to the file.
|
* @param string $file Path to the file.
|
||||||
* @return string Mode of the file (last 3 digits).
|
* @return string Mode of the file (last 3 digits).
|
||||||
*/
|
*/
|
||||||
function getchmod($file) {
|
public function getchmod($file) {
|
||||||
return substr( decoct( @fileperms( $file ) ), -3 );
|
return substr( decoct( @fileperms( $file ) ), -3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function group($file) {
|
public function group($file) {
|
||||||
$gid = @filegroup($file);
|
$gid = @filegroup($file);
|
||||||
if ( ! $gid )
|
if ( ! $gid )
|
||||||
return false;
|
return false;
|
||||||
|
@ -210,7 +210,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return $grouparray['name'];
|
return $grouparray['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy($source, $destination, $overwrite = false, $mode = false) {
|
public function copy($source, $destination, $overwrite = false, $mode = false) {
|
||||||
if ( ! $overwrite && $this->exists($destination) )
|
if ( ! $overwrite && $this->exists($destination) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return $rtval;
|
return $rtval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function move($source, $destination, $overwrite = false) {
|
public function move($source, $destination, $overwrite = false) {
|
||||||
if ( ! $overwrite && $this->exists($destination) )
|
if ( ! $overwrite && $this->exists($destination) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($file, $recursive = false, $type = false) {
|
public function delete($file, $recursive = false, $type = false) {
|
||||||
if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
|
if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
|
||||||
return false;
|
return false;
|
||||||
$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
|
$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
|
||||||
|
@ -264,39 +264,39 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function exists($file) {
|
public function exists($file) {
|
||||||
return @file_exists($file);
|
return @file_exists($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_file($file) {
|
public function is_file($file) {
|
||||||
return @is_file($file);
|
return @is_file($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_dir($path) {
|
public function is_dir($path) {
|
||||||
return @is_dir($path);
|
return @is_dir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_readable($file) {
|
public function is_readable($file) {
|
||||||
return @is_readable($file);
|
return @is_readable($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_writable($file) {
|
public function is_writable($file) {
|
||||||
return @is_writable($file);
|
return @is_writable($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function atime($file) {
|
public function atime($file) {
|
||||||
return @fileatime($file);
|
return @fileatime($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mtime($file) {
|
public function mtime($file) {
|
||||||
return @filemtime($file);
|
return @filemtime($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function size($file) {
|
public function size($file) {
|
||||||
return @filesize($file);
|
return @filesize($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function touch($file, $time = 0, $atime = 0) {
|
public function touch($file, $time = 0, $atime = 0) {
|
||||||
if ($time == 0)
|
if ($time == 0)
|
||||||
$time = time();
|
$time = time();
|
||||||
if ($atime == 0)
|
if ($atime == 0)
|
||||||
|
@ -304,7 +304,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return @touch($file, $time, $atime);
|
return @touch($file, $time, $atime);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
|
public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
|
||||||
// safe mode fails with a trailing slash under certain PHP versions.
|
// safe mode fails with a trailing slash under certain PHP versions.
|
||||||
$path = untrailingslashit($path);
|
$path = untrailingslashit($path);
|
||||||
if ( empty($path) )
|
if ( empty($path) )
|
||||||
|
@ -323,11 +323,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rmdir($path, $recursive = false) {
|
public function rmdir($path, $recursive = false) {
|
||||||
return $this->delete($path, $recursive);
|
return $this->delete($path, $recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dirlist($path, $include_hidden = true, $recursive = false) {
|
public function dirlist($path, $include_hidden = true, $recursive = false) {
|
||||||
if ( $this->is_file($path) ) {
|
if ( $this->is_file($path) ) {
|
||||||
$limit_file = basename($path);
|
$limit_file = basename($path);
|
||||||
$path = dirname($path);
|
$path = dirname($path);
|
||||||
|
|
Loading…
Reference in New Issue