Index: trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | * @see Filesystem::chown |
164 | 164 | */ |
165 | 165 | public function chown( $file, $owner, $recursive = false ) { |
166 | | - |
| 166 | + return false; |
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
Index: trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php |
— | — | @@ -99,14 +99,62 @@ |
100 | 100 | * @see Filesystem::chown |
101 | 101 | */ |
102 | 102 | public function chown( $file, $owner, $recursive = false ) { |
| 103 | + if ( !$this->exists( $file ) ) { |
| 104 | + return false; |
| 105 | + } |
103 | 106 | |
| 107 | + // Not recursive, so just use chown. |
| 108 | + if ( !$recursive || !$this->isDir( $file ) ) { |
| 109 | + return (bool)@chown( $file, $owner ); |
| 110 | + } |
| 111 | + |
| 112 | + // Recursive approach required. |
| 113 | + $file = rtrim( $file, '/' ) . '/'; |
| 114 | + $files = $this->listDir( $file ); |
| 115 | + |
| 116 | + foreach ( $files as $fileName ) { |
| 117 | + $this->chown( $file . $fileName, $owner, $recursive ); |
| 118 | + } |
| 119 | + |
| 120 | + return true; |
104 | 121 | } |
105 | 122 | |
106 | 123 | /** |
107 | 124 | * @see Filesystem::delete |
108 | 125 | */ |
109 | 126 | public function delete( $path, $recursive = false ) { |
| 127 | + if ( empty( $path ) ) { |
| 128 | + return false; |
| 129 | + } |
| 130 | + |
| 131 | + // For win32, occasional problems deleteing files otherwise. |
| 132 | + $path = str_replace( '\\', '/', $path ); |
| 133 | + |
| 134 | + if ( $this->isFile( $path ) ) { |
| 135 | + return (bool)@unlink( $path ); |
| 136 | + } |
| 137 | + |
| 138 | + if ( !$recursive && $this->isDir( $path ) ) { |
| 139 | + return (bool)@rmdir( $path ); |
| 140 | + } |
| 141 | + |
| 142 | + // Recursive approach required. |
| 143 | + $path = rtrim( $path, '/' ) . '/'; |
| 144 | + $files = $this->listDir( $path ); |
110 | 145 | |
| 146 | + $success = true; |
| 147 | + |
| 148 | + foreach ( $files as $fileName ) { |
| 149 | + if ( !$this->delete( $path . $fileName, $owner, $recursive ) ) { |
| 150 | + $success = false; |
| 151 | + } |
| 152 | + } |
| 153 | + |
| 154 | + if ( $success && file_exists( $path ) && !@rmdir( $path ) ) { |
| 155 | + $success = false; |
| 156 | + } |
| 157 | + |
| 158 | + return $success; |
111 | 159 | } |
112 | 160 | |
113 | 161 | /** |