Index: branches/FileBackend/phase3/includes/filerepo/backend/SwiftFileBackend.php |
— | — | @@ -33,10 +33,11 @@ |
34 | 34 | /** |
35 | 35 | * @see FileBackend::__construct() |
36 | 36 | * Additional $config params include: |
37 | | - * swiftAuthUrl : Swift authentication server URL |
38 | | - * swiftUser : Swift user used by MediaWiki |
39 | | - * swiftKey : Authentication key for the above user (used to get sessions) |
40 | | - * swiftProxyUser : Swift user used for end-user hits to proxy server |
| 37 | + * swiftAuthUrl : Swift authentication server URL |
| 38 | + * swiftUser : Swift user used by MediaWiki |
| 39 | + * swiftKey : Swift authentication key for the above user |
| 40 | + * swiftProxyUser : Swift user used for end-user hits to proxy server |
| 41 | + * shardViaHashLevels : Map of container names to the number of hash levels |
41 | 42 | */ |
42 | 43 | public function __construct( array $config ) { |
43 | 44 | parent::__construct( $config ); |
— | — | @@ -50,6 +51,9 @@ |
51 | 52 | $this->swiftProxyUser = isset( $config['swiftProxyUser'] ) |
52 | 53 | ? $config['swiftProxyUser'] |
53 | 54 | : ''; |
| 55 | + $this->shardViaHashLevels = isset( $config['shardViaHashLevels'] ) |
| 56 | + ? $config['shardViaHashLevels'] |
| 57 | + : ''; |
54 | 58 | } |
55 | 59 | |
56 | 60 | /** |
— | — | @@ -65,7 +69,7 @@ |
66 | 70 | /** |
67 | 71 | * @see FileBackend::doStoreInternal() |
68 | 72 | */ |
69 | | - function doStoreInternal( array $params ) { |
| 73 | + protected function doStoreInternal( array $params ) { |
70 | 74 | $status = Status::newGood(); |
71 | 75 | |
72 | 76 | list( $dstCont, $destRel ) = $this->resolveStoragePathReal( $params['dst'] ); |
— | — | @@ -136,7 +140,7 @@ |
137 | 141 | /** |
138 | 142 | * @see FileBackend::doCopyInternal() |
139 | 143 | */ |
140 | | - function doCopyInternal( array $params ) { |
| 144 | + protected function doCopyInternal( array $params ) { |
141 | 145 | $status = Status::newGood(); |
142 | 146 | |
143 | 147 | list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); |
— | — | @@ -211,7 +215,7 @@ |
212 | 216 | /** |
213 | 217 | * @see FileBackend::doDeleteInternal() |
214 | 218 | */ |
215 | | - function doDeleteInternal( array $params ) { |
| 219 | + protected function doDeleteInternal( array $params ) { |
216 | 220 | $status = Status::newGood(); |
217 | 221 | |
218 | 222 | list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); |
— | — | @@ -262,7 +266,7 @@ |
263 | 267 | /** |
264 | 268 | * @see FileBackend::doCopyInternal() |
265 | 269 | */ |
266 | | - function doCreateInternal( array $params ) { |
| 270 | + protected function doCreateInternal( array $params ) { |
267 | 271 | $status = Status::newGood(); |
268 | 272 | |
269 | 273 | list( $dstCont, $destRel ) = $this->resolveStoragePathReal( $params['dst'] ); |
— | — | @@ -331,7 +335,7 @@ |
332 | 336 | /** |
333 | 337 | * @see FileBackend::prepate() |
334 | 338 | */ |
335 | | - function doPrepare( $fullCont, $dir, array $params ) { |
| 339 | + protected function doPrepare( $fullCont, $dir, array $params ) { |
336 | 340 | $status = Status::newGood(); |
337 | 341 | |
338 | 342 | // (a) Get a swift proxy connection |
— | — | @@ -355,7 +359,7 @@ |
356 | 360 | /** |
357 | 361 | * @see FileBackend::secure() |
358 | 362 | */ |
359 | | - function doSecure( $fullCont, $dir, array $params ) { |
| 363 | + protected function doSecure( $fullCont, $dir, array $params ) { |
360 | 364 | $status = Status::newGood(); |
361 | 365 | // @TODO: restrict container from $this->swiftProxyUser |
362 | 366 | return $status; // badgers? We don't need no steenking badgers! |
— | — | @@ -364,7 +368,7 @@ |
365 | 369 | /** |
366 | 370 | * @see FileBackend::doFileExists() |
367 | 371 | */ |
368 | | - function doFileExists( array $params ) { |
| 372 | + protected function doFileExists( array $params ) { |
369 | 373 | list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); |
370 | 374 | if ( $srcRel === null ) { |
371 | 375 | return false; // invalid storage path |
— | — | @@ -394,7 +398,7 @@ |
395 | 399 | /** |
396 | 400 | * @see FileBackend::doGetFileTimestamp() |
397 | 401 | */ |
398 | | - function doGetFileTimestamp( array $params ) { |
| 402 | + protected function doGetFileTimestamp( array $params ) { |
399 | 403 | list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); |
400 | 404 | if ( $srcRel === null ) { |
401 | 405 | return false; // invalid storage path |
— | — | @@ -461,7 +465,7 @@ |
462 | 466 | /** |
463 | 467 | * @see FileBackend::getFileListInternal() |
464 | 468 | */ |
465 | | - function getFileListInternal( $fullCont, $dir, array $params ) { |
| 469 | + public function getFileListInternal( $fullCont, $dir, array $params ) { |
466 | 470 | return new SwiftFileIterator( $this, $fullCont, $dir ); |
467 | 471 | } |
468 | 472 | |
— | — | @@ -498,7 +502,7 @@ |
499 | 503 | /** |
500 | 504 | * @see FileBackend::getLocalCopy() |
501 | 505 | */ |
502 | | - function getLocalCopy( array $params ) { |
| 506 | + public function getLocalCopy( array $params ) { |
503 | 507 | list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); |
504 | 508 | if ( $srcRel === null ) { |
505 | 509 | return null; |