r68998 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68997‎ | r68998 | r68999 >
Date:14:33, 4 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on porting WP filesystem abstraction classes
Modified paths:
  • /trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php (modified) (history)
  • /trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
@@ -457,7 +457,25 @@
458458 * @see Filesystem::makeDir
459459 */
460460 public function makeDir( $path, $chmod = false, $chown = false, $chgrp = false ) {
 461+ wfSuppressWarnings();
 462+ $ftp_mkdir = ftp_mkdir( $this->connection, $path );
 463+ wfRestoreWarnings();
461464
 465+ if ( !$ftp_mkdir ) {
 466+ return false;
 467+ }
 468+
 469+ $this->chmod( $path, $chmod );
 470+
 471+ if ( $chown ) {
 472+ $this->chown( $path, $chown );
 473+ }
 474+
 475+ if ( $chgrp ) {
 476+ $this->changeFileGroup( $path, $chgrp );
 477+ }
 478+
 479+ return true;
462480 }
463481
464482 /**
Index: trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
@@ -418,7 +418,36 @@
419419 * @see Filesystem::makeDir
420420 */
421421 public function makeDir( $path, $chmod = false, $chown = false, $chgrp = false ) {
 422+ // Safe mode fails with a trailing slash under certain PHP versions.
 423+ $path = rtrim( $path, '/' );
422424
 425+ if ( empty( $path ) ) {
 426+ $path = '/';
 427+ }
 428+
 429+ if ( !$chmod ) {
 430+ $chmod = FS_CHMOD_DIR;
 431+ }
 432+
 433+ wfSuppressWarnings();
 434+ $mkdir = mkdir($path);
 435+ wfRestoreWarnings();
 436+
 437+ if ( !$mkdir ) {
 438+ return false;
 439+ }
 440+
 441+ $this->chmod( $path, $chmod );
 442+
 443+ if ( $chown ) {
 444+ $this->chown( $path, $chown );
 445+ }
 446+
 447+ if ( $chgrp ) {
 448+ $this->changeFileGroup( $path, $chgrp );
 449+ }
 450+
 451+ return true;
423452 }
424453
425454 /**

Status & tagging log