From a07136539221e41eeb63fdf09f273eb67fe2a526 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 13 Feb 2014 10:15:13 -0800 Subject: [PATCH] Tweaked generated paths for ExternalStoreMwstore * This improve the object store case (with B-Tree container listings and 2-level sharding set up). Change-Id: If75f51fb07cd5df0da455d4e6eafe06d69e8b941 --- includes/externalstore/ExternalStoreMwstore.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/externalstore/ExternalStoreMwstore.php b/includes/externalstore/ExternalStoreMwstore.php index f329b73477..89ac734517 100644 --- a/includes/externalstore/ExternalStoreMwstore.php +++ b/includes/externalstore/ExternalStoreMwstore.php @@ -84,8 +84,10 @@ class ExternalStoreMwstore extends ExternalStoreMedium { // Segregate items by wiki ID for the sake of bookkeeping $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : wfWikiID(); - $url = $be->getContainerStoragePath( 'data' ) . '/' . - rawurlencode( $wiki ) . "/{$rand[0]}/{$rand[1]}/{$rand[2]}/{$id}"; + $url = $be->getContainerStoragePath( 'data' ) . '/' . rawurlencode( $wiki ); + $url .= ( $be instanceof FSFileBackend ) + ? "/{$rand[0]}/{$rand[1]}/{$rand[2]}/{$id}" // keep directories small + : "/{$rand[0]}/{$rand[1]}/{$id}"; // container sharding is only 2-levels $be->prepare( array( 'dir' => dirname( $url ), 'noAccess' => 1, 'noListing' => 1 ) ); if ( $be->create( array( 'dst' => $url, 'content' => $data ) )->isOK() ) { -- 2.20.1