Index: trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | * @see Filesystem::doCopy |
206 | 206 | */ |
207 | 207 | protected function doCopy( $from, $to ) { |
208 | | - $content = $this->get_contents( $from ); |
| 208 | + $content = $this->getContents( $from ); |
209 | 209 | |
210 | 210 | if ( $content === false ) { |
211 | 211 | return false; |
— | — | @@ -216,8 +216,8 @@ |
217 | 217 | /** |
218 | 218 | * @see Filesystem::doMove |
219 | 219 | */ |
220 | | - protected function doMove( $from, $to ) { |
221 | | - |
| 220 | + protected function doMove( $from, $to, $overwrite ) { |
| 221 | + return (bool)@ftp_rename( $this->connection, $from, $to ); |
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
Index: trunk/extensions/Deployment/includes/filesystems/DirectFilesystem.php |
— | — | @@ -167,8 +167,18 @@ |
168 | 168 | /** |
169 | 169 | * @see Filesystem::doMove |
170 | 170 | */ |
171 | | - protected function doMove( $from, $to ) { |
172 | | - |
| 171 | + protected function doMove( $from, $to, $overwrite ) { |
| 172 | + // try using rename first. if that fails (for example, source is read only) try copy and delete. |
| 173 | + if ( @rename( $from, $to) ) { |
| 174 | + return true; |
| 175 | + } |
| 176 | + |
| 177 | + if ( $this->copy( $from, $to, $overwrite ) && $this->exists( $to ) ) { |
| 178 | + $this->delete( $from ); |
| 179 | + return true; |
| 180 | + } else { |
| 181 | + return false; |
| 182 | + } |
173 | 183 | } |
174 | 184 | |
175 | 185 | /** |
Index: trunk/extensions/Deployment/includes/Filesystem.php |
— | — | @@ -268,7 +268,7 @@ |
269 | 269 | * |
270 | 270 | * @return boolean Success indicator |
271 | 271 | */ |
272 | | - protected abstract function doMove( $from, $to ); |
| 272 | + protected abstract function doMove( $from, $to, $overwrite ); |
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Constructor |
— | — | @@ -303,7 +303,7 @@ |
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | |
307 | | - return $this->doCopy(); |
| 307 | + return $this->doCopy( $from, $to ); |
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
— | — | @@ -320,7 +320,7 @@ |
321 | 321 | return false; |
322 | 322 | } |
323 | 323 | |
324 | | - return $this->doMove(); |
| 324 | + return $this->doMove( $from, $to, $overwrite ); |
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |