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