- Timestamp:
- 12/01/2014 12:12:05 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php
r28489 r30678 88 88 } 89 89 90 /** 91 * @param string $file 92 * @return bool|string 93 */ 90 94 public function get_contents( $file ) { 91 95 $tempfile = wp_tempnam($file); … … 109 113 } 110 114 115 /** 116 * @param string $file 117 * @return array 118 */ 111 119 public function get_contents_array($file) { 112 120 return explode("\n", $this->get_contents($file)); 113 121 } 114 122 123 /** 124 * @param string $file 125 * @param string $contents 126 * @param bool|string $mode 127 * @return bool 128 */ 115 129 public function put_contents($file, $contents, $mode = false ) { 116 130 $tempfile = wp_tempnam($file); … … 144 158 } 145 159 160 /** 161 * @return string 162 */ 146 163 public function cwd() { 147 164 $cwd = @ftp_pwd($this->link); … … 151 168 } 152 169 170 /** 171 * @param string $dir 172 * @return bool 173 */ 153 174 public function chdir($dir) { 154 175 return @ftp_chdir($this->link, $dir); 155 176 } 156 177 178 /** 179 * @param string $file 180 * @param bool $group 181 * @param bool $recursive 182 */ 157 183 public function chgrp($file, $group, $recursive = false ) { 158 184 return false; 159 185 } 160 186 187 /** 188 * @param string $file 189 * @param int $mode 190 * @param bool $recursive 191 * @return bool 192 */ 161 193 public function chmod($file, $mode = false, $recursive = false) { 162 194 if ( ! $mode ) { … … 182 214 } 183 215 216 /** 217 * @param string $file 218 * @return string 219 */ 184 220 public function owner($file) { 185 221 $dir = $this->dirlist($file); 186 222 return $dir[$file]['owner']; 187 223 } 188 224 /** 225 * @param string $file 226 * @return string 227 */ 189 228 public function getchmod($file) { 190 229 $dir = $this->dirlist($file); 191 230 return $dir[$file]['permsn']; 192 231 } 193 232 /** 233 * @param string $file 234 * @return string 235 */ 194 236 public function group($file) { 195 237 $dir = $this->dirlist($file); … … 197 239 } 198 240 241 /** 242 * 243 * @param string $source 244 * @param string $destination 245 * @param bool $overwrite 246 * @param string|bool $mode 247 * @return bool 248 */ 199 249 public function copy($source, $destination, $overwrite = false, $mode = false) { 200 250 if ( ! $overwrite && $this->exists($destination) ) … … 205 255 return $this->put_contents($destination, $content, $mode); 206 256 } 207 257 /** 258 * @param string $source 259 * @param string $destination 260 * @param bool $overwrite 261 * @return bool 262 */ 208 263 public function move($source, $destination, $overwrite = false) { 209 264 return ftp_rename($this->link, $source, $destination); 210 265 } 211 266 /** 267 * @param string $file 268 * @param bool $recursive 269 * @param string $type 270 * @return bool 271 */ 212 272 public function delete($file, $recursive = false, $type = false) { 213 273 if ( empty($file) ) … … 224 284 return @ftp_rmdir($this->link, $file); 225 285 } 226 286 /** 287 * @param string $file 288 * @return bool 289 */ 227 290 public function exists($file) { 228 291 $list = @ftp_nlist($this->link, $file); 229 292 return !empty($list); //empty list = no file, so invert. 230 293 } 231 294 /** 295 * @param string $file 296 * @return bool 297 */ 232 298 public function is_file($file) { 233 299 return $this->exists($file) && !$this->is_dir($file); 234 300 } 235 301 /** 302 * @param string $path 303 * @return bool 304 */ 236 305 public function is_dir($path) { 237 306 $cwd = $this->cwd(); … … 244 313 } 245 314 315 /** 316 * @param string $file 317 * @return bool 318 */ 246 319 public function is_readable($file) { 247 320 return true; 248 321 } 249 322 /** 323 * @param string $file 324 * @return bool 325 */ 250 326 public function is_writable($file) { 251 327 return true; 252 328 } 253 329 /** 330 * @param string $file 331 * @return bool 332 */ 254 333 public function atime($file) { 255 334 return false; 256 335 } 257 336 /** 337 * @param string $file 338 * @return int 339 */ 258 340 public function mtime($file) { 259 341 return ftp_mdtm($this->link, $file); 260 342 } 261 343 /** 344 * @param string $file 345 * @return int 346 */ 262 347 public function size($file) { 263 348 return ftp_size($this->link, $file); 264 349 } 265 350 /** 351 * @param string $file 352 * @return bool 353 */ 266 354 public function touch($file, $time = 0, $atime = 0) { 267 355 return false; 268 356 } 269 357 358 /** 359 * @param string $path 360 * @param mixed $chmod 361 * @param mixed $chown 362 * @param mixed $chgrp 363 * @return bool 364 */ 270 365 public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 271 366 $path = untrailingslashit($path); … … 283 378 } 284 379 380 /** 381 * @param string $path 382 * @param bool $recursive 383 * @return bool 384 */ 285 385 public function rmdir($path, $recursive = false) { 286 386 return $this->delete($path, $recursive); 287 387 } 288 388 389 /** 390 * @staticvar bool $is_windows 391 * @param string $line 392 * @return string 393 */ 289 394 public function parselisting($line) { 290 395 static $is_windows; … … 360 465 } 361 466 467 /** 468 * @param string $path 469 * @param bool $include_hidden 470 * @param bool $recursive 471 * @return bool|array 472 */ 362 473 public function dirlist($path = '.', $include_hidden = true, $recursive = false) { 363 474 if ( $this->is_file($path) ) {
Note: See TracChangeset
for help on using the changeset viewer.