Index: trunk/phase3/includes/HTMLFileCache.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | |
32 | 32 | public function fileCacheName() { |
33 | 33 | if( !$this->mFileCache ) { |
34 | | - global $wgCacheDirectory, $wgFileCacheDirectory; |
| 34 | + global $wgCacheDirectory, $wgFileCacheDirectory, $wgFileCacheDepth; |
35 | 35 | |
36 | 36 | if ( $wgFileCacheDirectory ) { |
37 | 37 | $dir = $wgFileCacheDirectory; |
— | — | @@ -42,14 +42,17 @@ |
43 | 43 | |
44 | 44 | # Store raw pages (like CSS hits) elsewhere |
45 | 45 | $subdir = ($this->mType === 'raw') ? 'raw/' : ''; |
| 46 | + |
46 | 47 | $key = $this->mTitle->getPrefixedDbkey(); |
47 | | - $hash = md5( $key ); |
| 48 | + if ( $wgFileCacheDepth > 0 ) { |
| 49 | + $hash = md5( $key ); |
| 50 | + for ( $i = 1; $i < $wgFileCacheDepth; $i++ ) { |
| 51 | + $subdir .= substr( $hash, 0, $i ) . '/'; |
| 52 | + } |
| 53 | + } |
48 | 54 | # Avoid extension confusion |
49 | 55 | $key = str_replace( '.', '%2E', urlencode( $key ) ); |
50 | | - |
51 | | - $hash1 = substr( $hash, 0, 1 ); |
52 | | - $hash2 = substr( $hash, 0, 2 ); |
53 | | - $this->mFileCache = "{$dir}/{$subdir}{$hash1}/{$hash2}/{$key}.html"; |
| 56 | + $this->mFileCache = "{$dir}/{$subdir}{$key}.html"; |
54 | 57 | |
55 | 58 | if( $this->useGzip() ) { |
56 | 59 | $this->mFileCache .= '.gz'; |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1602,6 +1602,14 @@ |
1603 | 1603 | $wgFileCacheDirectory = false; |
1604 | 1604 | |
1605 | 1605 | /** |
| 1606 | + * Depth of the subdirectory hierarchy to be created under |
| 1607 | + * $wgFileCacheDirectory. The subdirectories will be named based on |
| 1608 | + * the MD5 hash of the title. A value of 0 means all cache files will |
| 1609 | + * be put directly into the main file cache directory. |
| 1610 | + */ |
| 1611 | +$wgFileCacheDepth = 2; |
| 1612 | + |
| 1613 | +/** |
1606 | 1614 | * Keep parsed pages in a cache (objectcache table or memcached) |
1607 | 1615 | * to speed up output of the same page viewed by another user with the |
1608 | 1616 | * same options. |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -89,6 +89,8 @@ |
90 | 90 | * Sysops now have the "suppressredirect" right by default |
91 | 91 | * (bug 22463) $wgFooterIcons added to allow configuration of the icons shown in |
92 | 92 | the footers of skins. |
| 93 | +* $wgFileCacheDepth can be used to set the depth of the subdirectory hierarchy |
| 94 | + used for the file cache. Default value is 2, which matches former behavior |
93 | 95 | |
94 | 96 | === New features in 1.17 === |
95 | 97 | * (bug 10183) Users can now add personal styles and scripts to all skins via |