Index: trunk/extensions/Deployment/includes/filesystems/Ssh2Filesystem.php |
— | — | @@ -314,14 +314,14 @@ |
315 | 315 | * @see Filesystem::isDir |
316 | 316 | */ |
317 | 317 | public function isDir( $path ) { |
318 | | - return is_dir( 'ssh2.sftp://' . $this->sftpConnection . '/' . ltrim( $file, '/' ) ); |
| 318 | + return is_dir( 'ssh2.sftp://' . $this->sftpConnection . '/' . ltrim( $path, '/' ) ); |
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
322 | 322 | * @see Filesystem::isFile |
323 | 323 | */ |
324 | 324 | public function isFile( $path ) { |
325 | | - return is_file( 'ssh2.sftp://' . $this->sftpConnection . '/' . ltrim( $file, '/' ) ); |
| 325 | + return is_file( 'ssh2.sftp://' . $this->sftpConnection . '/' . ltrim( $path, '/' ) ); |
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
— | — | @@ -349,21 +349,44 @@ |
350 | 350 | * @see Filesystem::makeDir |
351 | 351 | */ |
352 | 352 | public function makeDir( $path, $chmod = false, $chown = false, $chgrp = false ) { |
| 353 | + $path = rtrim( $path, '/' ); |
353 | 354 | |
| 355 | + if ( !$chmod ) { |
| 356 | + $chmod = FS_CHMOD_DIR; |
| 357 | + } |
| 358 | + |
| 359 | + if ( !ssh2_sftp_mkdir( $this->sftpConnection, $path, $chmod, true ) ) { |
| 360 | + return false; |
| 361 | + } |
| 362 | + |
| 363 | + if ( $chown ) { |
| 364 | + $this->chown( $path, $chown ); |
| 365 | + } |
| 366 | + |
| 367 | + if ( $chgrp ) { |
| 368 | + $this->chgrp( $path, $chgrp ); |
| 369 | + } |
| 370 | + |
| 371 | + return true; |
354 | 372 | } |
355 | 373 | |
356 | 374 | /** |
357 | 375 | * @see Filesystem::touch |
358 | 376 | */ |
359 | 377 | public function touch( $file, $time = 0, $atime = 0 ) { |
360 | | - |
| 378 | + return false; |
361 | 379 | } |
362 | 380 | |
363 | 381 | /** |
364 | 382 | * @see Filesystem::writeToFile |
365 | 383 | */ |
366 | 384 | public function writeToFile( $file, $contents ) { |
367 | | - |
| 385 | + $file = ltrim( $file, '/' ); |
| 386 | + $ret = file_put_contents( 'ssh2.sftp://' . $this->sftpConnection . '/' . $file, $contents ); |
| 387 | + |
| 388 | + $this->chmod( $file ); |
| 389 | + |
| 390 | + return $ret !== false; |
368 | 391 | } |
369 | 392 | |
370 | 393 | protected function runCommandRecursivly( $command, $file, $recursive, $mode = false ) { |
— | — | @@ -372,10 +395,10 @@ |
373 | 396 | } |
374 | 397 | |
375 | 398 | if ( !$mode ) { |
376 | | - if ( $this->is_file($file) ) { |
| 399 | + if ( $this->isFile( $file ) ) { |
377 | 400 | $mode = FS_CHMOD_FILE; |
378 | 401 | } |
379 | | - elseif ( $this->is_dir($file) ) { |
| 402 | + elseif ( $this->isDir( $file ) ) { |
380 | 403 | $mode = FS_CHMOD_DIR; |
381 | 404 | } |
382 | 405 | else { |