| @@ 681-693 (lines=13) @@ | ||
| 678 | * @param int $levels |
|
| 679 | * @return string |
|
| 680 | */ |
|
| 681 | protected static function getHashPathForLevel( $name, $levels ) { |
|
| 682 | if ( $levels == 0 ) { |
|
| 683 | return ''; |
|
| 684 | } else { |
|
| 685 | $hash = md5( $name ); |
|
| 686 | $path = ''; |
|
| 687 | for ( $i = 1; $i <= $levels; $i++ ) { |
|
| 688 | $path .= substr( $hash, 0, $i ) . '/'; |
|
| 689 | } |
|
| 690 | ||
| 691 | return $path; |
|
| 692 | } |
|
| 693 | } |
|
| 694 | ||
| 695 | /** |
|
| 696 | * Get the number of hash directory levels |
|
| @@ 212-224 (lines=13) @@ | ||
| 209 | * or the empty string if not $wgFileCacheDepth |
|
| 210 | * @return string |
|
| 211 | */ |
|
| 212 | protected function hashSubdirectory() { |
|
| 213 | global $wgFileCacheDepth; |
|
| 214 | ||
| 215 | $subdir = ''; |
|
| 216 | if ( $wgFileCacheDepth > 0 ) { |
|
| 217 | $hash = md5( $this->mKey ); |
|
| 218 | for ( $i = 1; $i <= $wgFileCacheDepth; $i++ ) { |
|
| 219 | $subdir .= substr( $hash, 0, $i ) . '/'; |
|
| 220 | } |
|
| 221 | } |
|
| 222 | ||
| 223 | return $subdir; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * Roughly increments the cache misses in the last hour by unique visitors |
|