Index: branches/FileBackend/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | # @todo FIXME: Delete old thumbs that aren't being used. Maintenance script? |
298 | 298 | wfSuppressWarnings(); |
299 | 299 | $backend = $this->getBackend(); |
300 | | - $op = array( 'op' => 'create', 'dest' => $localFilename, 'content' => $thumb ); |
| 300 | + $op = array( 'op' => 'create', 'dst' => $localFilename, 'content' => $thumb ); |
301 | 301 | if( !$backend->doOperation( $op )->isOK() ) { |
302 | 302 | wfRestoreWarnings(); |
303 | 303 | wfDebug( __METHOD__ . " could not write to thumb path\n" ); |
Index: branches/FileBackend/phase3/includes/filerepo/file/LocalFile.php |
— | — | @@ -604,7 +604,7 @@ |
605 | 605 | |
606 | 606 | if ( $this->repo->fileExists( $thumbDir, FileRepo::FILES_ONLY ) ) { |
607 | 607 | // File where directory should be |
608 | | - $op = array( 'op' => 'delete', 'source' => $thumbDir ); |
| 608 | + $op = array( 'op' => 'delete', 'src' => $thumbDir ); |
609 | 609 | $this->repo->getBackend()->doOperation( $op ); |
610 | 610 | } |
611 | 611 | } |
— | — | @@ -629,7 +629,7 @@ |
630 | 630 | |
631 | 631 | $backend = $this->repo->getBackend(); |
632 | 632 | $files = array( $dir ); |
633 | | - $iterator = $backend->getFileList( array( 'directory' => $dir ) ); |
| 633 | + $iterator = $backend->getFileList( array( 'dir' => $dir ) ); |
634 | 634 | foreach ( $iterator as $file ) { |
635 | 635 | $files[] = $file; |
636 | 636 | } |
— | — | @@ -757,12 +757,12 @@ |
758 | 758 | # Check that the base file name is part of the thumb name |
759 | 759 | # This is a basic sanity check to avoid erasing unrelated directories |
760 | 760 | if ( strpos( $file, $this->getName() ) !== false ) { |
761 | | - $op = array( 'op' => 'delete', 'source' => "{$dir}/{$file}" ); |
| 761 | + $op = array( 'op' => 'delete', 'src' => "{$dir}/{$file}" ); |
762 | 762 | $backend->doOperation( $op ); |
763 | 763 | } |
764 | 764 | } |
765 | 765 | # Clear out directory if empty |
766 | | - $backend->clean( array( 'directory' => $dir ) ); |
| 766 | + $backend->clean( array( 'dir' => $dir ) ); |
767 | 767 | } |
768 | 768 | |
769 | 769 | /** purgeDescription inherited */ |
Index: branches/FileBackend/phase3/includes/filerepo/file/ForeignAPIFile.php |
— | — | @@ -198,7 +198,7 @@ |
199 | 199 | |
200 | 200 | function getThumbnails() { |
201 | 201 | $dir = $this->getThumbPath( $this->getName() ); |
202 | | - $iter = $this->repo->getBackend()->getFileList( array( 'directory' => $dir ) ); |
| 202 | + $iter = $this->repo->getBackend()->getFileList( array( 'dir' => $dir ) ); |
203 | 203 | |
204 | 204 | $files = array(); |
205 | 205 | foreach ( $iter as $file ) { |
— | — | @@ -241,9 +241,9 @@ |
242 | 242 | |
243 | 243 | $dir = $this->getThumbPath( $this->getName() ); |
244 | 244 | foreach ( $files as $file ) { |
245 | | - $op = array( 'op' => 'delete', 'source' => "{$dir}{$file}" ); |
| 245 | + $op = array( 'op' => 'delete', 'src' => "{$dir}{$file}" ); |
246 | 246 | $backend->doOperation( $op ); |
247 | 247 | } |
248 | | - $backend->clean( array( 'directory' => $dir ) ); |
| 248 | + $backend->clean( array( 'dir' => $dir ) ); |
249 | 249 | } |
250 | 250 | } |
Index: branches/FileBackend/phase3/includes/filerepo/LocalRepo.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | $hidden = $this->hiddenFileHasKey( $key, 'lock' ); |
73 | 73 | if ( !$deleted && !$hidden ) { // not in use now |
74 | 74 | wfDebug( __METHOD__ . ": deleting $key\n" ); |
75 | | - $op = array( 'op' => 'delete', 'source' => $path ); |
| 75 | + $op = array( 'op' => 'delete', 'src' => $path ); |
76 | 76 | if ( !$backend->doOperation( $op )->isOK() ) { |
77 | 77 | $status->error( 'undelete-cleanup-error', $path ); |
78 | 78 | $status->failCount++; |
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | return $status; // died mid-stream...so this is already fubar |
235 | 235 | } |
236 | 236 | } |
237 | | - return Status::newFatal( 'backend-fail-stream', $params['source'] ); |
| 237 | + return Status::newFatal( 'backend-fail-stream', $params['src'] ); |
238 | 238 | } |
239 | 239 | |
240 | 240 | function getLocalCopy( array $params ) { |
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php |
— | — | @@ -175,12 +175,12 @@ |
176 | 176 | protected function backupSource() { |
177 | 177 | $status = Status::newGood(); |
178 | 178 | // Check if a file already exists at the source... |
179 | | - $params = array( 'source' => $this->params['source'] ); |
| 179 | + $params = array( 'src' => $this->params['src'] ); |
180 | 180 | if ( $this->backend->fileExists( $params ) ) { |
181 | 181 | // Create a temporary backup copy... |
182 | 182 | $this->tmpSourcePath = $this->backend->getLocalCopy( $params ); |
183 | 183 | if ( $this->tmpSourcePath === null ) { |
184 | | - $status->fatal( 'backend-fail-backup', $this->params['source'] ); |
| 184 | + $status->fatal( 'backend-fail-backup', $this->params['src'] ); |
185 | 185 | return $status; |
186 | 186 | } |
187 | 187 | } |
— | — | @@ -201,9 +201,10 @@ |
202 | 202 | |
203 | 203 | if ( !empty( $this->params['overwriteDest'] ) ) { |
204 | 204 | // Create a temporary backup copy... |
| 205 | + $params = array( 'src' => $this->params['dst'] ); |
205 | 206 | $this->tmpDestFile = $this->backend->getLocalCopy( $params ); |
206 | 207 | if ( !$this->tmpDestFile ) { |
207 | | - $status->fatal( 'backend-fail-backup', $this->params['dest'] ); |
| 208 | + $status->fatal( 'backend-fail-backup', $this->params['dst'] ); |
208 | 209 | return $status; |
209 | 210 | } |
210 | 211 | } elseif ( !empty( $this->params['overwriteSame'] ) ) { |
— | — | @@ -212,19 +213,19 @@ |
213 | 214 | // If there is a single source, then we can do some checks already. |
214 | 215 | // For things like concatenate(), we need to build a temp file first. |
215 | 216 | if ( $shash !== null ) { |
216 | | - $dhash = $this->getFileMD5( $this->params['dest'] ); |
| 217 | + $dhash = $this->getFileMD5( $this->params['dst'] ); |
217 | 218 | if ( !strlen( $shash ) || !strlen( $dhash ) ) { |
218 | 219 | $status->fatal( 'backend-fail-hashes' ); |
219 | 220 | return $status; |
220 | 221 | } |
221 | 222 | // Give an error if the files are not identical |
222 | 223 | if ( $shash !== $dhash ) { |
223 | | - $status->fatal( 'backend-fail-notsame', $this->params['dest'] ); |
| 224 | + $status->fatal( 'backend-fail-notsame', $this->params['dst'] ); |
224 | 225 | } |
225 | 226 | return $status; // do nothing; either OK or bad status |
226 | 227 | } |
227 | 228 | } else { |
228 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 229 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
229 | 230 | return $status; |
230 | 231 | } |
231 | 232 | |
— | — | @@ -254,7 +255,7 @@ |
255 | 256 | if ( $this->backend->getHashType() === 'md5' ) { |
256 | 257 | $hash = $this->backend->getFileHash( $path ); |
257 | 258 | } else { |
258 | | - $tmp = $this->backend->getLocalCopy( array( 'source' => $path ) ); |
| 259 | + $tmp = $this->backend->getLocalCopy( array( 'src' => $path ) ); |
259 | 260 | if ( !$tmp ) { |
260 | 261 | return false; // error |
261 | 262 | } |
— | — | @@ -277,8 +278,8 @@ |
278 | 279 | // Restore any file that was at the destination |
279 | 280 | if ( $this->tmpSourcePath !== null ) { |
280 | 281 | $params = array( |
281 | | - 'source' => $this->tmpSourcePath, |
282 | | - 'dest' => $this->params['source'] |
| 282 | + 'src' => $this->tmpSourcePath, |
| 283 | + 'dst' => $this->params['src'] |
283 | 284 | ); |
284 | 285 | $status = $this->backend->store( $params ); |
285 | 286 | if ( !$status->isOK() ) { |
— | — | @@ -298,8 +299,8 @@ |
299 | 300 | // Restore any file that was at the destination |
300 | 301 | if ( $this->tmpDestFile ) { |
301 | 302 | $params = array( |
302 | | - 'source' => $this->tmpDestFile->getPath(), |
303 | | - 'dest' => $this->params['dest'] |
| 303 | + 'src' => $this->tmpDestFile->getPath(), |
| 304 | + 'dst' => $this->params['dst'] |
304 | 305 | ); |
305 | 306 | $status = $this->backend->store( $params ); |
306 | 307 | if ( !$status->isOK() ) { |
— | — | @@ -320,7 +321,7 @@ |
321 | 322 | if ( isset( $predicates['exists'][$source] ) ) { |
322 | 323 | return $predicates['exists'][$source]; // previous op assures this |
323 | 324 | } else { |
324 | | - return $this->backend->fileExists( array( 'source' => $source ) ); |
| 325 | + return $this->backend->fileExists( array( 'src' => $source ) ); |
325 | 326 | } |
326 | 327 | } |
327 | 328 | } |
— | — | @@ -328,8 +329,8 @@ |
329 | 330 | /** |
330 | 331 | * Store a file into the backend from a file on the file system. |
331 | 332 | * Parameters similar to FileBackend::store(), which include: |
332 | | - * source : source path on file system |
333 | | - * dest : destination storage path |
| 333 | + * src : source path on file system |
| 334 | + * dst : destination storage path |
334 | 335 | * overwriteDest : do nothing and pass if an identical file exists at destination |
335 | 336 | * overwriteSame : override any existing file at destination |
336 | 337 | */ |
— | — | @@ -337,21 +338,21 @@ |
338 | 339 | protected function doPrecheck( array &$predicates ) { |
339 | 340 | $status = Status::newGood(); |
340 | 341 | // Check if destination file exists |
341 | | - if ( $this->fileExists( $this->params['dest'], $predicates ) ) { |
| 342 | + if ( $this->fileExists( $this->params['dst'], $predicates ) ) { |
342 | 343 | if ( empty( $this->params['overwriteDest'] ) ) { |
343 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 344 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
344 | 345 | return $status; |
345 | 346 | } |
346 | 347 | } else { |
347 | 348 | $this->checkDest = false; |
348 | 349 | } |
349 | 350 | // Check if the source file exists on the file system |
350 | | - if ( !file_exists( $this->params['source'] ) ) { |
351 | | - $status->fatal( 'backend-fail-notexists', $this->params['source'] ); |
| 351 | + if ( !file_exists( $this->params['src'] ) ) { |
| 352 | + $status->fatal( 'backend-fail-notexists', $this->params['src'] ); |
352 | 353 | return $status; |
353 | 354 | } |
354 | 355 | // Update file existence predicates |
355 | | - $predicates['exists'][$this->params['dest']] = true; |
| 356 | + $predicates['exists'][$this->params['dst']] = true; |
356 | 357 | return $status; |
357 | 358 | } |
358 | 359 | |
— | — | @@ -371,7 +372,7 @@ |
372 | 373 | |
373 | 374 | protected function doRevert() { |
374 | 375 | // Remove the file saved to the destination |
375 | | - $params = array( 'source' => $this->params['dest'] ); |
| 376 | + $params = array( 'src' => $this->params['dst'] ); |
376 | 377 | $status = $this->backend->delete( $params ); |
377 | 378 | if ( !$status->isOK() ) { |
378 | 379 | return $status; // also can't restore any dest file |
— | — | @@ -382,11 +383,11 @@ |
383 | 384 | } |
384 | 385 | |
385 | 386 | protected function getSourceMD5() { |
386 | | - return md5_file( $this->params['source'] ); |
| 387 | + return md5_file( $this->params['src'] ); |
387 | 388 | } |
388 | 389 | |
389 | 390 | function storagePathsUsed() { |
390 | | - return array( $this->params['dest'] ); |
| 391 | + return array( $this->params['dst'] ); |
391 | 392 | } |
392 | 393 | } |
393 | 394 | |
— | — | @@ -394,7 +395,7 @@ |
395 | 396 | * Create a file in the backend with the given content. |
396 | 397 | * Parameters similar to FileBackend::create(), which include: |
397 | 398 | * content : a string of raw file contents |
398 | | - * dest : destination storage path |
| 399 | + * dst : destination storage path |
399 | 400 | * overwriteDest : do nothing and pass if an identical file exists at destination |
400 | 401 | * overwriteSame : override any existing file at destination |
401 | 402 | */ |
— | — | @@ -402,16 +403,16 @@ |
403 | 404 | protected function doPrecheck( array &$predicates ) { |
404 | 405 | $status = Status::newGood(); |
405 | 406 | // Check if destination file exists |
406 | | - if ( $this->fileExists( $this->params['dest'], $predicates ) ) { |
| 407 | + if ( $this->fileExists( $this->params['dst'], $predicates ) ) { |
407 | 408 | if ( empty( $this->params['overwriteDest'] ) ) { |
408 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 409 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
409 | 410 | return $status; |
410 | 411 | } |
411 | 412 | } else { |
412 | 413 | $this->checkDest = false; |
413 | 414 | } |
414 | 415 | // Update file existence predicates |
415 | | - $predicates['exists'][$this->params['dest']] = true; |
| 416 | + $predicates['exists'][$this->params['dst']] = true; |
416 | 417 | return $status; |
417 | 418 | } |
418 | 419 | |
— | — | @@ -431,7 +432,7 @@ |
432 | 433 | |
433 | 434 | protected function doRevert() { |
434 | 435 | // Remove the file saved to the destination |
435 | | - $params = array( 'source' => $this->params['dest'] ); |
| 436 | + $params = array( 'src' => $this->params['dst'] ); |
436 | 437 | $status = $this->backend->delete( $params ); |
437 | 438 | if ( !$status->isOK() ) { |
438 | 439 | return $status; // also can't restore any dest file |
— | — | @@ -446,15 +447,15 @@ |
447 | 448 | } |
448 | 449 | |
449 | 450 | function storagePathsUsed() { |
450 | | - return array( $this->params['dest'] ); |
| 451 | + return array( $this->params['dst'] ); |
451 | 452 | } |
452 | 453 | } |
453 | 454 | |
454 | 455 | /** |
455 | 456 | * Copy a file from one storage path to another in the backend. |
456 | 457 | * Parameters similar to FileBackend::copy(), which include: |
457 | | - * source : source storage path |
458 | | - * dest : destination storage path |
| 458 | + * src : source storage path |
| 459 | + * dst : destination storage path |
459 | 460 | * overwriteDest : do nothing and pass if an identical file exists at destination |
460 | 461 | * overwriteSame : override any existing file at destination |
461 | 462 | */ |
— | — | @@ -464,21 +465,21 @@ |
465 | 466 | protected function doPrecheck( array &$predicates ) { |
466 | 467 | $status = Status::newGood(); |
467 | 468 | // Check if destination file exists |
468 | | - if ( $this->fileExists( $this->params['dest'], $predicates ) ) { |
| 469 | + if ( $this->fileExists( $this->params['dst'], $predicates ) ) { |
469 | 470 | if ( empty( $this->params['overwriteDest'] ) ) { |
470 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 471 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
471 | 472 | return $status; |
472 | 473 | } |
473 | 474 | } else { |
474 | 475 | $this->checkDest = false; |
475 | 476 | } |
476 | 477 | // Check if the source file exists |
477 | | - if ( !$this->fileExists( $this->params['source'], $predicates ) ) { |
478 | | - $status->fatal( 'backend-fail-notexists', $this->params['source'] ); |
| 478 | + if ( !$this->fileExists( $this->params['src'], $predicates ) ) { |
| 479 | + $status->fatal( 'backend-fail-notexists', $this->params['src'] ); |
479 | 480 | return $status; |
480 | 481 | } |
481 | 482 | // Update file existence predicates |
482 | | - $predicates['exists'][$this->params['dest']] = true; |
| 483 | + $predicates['exists'][$this->params['dst']] = true; |
483 | 484 | return $status; |
484 | 485 | } |
485 | 486 | |
— | — | @@ -499,7 +500,7 @@ |
500 | 501 | protected function doRevert() { |
501 | 502 | $status = Status::newGood(); |
502 | 503 | // Remove the file saved to the destination |
503 | | - $params = array( 'source' => $this->params['dest'] ); |
| 504 | + $params = array( 'src' => $this->params['dst'] ); |
504 | 505 | $status->merge( $this->backend->delete( $params ) ); |
505 | 506 | if ( !$status->isOK() ) { |
506 | 507 | return $status; // also can't restore any dest file |
— | — | @@ -510,19 +511,19 @@ |
511 | 512 | } |
512 | 513 | |
513 | 514 | protected function getSourceMD5() { |
514 | | - return $this->getFileMD5( $this->params['source'] ); |
| 515 | + return $this->getFileMD5( $this->params['src'] ); |
515 | 516 | } |
516 | 517 | |
517 | 518 | function storagePathsUsed() { |
518 | | - return array( $this->params['source'], $this->params['dest'] ); |
| 519 | + return array( $this->params['src'], $this->params['dst'] ); |
519 | 520 | } |
520 | 521 | } |
521 | 522 | |
522 | 523 | /** |
523 | 524 | * Move a file from one storage path to another in the backend. |
524 | 525 | * Parameters similar to FileBackend::move(), which include: |
525 | | - * source : source storage path |
526 | | - * dest : destination storage path |
| 526 | + * src : source storage path |
| 527 | + * dst : destination storage path |
527 | 528 | * overwriteDest : do nothing and pass if an identical file exists at destination |
528 | 529 | * overwriteSame : override any existing file at destination |
529 | 530 | */ |
— | — | @@ -538,22 +539,22 @@ |
539 | 540 | protected function doPrecheck( array &$predicates ) { |
540 | 541 | $status = Status::newGood(); |
541 | 542 | // Check if destination file exists |
542 | | - if ( $this->fileExists( $this->params['dest'], $predicates ) ) { |
| 543 | + if ( $this->fileExists( $this->params['dst'], $predicates ) ) { |
543 | 544 | if ( empty( $this->params['overwriteDest'] ) ) { |
544 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 545 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
545 | 546 | return $status; |
546 | 547 | } |
547 | 548 | } else { |
548 | 549 | $this->checkDest = false; |
549 | 550 | } |
550 | 551 | // Check if the source file exists |
551 | | - if ( !$this->fileExists( $this->params['source'], $predicates ) ) { |
552 | | - $status->fatal( 'backend-fail-notexists', $this->params['source'] ); |
| 552 | + if ( !$this->fileExists( $this->params['src'], $predicates ) ) { |
| 553 | + $status->fatal( 'backend-fail-notexists', $this->params['src'] ); |
553 | 554 | return $status; |
554 | 555 | } |
555 | 556 | // Update file existence predicates |
556 | | - $predicates['exists'][$this->params['source']] = false; |
557 | | - $predicates['exists'][$this->params['dest']] = true; |
| 557 | + $predicates['exists'][$this->params['src']] = false; |
| 558 | + $predicates['exists'][$this->params['dst']] = true; |
558 | 559 | return $status; |
559 | 560 | } |
560 | 561 | |
— | — | @@ -577,7 +578,7 @@ |
578 | 579 | return $status; |
579 | 580 | } |
580 | 581 | // Delete source |
581 | | - $params = array( 'source' => $this->params['source'] ); |
| 582 | + $params = array( 'src' => $this->params['src'] ); |
582 | 583 | $status->merge( $this->backend->delete( $params ) ); |
583 | 584 | if ( !$status->isOK() ) { |
584 | 585 | return $status; |
— | — | @@ -591,8 +592,8 @@ |
592 | 593 | // Native moves: move the file back to the source |
593 | 594 | if ( $this->usingMove ) { |
594 | 595 | $params = array( |
595 | | - 'source' => $this->params['dest'], |
596 | | - 'dest' => $this->params['source'] |
| 596 | + 'src' => $this->params['dst'], |
| 597 | + 'dst' => $this->params['src'] |
597 | 598 | ); |
598 | 599 | $status->merge( $this->backend->move( $params ) ); |
599 | 600 | if ( !$status->isOK() ) { |
— | — | @@ -601,13 +602,13 @@ |
602 | 603 | // Non-native moves: remove the file saved to the destination |
603 | 604 | } else { |
604 | 605 | // Copy destination back to source |
605 | | - $params = array( 'source' => $this->params['dest'], 'dest' => $this->params['source'] ); |
| 606 | + $params = array( 'src' => $this->params['dst'], 'dst' => $this->params['src'] ); |
606 | 607 | $status = $this->backend->copy( $params ); |
607 | 608 | if ( !$status->isOK() ) { |
608 | 609 | return $status; // also can't restore any dest file |
609 | 610 | } |
610 | 611 | // Delete destination |
611 | | - $params = array( 'source' => $this->params['dest'] ); |
| 612 | + $params = array( 'src' => $this->params['dst'] ); |
612 | 613 | $status = $this->backend->delete( $params ); |
613 | 614 | if ( !$status->isOK() ) { |
614 | 615 | return $status; // also can't restore any dest file |
— | — | @@ -619,11 +620,11 @@ |
620 | 621 | } |
621 | 622 | |
622 | 623 | protected function getSourceMD5() { |
623 | | - return $this->getFileMD5( $this->params['source'] ); |
| 624 | + return $this->getFileMD5( $this->params['src'] ); |
624 | 625 | } |
625 | 626 | |
626 | 627 | function storagePathsUsed() { |
627 | | - return array( $this->params['source'], $this->params['dest'] ); |
| 628 | + return array( $this->params['src'], $this->params['dst'] ); |
628 | 629 | } |
629 | 630 | } |
630 | 631 | |
— | — | @@ -631,7 +632,7 @@ |
632 | 633 | * Combines files from severals storage paths into a new file in the backend. |
633 | 634 | * Parameters similar to FileBackend::concatenate(), which include: |
634 | 635 | * sources : ordered source storage paths (e.g. chunk1,chunk2,...) |
635 | | - * dest : destination storage path |
| 636 | + * dst : destination storage path |
636 | 637 | * overwriteDest : do nothing and pass if an identical file exists at destination |
637 | 638 | */ |
638 | 639 | class ConcatenateFileOp extends FileOp { |
— | — | @@ -640,9 +641,9 @@ |
641 | 642 | protected function doPrecheck( array &$predicates ) { |
642 | 643 | $status = Status::newGood(); |
643 | 644 | // Check if destination file exists |
644 | | - if ( $this->fileExists( $this->params['dest'], $predicates ) ) { |
| 645 | + if ( $this->fileExists( $this->params['dst'], $predicates ) ) { |
645 | 646 | if ( empty( $this->params['overwriteDest'] ) ) { |
646 | | - $status->fatal( 'backend-fail-alreadyexists', $this->params['dest'] ); |
| 647 | + $status->fatal( 'backend-fail-alreadyexists', $this->params['dst'] ); |
647 | 648 | return $status; |
648 | 649 | } |
649 | 650 | } else { |
— | — | @@ -656,7 +657,7 @@ |
657 | 658 | } |
658 | 659 | } |
659 | 660 | // Update file existence predicates |
660 | | - $predicates['exists'][$this->params['dest']] = true; |
| 661 | + $predicates['exists'][$this->params['dst']] = true; |
661 | 662 | return $status; |
662 | 663 | } |
663 | 664 | |
— | — | @@ -676,7 +677,7 @@ |
677 | 678 | |
678 | 679 | protected function doRevert() { |
679 | 680 | // Remove the file saved to the destination |
680 | | - $params = array( 'source' => $this->params['dest'] ); |
| 681 | + $params = array( 'src' => $this->params['dst'] ); |
681 | 682 | $status = $this->backend->delete( $params ); |
682 | 683 | if ( !$status->isOK() ) { |
683 | 684 | return $status; // also can't restore any dest file |
— | — | @@ -691,14 +692,14 @@ |
692 | 693 | } |
693 | 694 | |
694 | 695 | function storagePathsUsed() { |
695 | | - return array_merge( $this->params['sources'], $this->params['dest'] ); |
| 696 | + return array_merge( $this->params['sources'], $this->params['dst'] ); |
696 | 697 | } |
697 | 698 | } |
698 | 699 | |
699 | 700 | /** |
700 | 701 | * Delete a file at the storage path. |
701 | 702 | * Parameters similar to FileBackend::delete(), which include: |
702 | | - * source : source storage path |
| 703 | + * src : source storage path |
703 | 704 | * ignoreMissingSource : don't return an error if the file does not exist |
704 | 705 | */ |
705 | 706 | class DeleteFileOp extends FileOp { |
— | — | @@ -707,15 +708,15 @@ |
708 | 709 | protected function doPrecheck( array &$predicates ) { |
709 | 710 | $status = Status::newGood(); |
710 | 711 | // Check if the source file exists |
711 | | - if ( !$this->fileExists( $this->params['source'], $predicates ) ) { |
| 712 | + if ( !$this->fileExists( $this->params['src'], $predicates ) ) { |
712 | 713 | if ( empty( $this->params['ignoreMissingSource'] ) ) { |
713 | | - $status->fatal( 'backend-fail-notexists', $this->params['source'] ); |
| 714 | + $status->fatal( 'backend-fail-notexists', $this->params['src'] ); |
714 | 715 | return $status; |
715 | 716 | } |
716 | 717 | $this->needsDelete = false; |
717 | 718 | } |
718 | 719 | // Update file existence predicates |
719 | | - $predicates['exists'][$this->params['source']] = false; |
| 720 | + $predicates['exists'][$this->params['src']] = false; |
720 | 721 | return $status; |
721 | 722 | } |
722 | 723 | |
— | — | @@ -742,7 +743,7 @@ |
743 | 744 | } |
744 | 745 | |
745 | 746 | function storagePathsUsed() { |
746 | | - return array( $this->params['source'] ); |
| 747 | + return array( $this->params['src'] ); |
747 | 748 | } |
748 | 749 | } |
749 | 750 | |
Index: branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php |
— | — | @@ -37,9 +37,9 @@ |
38 | 38 | function store( array $params ) { |
39 | 39 | $status = Status::newGood(); |
40 | 40 | |
41 | | - list( $c, $dest ) = $this->resolveStoragePath( $params['dest'] ); |
| 41 | + list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] ); |
42 | 42 | if ( $dest === null ) { |
43 | | - $status->fatal( 'backend-fail-invalidpath', $params['dest'] ); |
| 43 | + $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); |
44 | 44 | return $status; |
45 | 45 | } |
46 | 46 | if ( is_file( $dest ) ) { |
— | — | @@ -48,25 +48,25 @@ |
49 | 49 | $ok = unlink( $dest ); |
50 | 50 | wfRestoreWarnings(); |
51 | 51 | if ( !$ok ) { |
52 | | - $status->fatal( 'backend-fail-delete', $params['dest'] ); |
| 52 | + $status->fatal( 'backend-fail-delete', $params['dst'] ); |
53 | 53 | return $status; |
54 | 54 | } |
55 | 55 | } else { |
56 | | - $status->fatal( 'backend-fail-alreadyexists', $params['dest'] ); |
| 56 | + $status->fatal( 'backend-fail-alreadyexists', $params['dst'] ); |
57 | 57 | return $status; |
58 | 58 | } |
59 | 59 | } else { |
60 | 60 | if ( !wfMkdirParents( dirname( $dest ) ) ) { |
61 | | - $status->fatal( 'directorycreateerror', $param['dest'] ); |
| 61 | + $status->fatal( 'directorycreateerror', $param['dst'] ); |
62 | 62 | return $status; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | wfSuppressWarnings(); |
67 | | - $ok = copy( $params['source'], $dest ); |
| 67 | + $ok = copy( $params['src'], $dest ); |
68 | 68 | wfRestoreWarnings(); |
69 | 69 | if ( !$ok ) { |
70 | | - $status->fatal( 'backend-fail-copy', $params['source'], $params['dest'] ); |
| 70 | + $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] ); |
71 | 71 | return $status; |
72 | 72 | } |
73 | 73 | |
— | — | @@ -78,12 +78,12 @@ |
79 | 79 | function copy( array $params ) { |
80 | 80 | $status = Status::newGood(); |
81 | 81 | |
82 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 82 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
83 | 83 | if ( $source === null ) { |
84 | | - $status->fatal( 'backend-fail-invalidpath', $params['source'] ); |
| 84 | + $status->fatal( 'backend-fail-invalidpath', $params['src'] ); |
85 | 85 | return $status; |
86 | 86 | } |
87 | | - $params['source'] = $source; // resolve source to FS path |
| 87 | + $params['src'] = $source; // resolve source to FS path |
88 | 88 | |
89 | 89 | return $this->store( $params ); // both source and dest are on FS |
90 | 90 | } |
— | — | @@ -95,14 +95,14 @@ |
96 | 96 | function move( array $params ) { |
97 | 97 | $status = Status::newGood(); |
98 | 98 | |
99 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 99 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
100 | 100 | if ( $source === null ) { |
101 | | - $status->fatal( 'backend-fail-invalidpath', $params['source'] ); |
| 101 | + $status->fatal( 'backend-fail-invalidpath', $params['src'] ); |
102 | 102 | return $status; |
103 | 103 | } |
104 | | - list( $c, $dest ) = $this->resolveStoragePath( $params['dest'] ); |
| 104 | + list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] ); |
105 | 105 | if ( $dest === null ) { |
106 | | - $status->fatal( 'backend-fail-invalidpath', $params['dest'] ); |
| 106 | + $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); |
107 | 107 | return $status; |
108 | 108 | } |
109 | 109 | |
— | — | @@ -114,17 +114,17 @@ |
115 | 115 | $ok = unlink( $dest ); |
116 | 116 | wfRestoreWarnings(); |
117 | 117 | if ( !$ok ) { |
118 | | - $status->fatal( 'backend-fail-delete', $params['dest'] ); |
| 118 | + $status->fatal( 'backend-fail-delete', $params['dst'] ); |
119 | 119 | return $status; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | } else { |
123 | | - $status->fatal( 'backend-fail-alreadyexists', $params['dest'] ); |
| 123 | + $status->fatal( 'backend-fail-alreadyexists', $params['dst'] ); |
124 | 124 | return $status; |
125 | 125 | } |
126 | 126 | } else { |
127 | 127 | if ( !wfMkdirParents( dirname( $dest ) ) ) { |
128 | | - $status->fatal( 'directorycreateerror', $param['dest'] ); |
| 128 | + $status->fatal( 'directorycreateerror', $param['dst'] ); |
129 | 129 | return $status; |
130 | 130 | } |
131 | 131 | } |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | clearstatcache(); // file no longer at source |
136 | 136 | wfRestoreWarnings(); |
137 | 137 | if ( !$ok ) { |
138 | | - $status->fatal( 'backend-fail-move', $params['source'], $params['dest'] ); |
| 138 | + $status->fatal( 'backend-fail-move', $params['src'], $params['dst'] ); |
139 | 139 | return $status; |
140 | 140 | } |
141 | 141 | |
— | — | @@ -144,15 +144,15 @@ |
145 | 145 | function delete( array $params ) { |
146 | 146 | $status = Status::newGood(); |
147 | 147 | |
148 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 148 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
149 | 149 | if ( $source === null ) { |
150 | | - $status->fatal( 'backend-fail-invalidpath', $params['source'] ); |
| 150 | + $status->fatal( 'backend-fail-invalidpath', $params['src'] ); |
151 | 151 | return $status; |
152 | 152 | } |
153 | 153 | |
154 | 154 | if ( !is_file( $source ) ) { |
155 | 155 | if ( empty( $params['ignoreMissingSource'] ) ) { |
156 | | - $status->fatal( 'backend-fail-delete', $params['source'] ); |
| 156 | + $status->fatal( 'backend-fail-delete', $params['src'] ); |
157 | 157 | } |
158 | 158 | return $status; // do nothing; either OK or bad status |
159 | 159 | } |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | $ok = unlink( $source ); |
163 | 163 | wfRestoreWarnings(); |
164 | 164 | if ( !$ok ) { |
165 | | - $status->fatal( 'backend-fail-delete', $params['source'] ); |
| 165 | + $status->fatal( 'backend-fail-delete', $params['src'] ); |
166 | 166 | return $status; |
167 | 167 | } |
168 | 168 | |
— | — | @@ -171,16 +171,16 @@ |
172 | 172 | function concatenate( array $params ) { |
173 | 173 | $status = Status::newGood(); |
174 | 174 | |
175 | | - list( $c, $dest ) = $this->resolveStoragePath( $params['dest'] ); |
| 175 | + list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] ); |
176 | 176 | if ( $dest === null ) { |
177 | | - $status->fatal( 'backend-fail-invalidpath', $params['dest'] ); |
| 177 | + $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); |
178 | 178 | return $status; |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Check if the destination file exists and we can't handle that |
182 | 182 | $destExists = file_exists( $dest ); |
183 | 183 | if ( $destExists && empty( $params['overwriteDest'] ) ) { |
184 | | - $status->fatal( 'backend-fail-alreadyexists', $params['dest'] ); |
| 184 | + $status->fatal( 'backend-fail-alreadyexists', $params['dst'] ); |
185 | 185 | return $status; |
186 | 186 | } |
187 | 187 | |
— | — | @@ -235,14 +235,14 @@ |
236 | 236 | $ok = unlink( $dest ); |
237 | 237 | wfRestoreWarnings(); |
238 | 238 | if ( !$ok ) { |
239 | | - $status->fatal( 'backend-fail-delete', $params['dest'] ); |
| 239 | + $status->fatal( 'backend-fail-delete', $params['dst'] ); |
240 | 240 | return $status; |
241 | 241 | } |
242 | 242 | } |
243 | 243 | } else { |
244 | 244 | // Make sure destination directory exists |
245 | 245 | if ( !wfMkdirParents( dirname( $dest ) ) ) { |
246 | | - $status->fatal( 'directorycreateerror', $param['dest'] ); |
| 246 | + $status->fatal( 'directorycreateerror', $param['dst'] ); |
247 | 247 | return $status; |
248 | 248 | } |
249 | 249 | } |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | $ok = rename( $tmpPath, $dest ); |
254 | 254 | wfRestoreWarnings(); |
255 | 255 | if ( !$ok ) { |
256 | | - $status->fatal( 'backend-fail-move', $tmpPath, $params['dest'] ); |
| 256 | + $status->fatal( 'backend-fail-move', $tmpPath, $params['dst'] ); |
257 | 257 | return $status; |
258 | 258 | } |
259 | 259 | |
— | — | @@ -264,9 +264,9 @@ |
265 | 265 | function create( array $params ) { |
266 | 266 | $status = Status::newGood(); |
267 | 267 | |
268 | | - list( $c, $dest ) = $this->resolveStoragePath( $params['dest'] ); |
| 268 | + list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] ); |
269 | 269 | if ( $dest === null ) { |
270 | | - $status->fatal( 'backend-fail-invalidpath', $params['dest'] ); |
| 270 | + $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); |
271 | 271 | return $status; |
272 | 272 | } |
273 | 273 | |
— | — | @@ -276,16 +276,16 @@ |
277 | 277 | $ok = unlink( $dest ); |
278 | 278 | wfRestoreWarnings(); |
279 | 279 | if ( !$ok ) { |
280 | | - $status->fatal( 'backend-fail-delete', $param['dest'] ); |
| 280 | + $status->fatal( 'backend-fail-delete', $param['dst'] ); |
281 | 281 | return $status; |
282 | 282 | } |
283 | 283 | } else { |
284 | | - $status->fatal( 'backend-fail-alreadyexists', $params['dest'] ); |
| 284 | + $status->fatal( 'backend-fail-alreadyexists', $params['dst'] ); |
285 | 285 | return $status; |
286 | 286 | } |
287 | 287 | } else { |
288 | 288 | if ( !wfMkdirParents( dirname( $dest ) ) ) { |
289 | | - $status->fatal( 'directorycreateerror', $param['dest'] ); |
| 289 | + $status->fatal( 'directorycreateerror', $param['dst'] ); |
290 | 290 | return $status; |
291 | 291 | } |
292 | 292 | } |
— | — | @@ -294,7 +294,7 @@ |
295 | 295 | $ok = file_put_contents( $dest, $params['content'] ); |
296 | 296 | wfRestoreWarnings(); |
297 | 297 | if ( !$ok ) { |
298 | | - $status->fatal( 'backend-fail-create', $params['dest'] ); |
| 298 | + $status->fatal( 'backend-fail-create', $params['dst'] ); |
299 | 299 | return $status; |
300 | 300 | } |
301 | 301 | |
— | — | @@ -305,19 +305,19 @@ |
306 | 306 | |
307 | 307 | function prepare( array $params ) { |
308 | 308 | $status = Status::newGood(); |
309 | | - list( $c, $dir ) = $this->resolveStoragePath( $params['directory'] ); |
| 309 | + list( $c, $dir ) = $this->resolveStoragePath( $params['dir'] ); |
310 | 310 | if ( $dir === null ) { |
311 | | - $status->fatal( 'backend-fail-invalidpath', $params['directory'] ); |
| 311 | + $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); |
312 | 312 | return $status; // invalid storage path |
313 | 313 | } |
314 | 314 | if ( !wfMkdirParents( $dir ) ) { |
315 | | - $status->fatal( 'directorycreateerror', $param['directory'] ); |
| 315 | + $status->fatal( 'directorycreateerror', $param['dir'] ); |
316 | 316 | return $status; |
317 | 317 | } elseif ( !is_writable( $dir ) ) { |
318 | | - $status->fatal( 'directoryreadonlyerror', $param['directory'] ); |
| 318 | + $status->fatal( 'directoryreadonlyerror', $param['dir'] ); |
319 | 319 | return $status; |
320 | 320 | } elseif ( !is_readable( $dir ) ) { |
321 | | - $status->fatal( 'directorynotreadableerror', $param['directory'] ); |
| 321 | + $status->fatal( 'directorynotreadableerror', $param['dir'] ); |
322 | 322 | return $status; |
323 | 323 | } |
324 | 324 | return $status; |
— | — | @@ -325,13 +325,13 @@ |
326 | 326 | |
327 | 327 | function secure( array $params ) { |
328 | 328 | $status = Status::newGood(); |
329 | | - list( $c, $dir ) = $this->resolveStoragePath( $params['directory'] ); |
| 329 | + list( $c, $dir ) = $this->resolveStoragePath( $params['dir'] ); |
330 | 330 | if ( $dir === null ) { |
331 | | - $status->fatal( 'backend-fail-invalidpath', $params['directory'] ); |
| 331 | + $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); |
332 | 332 | return $status; // invalid storage path |
333 | 333 | } |
334 | 334 | if ( !wfMkdirParents( $dir ) ) { |
335 | | - $status->fatal( 'directorycreateerror', $param['directory'] ); |
| 335 | + $status->fatal( 'directorycreateerror', $param['dir'] ); |
336 | 336 | return $status; |
337 | 337 | } |
338 | 338 | // Add a .htaccess file to the root of the deleted zone |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | $ok = file_put_contents( "{$dir}/.htaccess", "Deny from all\n" ); |
342 | 342 | wfRestoreWarnings(); |
343 | 343 | if ( !$ok ) { |
344 | | - $status->fatal( 'backend-fail-create', $params['directory'] . '/.htaccess' ); |
| 344 | + $status->fatal( 'backend-fail-create', $params['dir'] . '/.htaccess' ); |
345 | 345 | return $status; |
346 | 346 | } |
347 | 347 | } |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | $ok = file_put_contents( "{$dir}/index.html", '' ); |
352 | 352 | wfRestoreWarnings(); |
353 | 353 | if ( !$ok ) { |
354 | | - $status->fatal( 'backend-fail-create', $params['dest'] . '/index.html' ); |
| 354 | + $status->fatal( 'backend-fail-create', $params['dst'] . '/index.html' ); |
355 | 355 | return $status; |
356 | 356 | } |
357 | 357 | } |
— | — | @@ -359,9 +359,9 @@ |
360 | 360 | |
361 | 361 | function clean( array $params ) { |
362 | 362 | $status = Status::newGood(); |
363 | | - list( $c, $dir ) = $this->resolveStoragePath( $params['directory'] ); |
| 363 | + list( $c, $dir ) = $this->resolveStoragePath( $params['dir'] ); |
364 | 364 | if ( $dir === null ) { |
365 | | - $status->fatal( 'backend-fail-invalidpath', $params['directory'] ); |
| 365 | + $status->fatal( 'backend-fail-invalidpath', $params['dir'] ); |
366 | 366 | return $status; // invalid storage path |
367 | 367 | } |
368 | 368 | wfSuppressWarnings(); |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | } |
375 | 375 | |
376 | 376 | function fileExists( array $params ) { |
377 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 377 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
378 | 378 | if ( $source === null ) { |
379 | 379 | return false; // invalid storage path |
380 | 380 | } |
— | — | @@ -385,7 +385,7 @@ |
386 | 386 | } |
387 | 387 | |
388 | 388 | function getFileHash( array $params ) { |
389 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 389 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
390 | 390 | if ( $source === null ) { |
391 | 391 | return false; // invalid storage path |
392 | 392 | } |
— | — | @@ -393,7 +393,7 @@ |
394 | 394 | } |
395 | 395 | |
396 | 396 | function getFileTimestamp( array $params ) { |
397 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 397 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
398 | 398 | if ( $source === null ) { |
399 | 399 | return false; // invalid storage path |
400 | 400 | } |
— | — | @@ -402,7 +402,7 @@ |
403 | 403 | } |
404 | 404 | |
405 | 405 | function getFileProps( array $params ) { |
406 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 406 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
407 | 407 | if ( $source === null ) { |
408 | 408 | return FSFile::placeholderProps(); // invalid storage path |
409 | 409 | } |
— | — | @@ -411,7 +411,7 @@ |
412 | 412 | } |
413 | 413 | |
414 | 414 | function getFileList( array $params ) { |
415 | | - list( $c, $dir ) = $this->resolveStoragePath( $params['directory'] ); |
| 415 | + list( $c, $dir ) = $this->resolveStoragePath( $params['dir'] ); |
416 | 416 | if ( $dir === null ) { // invalid storage path |
417 | 417 | return array(); // empty result |
418 | 418 | } |
— | — | @@ -421,15 +421,15 @@ |
422 | 422 | function streamFile( array $params ) { |
423 | 423 | $status = Status::newGood(); |
424 | 424 | |
425 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 425 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
426 | 426 | if ( $source === null ) { |
427 | | - $status->fatal( 'backend-fail-invalidpath', $params['source'] ); |
| 427 | + $status->fatal( 'backend-fail-invalidpath', $params['src'] ); |
428 | 428 | return $status; |
429 | 429 | } |
430 | 430 | |
431 | 431 | $ok = StreamFile::stream( $source, array(), false ); |
432 | 432 | if ( !$ok ) { |
433 | | - $status->fatal( 'backend-fail-stream', $params['source'] ); |
| 433 | + $status->fatal( 'backend-fail-stream', $params['src'] ); |
434 | 434 | return $status; |
435 | 435 | } |
436 | 436 | |
— | — | @@ -437,7 +437,7 @@ |
438 | 438 | } |
439 | 439 | |
440 | 440 | function getLocalCopy( array $params ) { |
441 | | - list( $c, $source ) = $this->resolveStoragePath( $params['source'] ); |
| 441 | + list( $c, $source ) = $this->resolveStoragePath( $params['src'] ); |
442 | 442 | if ( $source === null ) { |
443 | 443 | return null; |
444 | 444 | } |
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -68,9 +68,9 @@ |
69 | 69 | * <code> |
70 | 70 | * $ops = array( |
71 | 71 | * array( |
72 | | - * 'op' => 'store', |
73 | | - * 'source' => '/tmp/uploads/picture.png', |
74 | | - * 'dest' => 'mwstore://container/uploadedFilename.png' |
| 72 | + * 'op' => 'store', |
| 73 | + * 'src' => '/tmp/uploads/picture.png', |
| 74 | + * 'dst' => 'mwstore://container/uploadedFilename.png' |
75 | 75 | * ) |
76 | 76 | * ); |
77 | 77 | * </code> |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | * that don't yet exists or, on FS backends, create parent directories. |
99 | 99 | * Do not call this function from places outside FileBackend and FileOp. |
100 | 100 | * $params include: |
101 | | - * directory : storage directory |
| 101 | + * dir : storage directory |
102 | 102 | * |
103 | 103 | * @param Array $params |
104 | 104 | * @return Status |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | * This is not guaranteed to actually do anything. |
111 | 111 | * Do not call this function from places outside FileBackend and FileOp. |
112 | 112 | * $params include: |
113 | | - * directory : storage directory |
| 113 | + * dir : storage directory |
114 | 114 | * noAccess : try to deny file access |
115 | 115 | * noListing : try to deny file listing |
116 | 116 | * |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | * On FS backends, the directory will be deleted. Others may do nothing. |
125 | 125 | * Do not call this function from places outside FileBackend and FileOp. |
126 | 126 | * $params include: |
127 | | - * directory : storage directory |
| 127 | + * dir : storage directory |
128 | 128 | * |
129 | 129 | * @param Array $params |
130 | 130 | * @return Status |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | * Check if a file exits at a storage path in the backend. |
136 | 136 | * Do not call this function from places outside FileBackend and FileOp. |
137 | 137 | * $params include: |
138 | | - * source : source storage path |
| 138 | + * src : source storage path |
139 | 139 | * |
140 | 140 | * @param Array $params |
141 | 141 | * @return bool |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | * Get a hash of the file at a storage path in the backend. |
147 | 147 | * Typically this will be a SHA-1 hash, MD5 hash, or something similar. |
148 | 148 | * $params include: |
149 | | - * source : source storage path |
| 149 | + * src : source storage path |
150 | 150 | * |
151 | 151 | * @param Array $params |
152 | 152 | * @return string|false Hash string or false on failure |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | /** |
164 | 164 | * Get the last-modified timestamp of the file at a storage path. |
165 | 165 | * $params include: |
166 | | - * source : source storage path |
| 166 | + * src : source storage path |
167 | 167 | * |
168 | 168 | * @param Array $params |
169 | 169 | * @return string|false TS_MW timestamp or false on failure |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | * Get the properties of the file at a storage path in the backend. |
175 | 175 | * Returns FSFile::placeholderProps() on failure. |
176 | 176 | * $params include: |
177 | | - * source : source storage path |
| 177 | + * src : source storage path |
178 | 178 | * |
179 | 179 | * @param Array $params |
180 | 180 | * @return Array |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | * must be sent if streaming began, while none should be sent otherwise. |
188 | 188 | * Implementations should flush the output buffer before sending data. |
189 | 189 | * $params include: |
190 | | - * source : source storage path |
| 190 | + * src : source storage path |
191 | 191 | * |
192 | 192 | * @param Array $params |
193 | 193 | * @return Status |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | * then all items under that container directory should be listed. |
202 | 202 | * Results should be storage paths relative to the given directory. |
203 | 203 | * $params include: |
204 | | - * directory : storage path directory. |
| 204 | + * dir : storage path directory. |
205 | 205 | * |
206 | 206 | * @return Iterator|Array |
207 | 207 | */ |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | * Get a local copy on disk of the file at a storage path in the backend. |
212 | 212 | * The temporary copy should have the same file extension as the source. |
213 | 213 | * $params include: |
214 | | - * source : source storage path |
| 214 | + * src : source storage path |
215 | 215 | * |
216 | 216 | * @param Array $params |
217 | 217 | * @return TempFSFile|null Temporary file or null on failure |
— | — | @@ -253,8 +253,8 @@ |
254 | 254 | * Store a file into the backend from a file on disk. |
255 | 255 | * Do not call this function from places outside FileBackend and FileOp. |
256 | 256 | * $params include: |
257 | | - * source : source path on disk |
258 | | - * dest : destination storage path |
| 257 | + * src : source path on disk |
| 258 | + * dst : destination storage path |
259 | 259 | * overwriteDest : do nothing and pass if an identical file exists at destination |
260 | 260 | * |
261 | 261 | * @param Array $params |
— | — | @@ -266,8 +266,8 @@ |
267 | 267 | * Copy a file from one storage path to another in the backend. |
268 | 268 | * Do not call this function from places outside FileBackend and FileOp. |
269 | 269 | * $params include: |
270 | | - * source : source storage path |
271 | | - * dest : destination storage path |
| 270 | + * src : source storage path |
| 271 | + * dst : destination storage path |
272 | 272 | * overwriteDest : do nothing and pass if an identical file exists at destination |
273 | 273 | * |
274 | 274 | * @param Array $params |
— | — | @@ -280,8 +280,8 @@ |
281 | 281 | * This can be left as a dummy function as long as hasMove() returns false. |
282 | 282 | * Do not call this function from places outside FileBackend and FileOp. |
283 | 283 | * $params include: |
284 | | - * source : source storage path |
285 | | - * dest : destination storage path |
| 284 | + * src : source storage path |
| 285 | + * dst : destination storage path |
286 | 286 | * overwriteDest : do nothing and pass if an identical file exists at destination |
287 | 287 | * |
288 | 288 | * @param Array $params |
— | — | @@ -295,7 +295,7 @@ |
296 | 296 | * Delete a file at the storage path. |
297 | 297 | * Do not call this function from places outside FileBackend and FileOp. |
298 | 298 | * $params include: |
299 | | - * source : source storage path |
| 299 | + * src : source storage path |
300 | 300 | * |
301 | 301 | * @param Array $params |
302 | 302 | * @return Status |
— | — | @@ -306,8 +306,8 @@ |
307 | 307 | * Combines files from severals storage paths into a new file in the backend. |
308 | 308 | * Do not call this function from places outside FileBackend and FileOp. |
309 | 309 | * $params include: |
310 | | - * source : source storage path |
311 | | - * dest : destination storage path |
| 310 | + * src : source storage path |
| 311 | + * dst : destination storage path |
312 | 312 | * overwriteDest : do nothing and pass if an identical file exists at destination |
313 | 313 | * |
314 | 314 | * @param Array $params |
— | — | @@ -320,7 +320,7 @@ |
321 | 321 | * Do not call this function from places outside FileBackend and FileOp. |
322 | 322 | * $params include: |
323 | 323 | * contents : the raw file contents |
324 | | - * dest : destination storage path |
| 324 | + * dst : destination storage path |
325 | 325 | * overwriteDest : do nothing and pass if an identical file exists at destination |
326 | 326 | * |
327 | 327 | * @param Array $params |
— | — | @@ -346,8 +346,8 @@ |
347 | 347 | * For example, moving objects accross containers may not be supported. |
348 | 348 | * Do not call this function from places outside FileBackend and FileOp. |
349 | 349 | * $params include: |
350 | | - * source : source storage path |
351 | | - * dest : destination storage path |
| 350 | + * src : source storage path |
| 351 | + * dst : destination storage path |
352 | 352 | * |
353 | 353 | * @param Array $params |
354 | 354 | * @return bool |
Index: branches/FileBackend/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | if ( $doZones && !in_array( $zone, $doZones ) ) { |
118 | 118 | continue; |
119 | 119 | } |
120 | | - $params = array( 'directory' => $this->getZonePath( $zone ) ); |
| 120 | + $params = array( 'dir' => $this->getZonePath( $zone ) ); |
121 | 121 | $status->merge( $this->backend->prepare( $params ) ); |
122 | 122 | } |
123 | 123 | return $status; |
— | — | @@ -131,9 +131,9 @@ |
132 | 132 | protected function initDeletedDir( $dir ) { |
133 | 133 | // Add a .htaccess file to the root of the deleted zone |
134 | 134 | $root = $this->getZonePath( 'deleted' ); |
135 | | - $this->backend->secure( array( 'directory' => $root, 'noAccess' => true ) ); |
| 135 | + $this->backend->secure( array( 'dir' => $root, 'noAccess' => true ) ); |
136 | 136 | // Seed new directories with a blank index.html, to prevent crawling |
137 | | - $this->backend->secure( array( 'directory' => $dir, 'noListing' => true ) ); |
| 137 | + $this->backend->secure( array( 'dir' => $dir, 'noListing' => true ) ); |
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
— | — | @@ -656,7 +656,7 @@ |
657 | 657 | $dstDir = dirname( $dstPath ); |
658 | 658 | |
659 | 659 | // Create destination directories for this triplet |
660 | | - if ( !$backend->prepare( array( 'directory' => $dstDir ) )->isOK() ) { |
| 660 | + if ( !$backend->prepare( array( 'dir' => $dstDir ) )->isOK() ) { |
661 | 661 | return $this->newFatal( 'directorycreateerror', $dstDir ); |
662 | 662 | } |
663 | 663 | |
— | — | @@ -680,8 +680,8 @@ |
681 | 681 | } |
682 | 682 | $operations[] = array( |
683 | 683 | 'op' => $opName, |
684 | | - 'source' => $srcPath, |
685 | | - 'dest' => $dstPath, |
| 684 | + 'src' => $srcPath, |
| 685 | + 'dst' => $dstPath, |
686 | 686 | 'overwriteDest' => $flags & self::OVERWRITE, |
687 | 687 | 'overwriteSame' => $flags & self::OVERWRITE_SAME, |
688 | 688 | 'ignoreErrors' => true |
— | — | @@ -730,7 +730,7 @@ |
731 | 731 | if ( FileBackend::isStoragePath( $path ) ) { |
732 | 732 | $operations[] = array( |
733 | 733 | 'op' => 'delete', |
734 | | - 'source' => $path, |
| 734 | + 'src' => $path, |
735 | 735 | 'ignoreErrors' => true |
736 | 736 | ); |
737 | 737 | } else { |
— | — | @@ -780,7 +780,7 @@ |
781 | 781 | return false; |
782 | 782 | } |
783 | 783 | $path = $this->resolveVirtualUrl( $virtualUrl ); |
784 | | - $op = array( 'op' => 'delete', 'source' => $path ); |
| 784 | + $op = array( 'op' => 'delete', 'src' => $path ); |
785 | 785 | $status = $this->backend->doOperation( $op ); |
786 | 786 | return $status->isOK(); |
787 | 787 | } |
— | — | @@ -854,28 +854,28 @@ |
855 | 855 | $dstDir = dirname( $dstPath ); |
856 | 856 | $archiveDir = dirname( $archivePath ); |
857 | 857 | // Abort immediately on directory creation errors since they're likely to be repetitive |
858 | | - if ( !$backend->prepare( array( 'directory' => $dstDir ) )->isOK() ) { |
| 858 | + if ( !$backend->prepare( array( 'dir' => $dstDir ) )->isOK() ) { |
859 | 859 | return $this->newFatal( 'directorycreateerror', $dstDir ); |
860 | 860 | } |
861 | | - if ( !$backend->prepare( array( 'directory' => $archiveDir ) )->isOK() ) { |
| 861 | + if ( !$backend->prepare( array( 'dir' => $archiveDir ) )->isOK() ) { |
862 | 862 | return $this->newFatal( 'directorycreateerror', $archiveDir ); |
863 | 863 | } |
864 | 864 | |
865 | 865 | // Archive destination file if it exists |
866 | | - if ( $backend->fileExists( array( 'source' => $dstPath ) ) ) { |
| 866 | + if ( $backend->fileExists( array( 'src' => $dstPath ) ) ) { |
867 | 867 | // Check if the archive file exists |
868 | 868 | // This is a sanity check to avoid data loss. In UNIX, the rename primitive |
869 | 869 | // unlinks the destination file if it exists. DB-based synchronisation in |
870 | 870 | // publishBatch's caller should prevent races. In Windows there's no |
871 | 871 | // problem because the rename primitive fails if the destination exists. |
872 | | - if ( $backend->fileExists( array( 'source' => $archivePath ) ) ) { |
| 872 | + if ( $backend->fileExists( array( 'src' => $archivePath ) ) ) { |
873 | 873 | $operations[] = array( 'op' => 'null' ); |
874 | 874 | continue; |
875 | 875 | } else { |
876 | 876 | $operations[] = array( |
877 | 877 | 'op' => 'move', |
878 | | - 'source' => $dstPath, |
879 | | - 'dest' => $archivePath, |
| 878 | + 'src' => $dstPath, |
| 879 | + 'dst' => $archivePath, |
880 | 880 | 'ignoreErrors' => true |
881 | 881 | ); |
882 | 882 | } |
— | — | @@ -888,23 +888,23 @@ |
889 | 889 | if ( $flags & self::DELETE_SOURCE ) { |
890 | 890 | $operations[] = array( |
891 | 891 | 'op' => 'move', |
892 | | - 'source' => $srcPath, |
893 | | - 'dest' => $dstPath, |
| 892 | + 'src' => $srcPath, |
| 893 | + 'dst' => $dstPath, |
894 | 894 | 'ignoreErrors' => true |
895 | 895 | ); |
896 | 896 | } else { |
897 | 897 | $operations[] = array( |
898 | 898 | 'op' => 'copy', |
899 | | - 'source' => $srcPath, |
900 | | - 'dest' => $dstPath, |
| 899 | + 'src' => $srcPath, |
| 900 | + 'dst' => $dstPath, |
901 | 901 | 'ignoreErrors' => true |
902 | 902 | ); |
903 | 903 | } |
904 | 904 | } else { // FS source path |
905 | 905 | $operations[] = array( |
906 | 906 | 'op' => 'store', |
907 | | - 'source' => $srcPath, |
908 | | - 'dest' => $dstPath, |
| 907 | + 'src' => $srcPath, |
| 908 | + 'dst' => $dstPath, |
909 | 909 | 'ignoreErrors' => true |
910 | 910 | ); |
911 | 911 | if ( $flags & self::DELETE_SOURCE ) { |
— | — | @@ -956,7 +956,7 @@ |
957 | 957 | $file = $this->resolveVirtualUrl( $file ); |
958 | 958 | } |
959 | 959 | if ( FileBackend::isStoragePath( $file ) ) { |
960 | | - $result[$key] = $this->backend->fileExists( array( 'source' => $file ) ); |
| 960 | + $result[$key] = $this->backend->fileExists( array( 'src' => $file ) ); |
961 | 961 | } else { |
962 | 962 | if ( $flags & self::FILES_ONLY ) { |
963 | 963 | $result[$key] = is_file( $file ); // FS only |
— | — | @@ -1033,21 +1033,21 @@ |
1034 | 1034 | $archiveDir = dirname( $archivePath ); // does not touch FS |
1035 | 1035 | |
1036 | 1036 | // Create destination directories |
1037 | | - if ( !$backend->prepare( array( 'directory' => $archiveDir ) )->isOK() ) { |
| 1037 | + if ( !$backend->prepare( array( 'dir' => $archiveDir ) )->isOK() ) { |
1038 | 1038 | return $this->newFatal( 'directorycreateerror', $archiveDir ); |
1039 | 1039 | } |
1040 | 1040 | $this->initDeletedDir( $archiveDir ); |
1041 | 1041 | |
1042 | | - if ( $backend->fileExists( array( 'source' => $archivePath ) ) ) { |
| 1042 | + if ( $backend->fileExists( array( 'src' => $archivePath ) ) ) { |
1043 | 1043 | $operations[] = array( |
1044 | | - 'op' => 'delete', |
1045 | | - 'source' => $srcPath |
| 1044 | + 'op' => 'delete', |
| 1045 | + 'src' => $srcPath |
1046 | 1046 | ); |
1047 | 1047 | } else { |
1048 | 1048 | $operations[] = array( |
1049 | | - 'op' => 'move', |
1050 | | - 'source' => $srcPath, |
1051 | | - 'dest' => $archivePath |
| 1049 | + 'op' => 'move', |
| 1050 | + 'src' => $srcPath, |
| 1051 | + 'dst' => $archivePath |
1052 | 1052 | ); |
1053 | 1053 | } |
1054 | 1054 | } |
— | — | @@ -1096,7 +1096,7 @@ |
1097 | 1097 | */ |
1098 | 1098 | public function getLocalCopy( $virtualUrl ) { |
1099 | 1099 | $path = $this->resolveToStoragePath( $virtualUrl ); |
1100 | | - return $this->backend->getLocalCopy( array( 'source' => $path ) ); |
| 1100 | + return $this->backend->getLocalCopy( array( 'src' => $path ) ); |
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | /** |
— | — | @@ -1108,7 +1108,7 @@ |
1109 | 1109 | */ |
1110 | 1110 | public function getFileProps( $virtualUrl ) { |
1111 | 1111 | $path = $this->resolveToStoragePath( $virtualUrl ); |
1112 | | - return $this->backend->getFileProps( array( 'source' => $path ) ); |
| 1112 | + return $this->backend->getFileProps( array( 'src' => $path ) ); |
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | /** |
— | — | @@ -1119,7 +1119,7 @@ |
1120 | 1120 | */ |
1121 | 1121 | public function getFileTimestamp( $virtualUrl ) { |
1122 | 1122 | $path = $this->resolveToStoragePath( $virtualUrl ); |
1123 | | - return $this->backend->getFileTimestamp( array( 'source' => $path ) ); |
| 1123 | + return $this->backend->getFileTimestamp( array( 'src' => $path ) ); |
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | /** |
— | — | @@ -1130,7 +1130,7 @@ |
1131 | 1131 | */ |
1132 | 1132 | public function getFileSha1( $virtualUrl ) { |
1133 | 1133 | $path = $this->resolveToStoragePath( $virtualUrl ); |
1134 | | - $tmpFile = $this->backend->getLocalCopy( array( 'source' => $path ) ); |
| 1134 | + $tmpFile = $this->backend->getLocalCopy( array( 'src' => $path ) ); |
1135 | 1135 | if ( !$tmpFile ) { |
1136 | 1136 | return false; |
1137 | 1137 | } |
— | — | @@ -1166,7 +1166,7 @@ |
1167 | 1167 | for ( $hexPos = 0; $hexPos < $this->hashLevels; $hexPos++ ) { |
1168 | 1168 | $path .= '/' . substr( $hexString, 0, $hexPos + 1 ); |
1169 | 1169 | } |
1170 | | - $iterator = $this->backend->getFileList( array( 'directory' => $path ) ); |
| 1170 | + $iterator = $this->backend->getFileList( array( 'dir' => $path ) ); |
1171 | 1171 | foreach ( $iterator as $name ) { |
1172 | 1172 | // Each item returned is a public file |
1173 | 1173 | call_user_func( $callback, "{$path}/{$name}" ); |
Index: branches/FileBackend/phase3/includes/media/Generic.php |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | // Note: no file is created if it's to be rendered client-side. |
220 | 220 | if ( !$out->isError() && filesize( $tmpDest ) ) { |
221 | 221 | $op = array( 'op' => 'store', |
222 | | - 'source' => $tmpDest, 'dest' => $dstPath, 'overwriteDest' => true ); |
| 222 | + 'src' => $tmpDest, 'dst' => $dstPath, 'overwriteDest' => true ); |
223 | 223 | if ( !$image->getRepo()->getBackend()->doOperation( $op )->isOK() ) { |
224 | 224 | return new MediaTransformError( 'thumbnail_error', |
225 | 225 | $params['width'], 0, wfMsg( 'thumbnail-dest-create' ) ); |