r68957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68956‎ | r68957 | r68958 >
Date:18:05, 3 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
@@ -169,7 +169,35 @@
170170 * @see Filesystem::delete
171171 */
172172 public function delete( $path, $recursive = false ) {
 173+ if ( empty( $path ) ) {
 174+ return false;
 175+ }
 176+
 177+ if ( $this->isFile( $path ) ) {
 178+ return (bool)@ftp_delete( $this->connection, $path );
 179+ }
 180+
 181+ if ( !$recursive ) {
 182+ return (bool)@ftp_rmdir( $this->connection, $path );
 183+ }
 184+
 185+ // Recursive approach required.
 186+ $path = rtrim( $path, '/' ) . '/';
 187+ $files = $this->listDir( $path );
173188
 189+ $success = true;
 190+
 191+ foreach ( $files as $fileName ) {
 192+ if ( !$this->delete( $path . $fileName, $recursive ) ) {
 193+ $success = false;
 194+ }
 195+ }
 196+
 197+ if ( $success && $this->exists( $path ) && !@ftp_rmdir( $this->link, $path ) ) {
 198+ $success = false;
 199+ }
 200+
 201+ return $success;
174202 }
175203
176204 /**
Index: trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php
@@ -145,7 +145,7 @@
146146 $success = true;
147147
148148 foreach ( $files as $fileName ) {
149 - if ( !$this->delete( $path . $fileName, $owner, $recursive ) ) {
 149+ if ( !$this->delete( $path . $fileName, $recursive ) ) {
150150 $success = false;
151151 }
152152 }

Status & tagging log