http://www.mediawiki.org/wiki/Special:Code/MediaWiki/68998
Revision: 68998
Author: jeroendedauw
Date: 2010-07-04 14:33:00 +0000 (Sun, 04 Jul 2010)
Log Message:
-----------
Work on porting WP filesystem abstraction classes
Modified Paths:
--------------
trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
Modified: trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
===================================================================
--- trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
2010-07-04 14:03:33 UTC (rev 68997)
+++ trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
2010-07-04 14:33:00 UTC (rev 68998)
@@ -418,7 +418,36 @@
* @see Filesystem::makeDir
*/
public function makeDir( $path, $chmod = false, $chown = false, $chgrp
= false ) {
+ // Safe mode fails with a trailing slash under certain PHP
versions.
+ $path = rtrim( $path, '/' );
+ if ( empty( $path ) ) {
+ $path = '/';
+ }
+
+ if ( !$chmod ) {
+ $chmod = FS_CHMOD_DIR;
+ }
+
+ wfSuppressWarnings();
+ $mkdir = mkdir($path);
+ wfRestoreWarnings();
+
+ if ( !$mkdir ) {
+ return false;
+ }
+
+ $this->chmod( $path, $chmod );
+
+ if ( $chown ) {
+ $this->chown( $path, $chown );
+ }
+
+ if ( $chgrp ) {
+ $this->changeFileGroup( $path, $chgrp );
+ }
+
+ return true;
}
/**
Modified: trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
===================================================================
--- trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
2010-07-04 14:03:33 UTC (rev 68997)
+++ trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
2010-07-04 14:33:00 UTC (rev 68998)
@@ -457,7 +457,25 @@
* @see Filesystem::makeDir
*/
public function makeDir( $path, $chmod = false, $chown = false, $chgrp
= false ) {
+ wfSuppressWarnings();
+ $ftp_mkdir = ftp_mkdir( $this->connection, $path );
+ wfRestoreWarnings();
+ if ( !$ftp_mkdir ) {
+ return false;
+ }
+
+ $this->chmod( $path, $chmod );
+
+ if ( $chown ) {
+ $this->chown( $path, $chown );
+ }
+
+ if ( $chgrp ) {
+ $this->changeFileGroup( $path, $chgrp );
+ }
+
+ return true;
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs