Changes from tags/4.1/src/wp-admin/includes/class-wp-filesystem-ssh2.php at r31381 to tags/4.0/src/wp-admin/includes/class-wp-filesystem-ssh2.php at r31381
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/4.0/src/wp-admin/includes/class-wp-filesystem-ssh2.php
r31381 r31381 124 124 } 125 125 126 /**127 * @param string $command128 * @param bool $returnbool129 */130 126 public function run_command( $command, $returnbool = false) { 131 127 … … 149 145 } 150 146 151 /**152 * @param string $file153 * @return string|false154 */155 147 public function get_contents( $file ) { 156 148 $file = ltrim($file, '/'); … … 158 150 } 159 151 160 /**161 * @param string $file162 * @return array163 */164 152 public function get_contents_array($file) { 165 153 $file = ltrim($file, '/'); … … 167 155 } 168 156 169 /**170 * @param string $file171 * @param string $contents172 * @param bool|int $mode173 * @return bool174 */175 157 public function put_contents($file, $contents, $mode = false ) { 176 158 $ret = file_put_contents( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ), $contents ); … … 191 173 } 192 174 193 /**194 * @param string $dir195 * @return bool196 */197 175 public function chdir($dir) { 198 176 return $this->run_command('cd ' . $dir, true); 199 177 } 200 178 201 /**202 * @param string $file203 * @param string $group204 * @param bool $recursive205 */206 179 public function chgrp($file, $group, $recursive = false ) { 207 180 if ( ! $this->exists($file) ) … … 212 185 } 213 186 214 /**215 * @param string $file216 * @param int $mode217 * @param bool $recursive218 * @return bool219 */220 187 public function chmod($file, $mode = false, $recursive = false) { 221 188 if ( ! $this->exists($file) ) … … 241 208 * @since Unknown 242 209 * 243 * @param string $file Path to the file.244 * @param string|int$owner A user name or number.245 * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False.246 * @return bool |stringReturns true on success or false on failure.210 * @param string $file Path to the file. 211 * @param mixed $owner A user name or number. 212 * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. 213 * @return bool Returns true on success or false on failure. 247 214 */ 248 215 public function chown( $file, $owner, $recursive = false ) { … … 254 221 } 255 222 256 /**257 * @param string $file258 * @return string|false259 */260 223 public function owner($file) { 261 224 $owneruid = @fileowner('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); … … 267 230 return $ownerarray['name']; 268 231 } 269 /** 270 * @param string $file 271 * @return string 272 */ 232 273 233 public function getchmod($file) { 274 234 return substr( decoct( @fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ) ) ), -3 ); 275 235 } 276 236 277 /**278 * @param string $file279 * @return string|false280 */281 237 public function group($file) { 282 238 $gid = @filegroup('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); … … 289 245 } 290 246 291 /**292 * @param string $source293 * @param string $destination294 * @param bool $overwrite295 * @param int|bool $mode296 * @return bool297 */298 247 public function copy($source, $destination, $overwrite = false, $mode = false) { 299 248 if ( ! $overwrite && $this->exists($destination) ) … … 305 254 } 306 255 307 /**308 * @param string $source309 * @param string $destination310 * @param bool $overwrite311 * @return bool312 */313 256 public function move($source, $destination, $overwrite = false) { 314 return @ssh2_sftp_rename( $this->sftp_link, $source, $destination ); 315 } 316 317 /** 318 * @param string $file 319 * @param bool $recursive 320 * @param string|bool $type 321 * @return bool 322 */ 257 return @ssh2_sftp_rename($this->link, $source, $destination); 258 } 259 323 260 public function delete($file, $recursive = false, $type = false) { 324 261 if ( 'f' == $type || $this->is_file($file) ) … … 335 272 } 336 273 337 /**338 * @param string $file339 * @return bool340 */341 274 public function exists($file) { 342 275 $file = ltrim($file, '/'); 343 276 return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file); 344 277 } 345 /** 346 * @param string $file 347 * @return bool 348 */ 278 349 279 public function is_file($file) { 350 280 $file = ltrim($file, '/'); 351 281 return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file); 352 282 } 353 /** 354 * @param string $path 355 * @return bool 356 */ 283 357 284 public function is_dir($path) { 358 285 $path = ltrim($path, '/'); 359 286 return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path); 360 287 } 361 /** 362 * @param string $file 363 * @return bool 364 */ 288 365 289 public function is_readable($file) { 366 290 $file = ltrim($file, '/'); 367 291 return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file); 368 292 } 369 /** 370 * @param string $file 371 * @return bool 372 */ 293 373 294 public function is_writable($file) { 374 295 $file = ltrim($file, '/'); 375 296 return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file); 376 297 } 377 /** 378 * @param string $file 379 * @return int 380 */ 298 381 299 public function atime($file) { 382 300 $file = ltrim($file, '/'); … … 384 302 } 385 303 386 /**387 * @param string $file388 * @return int389 */390 304 public function mtime($file) { 391 305 $file = ltrim($file, '/'); … … 393 307 } 394 308 395 /**396 * @param string $file397 * @return int398 */399 309 public function size($file) { 400 310 $file = ltrim($file, '/'); … … 402 312 } 403 313 404 /**405 * @param string $file406 * @param int $time407 * @param int $atime408 */409 314 public function touch($file, $time = 0, $atime = 0) { 410 315 //Not implemented. 411 316 } 412 317 413 /**414 * @param string $path415 * @param mixed $chmod416 * @param mixed $chown417 * @param mixed $chgrp418 * @return bool419 */420 318 public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 421 319 $path = untrailingslashit($path); … … 434 332 } 435 333 436 /**437 * @param string $path438 * @param bool $recursive439 * @return bool440 */441 334 public function rmdir($path, $recursive = false) { 442 335 return $this->delete($path, $recursive); 443 336 } 444 337 445 /**446 * @param string $path447 * @param bool $include_hidden448 * @param bool $recursive449 * @return bool|array450 */451 338 public function dirlist($path, $include_hidden = true, $recursive = false) { 452 339 if ( $this->is_file($path) ) {
Note: See TracChangeset
for help on using the changeset viewer.